blob: e93fba34f61475d986b761753f2bd177a48d422c [file] [log] [blame]
////////////////////////////////////////////////////////////////////////////////
// Do not modify!
// Generated by codergen -go
////////////////////////////////////////////////////////////////////////////////
package protocol
import (
"fmt"
"android.googlesource.com/platform/tools/gpu/binary"
"android.googlesource.com/platform/tools/gpu/binary/registry"
"android.googlesource.com/platform/tools/gpu/binary/schema"
)
func init() {
registry.Add((*ResourceInfo)(nil).Class())
registry.Add((*Payload)(nil).Class())
}
var (
binaryIDResourceInfo = binary.ID{0xbb, 0x38, 0xf6, 0x19, 0x39, 0xc0, 0xe0, 0x4b, 0x6b, 0xc9, 0x83, 0x6d, 0x6d, 0x88, 0x9d, 0xa6, 0x03, 0x28, 0x07, 0x9d}
binaryIDPayload = binary.ID{0x8b, 0x2c, 0x72, 0xa4, 0x9c, 0xec, 0x85, 0xf4, 0x10, 0xaa, 0x86, 0x3a, 0xe9, 0x7e, 0x5c, 0xfc, 0x33, 0xd7, 0x0a, 0x66}
)
type binaryClassResourceInfo struct{}
func (*ResourceInfo) Class() binary.Class {
return (*binaryClassResourceInfo)(nil)
}
func doEncodeResourceInfo(e binary.Encoder, o *ResourceInfo) error {
if err := e.String(o.ID); err != nil {
return err
}
if err := e.Uint32(o.Size); err != nil {
return err
}
return nil
}
func doDecodeResourceInfo(d binary.Decoder, o *ResourceInfo) error {
if obj, err := d.String(); err != nil {
return err
} else {
o.ID = string(obj)
}
if obj, err := d.Uint32(); err != nil {
return err
} else {
o.Size = uint32(obj)
}
return nil
}
func doSkipResourceInfo(d binary.Decoder) error {
if err := d.SkipString(); err != nil {
return err
}
if _, err := d.Uint32(); err != nil {
return err
}
return nil
}
func (*binaryClassResourceInfo) ID() binary.ID { return binaryIDResourceInfo }
func (*binaryClassResourceInfo) New() binary.Object { return &ResourceInfo{} }
func (*binaryClassResourceInfo) Encode(e binary.Encoder, obj binary.Object) error {
return doEncodeResourceInfo(e, obj.(*ResourceInfo))
}
func (*binaryClassResourceInfo) Decode(d binary.Decoder) (binary.Object, error) {
obj := &ResourceInfo{}
return obj, doDecodeResourceInfo(d, obj)
}
func (*binaryClassResourceInfo) DecodeTo(d binary.Decoder, obj binary.Object) error {
return doDecodeResourceInfo(d, obj.(*ResourceInfo))
}
func (*binaryClassResourceInfo) Skip(d binary.Decoder) error { return doSkipResourceInfo(d) }
func (*binaryClassResourceInfo) Schema() *schema.Class { return schemaResourceInfo }
var schemaResourceInfo = &schema.Class{
TypeID: binaryIDResourceInfo,
Name: "ResourceInfo",
Fields: []schema.Field{
schema.Field{Declared: "ID", Type: &schema.Primitive{Name: "string", Method: schema.String}},
schema.Field{Declared: "Size", Type: &schema.Primitive{Name: "uint32", Method: schema.Uint32}},
},
}
type binaryClassPayload struct{}
func (*Payload) Class() binary.Class {
return (*binaryClassPayload)(nil)
}
func doEncodePayload(e binary.Encoder, o *Payload) error {
if err := e.Uint32(o.StackSize); err != nil {
return err
}
if err := e.Uint32(o.VolatileMemorySize); err != nil {
return err
}
if err := e.Uint32(uint32(len(o.Constants))); err != nil {
return err
}
if err := e.Data(o.Constants); err != nil {
return err
}
if err := e.Uint32(uint32(len(o.Resources))); err != nil {
return err
}
for i := range o.Resources {
if err := e.Value(&o.Resources[i]); err != nil {
return err
}
}
if err := e.Uint32(uint32(len(o.Opcodes))); err != nil {
return err
}
if err := e.Data(o.Opcodes); err != nil {
return err
}
return nil
}
func doDecodePayload(d binary.Decoder, o *Payload) error {
if obj, err := d.Uint32(); err != nil {
return err
} else {
o.StackSize = uint32(obj)
}
if obj, err := d.Uint32(); err != nil {
return err
} else {
o.VolatileMemorySize = uint32(obj)
}
if count, err := d.Uint32(); err != nil {
return err
} else {
o.Constants = make([]byte, count)
if err := d.Data(o.Constants); err != nil {
return err
}
}
if count, err := d.Uint32(); err != nil {
return err
} else {
o.Resources = make([]ResourceInfo, count)
for i := range o.Resources {
if err := d.Value(&o.Resources[i]); err != nil {
return err
}
}
}
if count, err := d.Uint32(); err != nil {
return err
} else {
o.Opcodes = make([]byte, count)
if err := d.Data(o.Opcodes); err != nil {
return err
}
}
return nil
}
func doSkipPayload(d binary.Decoder) error {
if _, err := d.Uint32(); err != nil {
return err
}
if _, err := d.Uint32(); err != nil {
return err
}
if count, err := d.Uint32(); err != nil {
return err
} else {
if err := d.Skip(count); err != nil {
return err
}
}
if count, err := d.Uint32(); err != nil {
return err
} else {
for i := uint32(0); i < count; i++ {
if err := d.SkipValue((*ResourceInfo)(nil)); err != nil {
return err
}
}
}
if count, err := d.Uint32(); err != nil {
return err
} else {
if err := d.Skip(count); err != nil {
return err
}
}
return nil
}
func (*binaryClassPayload) ID() binary.ID { return binaryIDPayload }
func (*binaryClassPayload) New() binary.Object { return &Payload{} }
func (*binaryClassPayload) Encode(e binary.Encoder, obj binary.Object) error {
return doEncodePayload(e, obj.(*Payload))
}
func (*binaryClassPayload) Decode(d binary.Decoder) (binary.Object, error) {
obj := &Payload{}
return obj, doDecodePayload(d, obj)
}
func (*binaryClassPayload) DecodeTo(d binary.Decoder, obj binary.Object) error {
return doDecodePayload(d, obj.(*Payload))
}
func (*binaryClassPayload) Skip(d binary.Decoder) error { return doSkipPayload(d) }
func (*binaryClassPayload) Schema() *schema.Class { return schemaPayload }
var schemaPayload = &schema.Class{
TypeID: binaryIDPayload,
Name: "Payload",
Fields: []schema.Field{
schema.Field{Declared: "StackSize", Type: &schema.Primitive{Name: "uint32", Method: schema.Uint32}},
schema.Field{Declared: "VolatileMemorySize", Type: &schema.Primitive{Name: "uint32", Method: schema.Uint32}},
schema.Field{Declared: "Constants", Type: &schema.Slice{Alias: "", ValueType: &schema.Primitive{Name: "byte", Method: schema.Uint8}}},
schema.Field{Declared: "Resources", Type: &schema.Slice{Alias: "", ValueType: &schema.Struct{Name: "ResourceInfo"}}},
schema.Field{Declared: "Opcodes", Type: &schema.Slice{Alias: "", ValueType: &schema.Primitive{Name: "byte", Method: schema.Uint8}}},
},
}
const _ConnectionType_name = "DeviceInfoReplay"
var _ConnectionType_map = map[ConnectionType]string{
0: _ConnectionType_name[0:10],
1: _ConnectionType_name[10:16],
}
func (v ConnectionType) String() string {
if s, ok := _ConnectionType_map[v]; ok {
return s
}
return fmt.Sprintf("ConnectionType(%d)", v)
}
func (v *ConnectionType) Parse(s string) error {
for k, t := range _ConnectionType_map {
if s == t {
*v = k
return nil
}
}
return fmt.Errorf("%s not in ConnectionType", s)
}
const _MessageType_name = "GetPost"
var _MessageType_map = map[MessageType]string{
0: _MessageType_name[0:3],
1: _MessageType_name[3:7],
}
func (v MessageType) String() string {
if s, ok := _MessageType_map[v]; ok {
return s
}
return fmt.Sprintf("MessageType(%d)", v)
}
func (v *MessageType) Parse(s string) error {
for k, t := range _MessageType_map {
if s == t {
*v = k
return nil
}
}
return fmt.Errorf("%s not in MessageType", s)
}
const _Type_name = "BoolInt8Int16Int32Int64Uint8Uint16Uint32Uint64FloatDoubleAbsolutePointerConstantPointerVolatilePointerVoid"
var _Type_map = map[Type]string{
0: _Type_name[0:4],
1: _Type_name[4:8],
2: _Type_name[8:13],
3: _Type_name[13:18],
4: _Type_name[18:23],
5: _Type_name[23:28],
6: _Type_name[28:34],
7: _Type_name[34:40],
8: _Type_name[40:46],
9: _Type_name[46:51],
10: _Type_name[51:57],
11: _Type_name[57:72],
12: _Type_name[72:87],
13: _Type_name[87:102],
4294967295: _Type_name[102:106],
}
func (v Type) String() string {
if s, ok := _Type_map[v]; ok {
return s
}
return fmt.Sprintf("Type(%d)", v)
}
func (v *Type) Parse(s string) error {
for k, t := range _Type_map {
if s == t {
*v = k
return nil
}
}
return fmt.Errorf("%s not in Type", s)
}