1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
////////////////////////////////////////////////////////////////////////////////
// Do not modify!
// Generated by codergen -go
////////////////////////////////////////////////////////////////////////////////
package test
import (
"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((*TypeA)(nil).Class())
registry.Add((*TypeB)(nil).Class())
}
var (
TypeAID = binary.ID{0xa4, 0xbe, 0x00, 0x04, 0x4c, 0x84, 0x76, 0x86, 0xdc, 0x77, 0x63, 0x6d, 0x19, 0xdd, 0x63, 0x33, 0x17, 0x38, 0xbf, 0x24}
TypeBID = binary.ID{0x73, 0xbd, 0xff, 0x55, 0x9c, 0xc4, 0x5b, 0xe3, 0xaf, 0x72, 0xfd, 0xb6, 0x97, 0xfb, 0x0e, 0xe1, 0x8d, 0x19, 0xa9, 0x67}
)
type binaryClassTypeA struct{}
func (*TypeA) Class() binary.Class {
return (*binaryClassTypeA)(nil)
}
func doEncodeTypeA(e binary.Encoder, o *TypeA) error {
if err := e.String(o.data); err != nil {
return err
}
return nil
}
func doDecodeTypeA(d binary.Decoder, o *TypeA) error {
if obj, err := d.String(); err != nil {
return err
} else {
o.data = string(obj)
}
return nil
}
func doSkipTypeA(d binary.Decoder) error {
if err := d.SkipString(); err != nil {
return err
}
return nil
}
func (*binaryClassTypeA) ID() binary.ID { return TypeAID }
func (*binaryClassTypeA) New() binary.Object { return &TypeA{} }
func (*binaryClassTypeA) Encode(e binary.Encoder, obj binary.Object) error {
return doEncodeTypeA(e, obj.(*TypeA))
}
func (*binaryClassTypeA) Decode(d binary.Decoder) (binary.Object, error) {
obj := &TypeA{}
return obj, doDecodeTypeA(d, obj)
}
func (*binaryClassTypeA) DecodeTo(d binary.Decoder, obj binary.Object) error {
return doDecodeTypeA(d, obj.(*TypeA))
}
func (*binaryClassTypeA) Skip(d binary.Decoder) error { return doSkipTypeA(d) }
func (*binaryClassTypeA) Schema() *schema.Class { return schemaTypeA }
var schemaTypeA = &schema.Class{
TypeID: TypeAID,
Name: "TypeA",
Fields: []schema.Field{
{Declared: "data", Type: &schema.Primitive{Name: "string", Method: schema.String}},
},
}
type binaryClassTypeB struct{}
func (*TypeB) Class() binary.Class {
return (*binaryClassTypeB)(nil)
}
func doEncodeTypeB(e binary.Encoder, o *TypeB) error {
if err := e.String(o.data); err != nil {
return err
}
return nil
}
func doDecodeTypeB(d binary.Decoder, o *TypeB) error {
if obj, err := d.String(); err != nil {
return err
} else {
o.data = string(obj)
}
return nil
}
func doSkipTypeB(d binary.Decoder) error {
if err := d.SkipString(); err != nil {
return err
}
return nil
}
func (*binaryClassTypeB) ID() binary.ID { return TypeBID }
func (*binaryClassTypeB) New() binary.Object { return &TypeB{} }
func (*binaryClassTypeB) Encode(e binary.Encoder, obj binary.Object) error {
return doEncodeTypeB(e, obj.(*TypeB))
}
func (*binaryClassTypeB) Decode(d binary.Decoder) (binary.Object, error) {
obj := &TypeB{}
return obj, doDecodeTypeB(d, obj)
}
func (*binaryClassTypeB) DecodeTo(d binary.Decoder, obj binary.Object) error {
return doDecodeTypeB(d, obj.(*TypeB))
}
func (*binaryClassTypeB) Skip(d binary.Decoder) error { return doSkipTypeB(d) }
func (*binaryClassTypeB) Schema() *schema.Class { return schemaTypeB }
var schemaTypeB = &schema.Class{
TypeID: TypeBID,
Name: "TypeB",
Fields: []schema.Field{
{Declared: "data", Type: &schema.Primitive{Name: "string", Method: schema.String}},
},
}
|