| |
| //////////////////////////////////////////////////////////////////////////////// |
| // Do not modify! |
| // Generated by codergen |
| //////////////////////////////////////////////////////////////////////////////// |
| |
| package test |
| |
| import ( |
| "io" |
| |
| "android.googlesource.com/platform/tools/gpu/framework/binary/registry" |
| "android.googlesource.com/platform/tools/gpu/framework/log" |
| "android.googlesource.com/platform/tools/gpu/framework/multiplexer" |
| "android.googlesource.com/platform/tools/gpu/framework/rpc" |
| ) |
| |
| // Client is the client interface for service calls. |
| type Client interface { |
| // Client exposes all the service interface methods. |
| RPC |
| // Close closes the client connection. |
| Close(ctx log.Context) error |
| // Namespace returns the custom namespace used for decoding responses from the |
| // server, or nil if no custom namespace has been specified. |
| Namespace() *registry.Namespace |
| // SetNamespace replaces the namespace used for decoding objects. |
| SetNamespace(n *registry.Namespace) |
| } |
| type client struct{ rpc rpc.Client } |
| |
| // NewClient creates a new rpc client using s for communication and n for |
| // decoding objects. If n is nil then the global namespace is used. |
| func NewClient(ctx log.Context, s io.ReadWriteCloser, n *registry.Namespace) Client { |
| m := multiplexer.New(ctx, s, 0, nil) |
| return &client{rpc.NewClient(m, n)} |
| } |
| |
| // Close closes the client connection. |
| func (c *client) Close(ctx log.Context) error { |
| return c.rpc.Close(ctx) |
| } |
| |
| // Namespace returns the custom namespace used for decoding responses from the |
| // server, or nil if no custom namespace has been specified. |
| func (c *client) Namespace() *registry.Namespace { |
| return c.rpc.Namespace(); |
| } |
| |
| // SetNamespace replaces the namespace used for decoding objects. |
| func (c *client) SetNamespace(n *registry.Namespace) { |
| c.rpc = rpc.NewClient(c.rpc.Multiplexer(), n); |
| } |
| |
| // Add implements the RPC interface. |
| func (c *client) Add(ctx log.Context, a uint32, b uint32) (res uint32, err error) { |
| val, err := c.rpc.Send(&callAdd{a: a, b: b}); |
| if err != nil { |
| return res, ctx.WrapError(err, "Calling RPC.Add") |
| } |
| return val.(*resultAdd).value, nil |
| } |
| |
| // EnumToString implements the RPC interface. |
| func (c *client) EnumToString(ctx log.Context, e Enum) (res string, err error) { |
| val, err := c.rpc.Send(&callEnumToString{e: e}); |
| if err != nil { |
| return res, ctx.WrapError(err, "Calling RPC.EnumToString") |
| } |
| return val.(*resultEnumToString).value, nil |
| } |
| |
| // GetListNodeChain implements the RPC interface. |
| func (c *client) GetListNodeChain(ctx log.Context) (res *ListNode, err error) { |
| val, err := c.rpc.Send(&callGetListNodeChain{}); |
| if err != nil { |
| return res, ctx.WrapError(err, "Calling RPC.GetListNodeChain") |
| } |
| return val.(*resultGetListNodeChain).value, nil |
| } |
| |
| // GetListNodeChainArray implements the RPC interface. |
| func (c *client) GetListNodeChainArray(ctx log.Context) (res []*ListNode, err error) { |
| val, err := c.rpc.Send(&callGetListNodeChainArray{}); |
| if err != nil { |
| return res, ctx.WrapError(err, "Calling RPC.GetListNodeChainArray") |
| } |
| return val.(*resultGetListNodeChainArray).value, nil |
| } |
| |
| // GetResource implements the RPC interface. |
| func (c *client) GetResource(ctx log.Context) (res ResourceID, err error) { |
| val, err := c.rpc.Send(&callGetResource{}); |
| if err != nil { |
| return res, ctx.WrapError(err, "Calling RPC.GetResource") |
| } |
| return val.(*resultGetResource).value, nil |
| } |
| |
| // GetSingleListNode implements the RPC interface. |
| func (c *client) GetSingleListNode(ctx log.Context) (res *ListNode, err error) { |
| val, err := c.rpc.Send(&callGetSingleListNode{}); |
| if err != nil { |
| return res, ctx.WrapError(err, "Calling RPC.GetSingleListNode") |
| } |
| return val.(*resultGetSingleListNode).value, nil |
| } |
| |
| // GetStruct implements the RPC interface. |
| func (c *client) GetStruct(ctx log.Context) (res Struct, err error) { |
| val, err := c.rpc.Send(&callGetStruct{}); |
| if err != nil { |
| return res, ctx.WrapError(err, "Calling RPC.GetStruct") |
| } |
| return val.(*resultGetStruct).value, nil |
| } |
| |
| // ResolveResource implements the RPC interface. |
| func (c *client) ResolveResource(ctx log.Context, r ResourceID) (res Resource, err error) { |
| val, err := c.rpc.Send(&callResolveResource{r: r}); |
| if err != nil { |
| return res, ctx.WrapError(err, "Calling RPC.ResolveResource") |
| } |
| return val.(*resultResolveResource).value, nil |
| } |
| |
| // SetStruct implements the RPC interface. |
| func (c *client) SetStruct(ctx log.Context, s Struct) error { |
| _, err := c.rpc.Send(&callSetStruct{s: s}) |
| if err != nil { |
| return ctx.WrapError(err, "Calling RPC.SetStruct") |
| } |
| return nil} |
| |
| // UseResource implements the RPC interface. |
| func (c *client) UseResource(ctx log.Context, r ResourceID) error { |
| _, err := c.rpc.Send(&callUseResource{r: r}) |
| if err != nil { |
| return ctx.WrapError(err, "Calling RPC.UseResource") |
| } |
| return nil} |