MCPcopy Create free account
hub / github.com/google/gapid / CmdToService

Function CmdToService

gapis/api/cmd_service.go:27–59  ·  view source on GitHub ↗

CmdToService returns the service command representing command c.

(c Cmd)

Source from the content-addressed store, hash-verified

25
26// CmdToService returns the service command representing command c.
27func CmdToService(c Cmd) (*Command, error) {
28 out := &Command{
29 Name: c.CmdName(),
30 Thread: c.Thread(),
31 }
32
33 if api := c.API(); api != nil {
34 out.API = &path.API{ID: path.NewID(id.ID(api.ID()))}
35 }
36
37 for _, p := range c.CmdParams() {
38 param := &Parameter{
39 Name: p.Name,
40 Value: box.NewValue(p.Get()),
41 }
42 if p.Constants > 0 {
43 param.Constants = out.API.ConstantSet(p.Constants)
44 }
45 out.Parameters = append(out.Parameters, param)
46 }
47
48 if p := c.CmdResult(); p != nil {
49 out.Result = &Parameter{
50 Name: p.Name,
51 Value: box.NewValue(p.Get()),
52 }
53 if p.Constants >= 0 {
54 out.Result.Constants = out.API.ConstantSet(p.Constants)
55 }
56 }
57
58 return out, nil
59}
60
61// ServiceToCmd returns the command built from c.
62func ServiceToCmd(a arena.Arena, c *Command) (Cmd, error) {

Callers

nothing calls this directly

Calls 8

ConstantSetMethod · 0.80
CmdNameMethod · 0.65
ThreadMethod · 0.65
APIMethod · 0.65
IDMethod · 0.65
CmdParamsMethod · 0.65
GetMethod · 0.65
CmdResultMethod · 0.65

Tested by

no test coverage detected