| // This file was auto-generated by the veyron vdl tool. |
| // Source: dump.vdl |
| |
| package vom |
| |
| import ( |
| // VDL system imports |
| "fmt" |
| "v.io/v23/vdl" |
| ) |
| |
| type ( |
| // Primitive represents any single field of the Primitive union type. |
| // |
| // Primitive represents one of the primitive vom values. All vom values are |
| // composed of combinations of these primitives. |
| Primitive interface { |
| // Index returns the field index. |
| Index() int |
| // Interface returns the field value as an interface. |
| Interface() interface{} |
| // Name returns the field name. |
| Name() string |
| // __VDLReflect describes the Primitive union type. |
| __VDLReflect(__PrimitiveReflect) |
| } |
| // PrimitivePBool represents field PBool of the Primitive union type. |
| PrimitivePBool struct{ Value bool } |
| // PrimitivePByte represents field PByte of the Primitive union type. |
| PrimitivePByte struct{ Value byte } |
| // PrimitivePUint represents field PUint of the Primitive union type. |
| PrimitivePUint struct{ Value uint64 } |
| // PrimitivePInt represents field PInt of the Primitive union type. |
| PrimitivePInt struct{ Value int64 } |
| // PrimitivePFloat represents field PFloat of the Primitive union type. |
| PrimitivePFloat struct{ Value float64 } |
| // PrimitivePString represents field PString of the Primitive union type. |
| PrimitivePString struct{ Value string } |
| // PrimitivePControl represents field PControl of the Primitive union type. |
| PrimitivePControl struct{ Value ControlKind } |
| // __PrimitiveReflect describes the Primitive union type. |
| __PrimitiveReflect struct { |
| Name string "v.io/v23/vom.Primitive" |
| Type Primitive |
| Union struct { |
| PBool PrimitivePBool |
| PByte PrimitivePByte |
| PUint PrimitivePUint |
| PInt PrimitivePInt |
| PFloat PrimitivePFloat |
| PString PrimitivePString |
| PControl PrimitivePControl |
| } |
| } |
| ) |
| |
| func (x PrimitivePBool) Index() int { return 0 } |
| func (x PrimitivePBool) Interface() interface{} { return x.Value } |
| func (x PrimitivePBool) Name() string { return "PBool" } |
| func (x PrimitivePBool) __VDLReflect(__PrimitiveReflect) {} |
| |
| func (x PrimitivePByte) Index() int { return 1 } |
| func (x PrimitivePByte) Interface() interface{} { return x.Value } |
| func (x PrimitivePByte) Name() string { return "PByte" } |
| func (x PrimitivePByte) __VDLReflect(__PrimitiveReflect) {} |
| |
| func (x PrimitivePUint) Index() int { return 2 } |
| func (x PrimitivePUint) Interface() interface{} { return x.Value } |
| func (x PrimitivePUint) Name() string { return "PUint" } |
| func (x PrimitivePUint) __VDLReflect(__PrimitiveReflect) {} |
| |
| func (x PrimitivePInt) Index() int { return 3 } |
| func (x PrimitivePInt) Interface() interface{} { return x.Value } |
| func (x PrimitivePInt) Name() string { return "PInt" } |
| func (x PrimitivePInt) __VDLReflect(__PrimitiveReflect) {} |
| |
| func (x PrimitivePFloat) Index() int { return 4 } |
| func (x PrimitivePFloat) Interface() interface{} { return x.Value } |
| func (x PrimitivePFloat) Name() string { return "PFloat" } |
| func (x PrimitivePFloat) __VDLReflect(__PrimitiveReflect) {} |
| |
| func (x PrimitivePString) Index() int { return 5 } |
| func (x PrimitivePString) Interface() interface{} { return x.Value } |
| func (x PrimitivePString) Name() string { return "PString" } |
| func (x PrimitivePString) __VDLReflect(__PrimitiveReflect) {} |
| |
| func (x PrimitivePControl) Index() int { return 6 } |
| func (x PrimitivePControl) Interface() interface{} { return x.Value } |
| func (x PrimitivePControl) Name() string { return "PControl" } |
| func (x PrimitivePControl) __VDLReflect(__PrimitiveReflect) {} |
| |
| // DumpAtom describes a single indivisible piece of the vom encoding. The vom |
| // encoding is composed of a stream of these atoms. |
| type DumpAtom struct { |
| Kind DumpKind // The kind of this atom. |
| Bytes []byte // Raw bytes in the vom encoding representing this atom. |
| Data Primitive // Primitive data corresponding to the raw bytes. |
| Debug string // Free-form debug string with more information. |
| } |
| |
| func (DumpAtom) __VDLReflect(struct { |
| Name string "v.io/v23/vom.DumpAtom" |
| }) { |
| } |
| |
| // DumpKind enumerates the different kinds of dump atoms. |
| type DumpKind int |
| |
| const ( |
| DumpKindMagic DumpKind = iota |
| DumpKindControl |
| DumpKindMsgID |
| DumpKindTypeMsg |
| DumpKindValueMsg |
| DumpKindMsgLen |
| DumpKindTypeID |
| DumpKindPrimValue |
| DumpKindByteLen |
| DumpKindValueLen |
| DumpKindIndex |
| DumpKindWireTypeIndex |
| ) |
| |
| // DumpKindAll holds all labels for DumpKind. |
| var DumpKindAll = []DumpKind{DumpKindMagic, DumpKindControl, DumpKindMsgID, DumpKindTypeMsg, DumpKindValueMsg, DumpKindMsgLen, DumpKindTypeID, DumpKindPrimValue, DumpKindByteLen, DumpKindValueLen, DumpKindIndex, DumpKindWireTypeIndex} |
| |
| // DumpKindFromString creates a DumpKind from a string label. |
| func DumpKindFromString(label string) (x DumpKind, err error) { |
| err = x.Set(label) |
| return |
| } |
| |
| // Set assigns label to x. |
| func (x *DumpKind) Set(label string) error { |
| switch label { |
| case "Magic", "magic": |
| *x = DumpKindMagic |
| return nil |
| case "Control", "control": |
| *x = DumpKindControl |
| return nil |
| case "MsgID", "msgid": |
| *x = DumpKindMsgID |
| return nil |
| case "TypeMsg", "typemsg": |
| *x = DumpKindTypeMsg |
| return nil |
| case "ValueMsg", "valuemsg": |
| *x = DumpKindValueMsg |
| return nil |
| case "MsgLen", "msglen": |
| *x = DumpKindMsgLen |
| return nil |
| case "TypeID", "typeid": |
| *x = DumpKindTypeID |
| return nil |
| case "PrimValue", "primvalue": |
| *x = DumpKindPrimValue |
| return nil |
| case "ByteLen", "bytelen": |
| *x = DumpKindByteLen |
| return nil |
| case "ValueLen", "valuelen": |
| *x = DumpKindValueLen |
| return nil |
| case "Index", "index": |
| *x = DumpKindIndex |
| return nil |
| case "WireTypeIndex", "wiretypeindex": |
| *x = DumpKindWireTypeIndex |
| return nil |
| } |
| *x = -1 |
| return fmt.Errorf("unknown label %q in vom.DumpKind", label) |
| } |
| |
| // String returns the string label of x. |
| func (x DumpKind) String() string { |
| switch x { |
| case DumpKindMagic: |
| return "Magic" |
| case DumpKindControl: |
| return "Control" |
| case DumpKindMsgID: |
| return "MsgID" |
| case DumpKindTypeMsg: |
| return "TypeMsg" |
| case DumpKindValueMsg: |
| return "ValueMsg" |
| case DumpKindMsgLen: |
| return "MsgLen" |
| case DumpKindTypeID: |
| return "TypeID" |
| case DumpKindPrimValue: |
| return "PrimValue" |
| case DumpKindByteLen: |
| return "ByteLen" |
| case DumpKindValueLen: |
| return "ValueLen" |
| case DumpKindIndex: |
| return "Index" |
| case DumpKindWireTypeIndex: |
| return "WireTypeIndex" |
| } |
| return "" |
| } |
| |
| func (DumpKind) __VDLReflect(struct { |
| Name string "v.io/v23/vom.DumpKind" |
| Enum struct{ Magic, Control, MsgID, TypeMsg, ValueMsg, MsgLen, TypeID, PrimValue, ByteLen, ValueLen, Index, WireTypeIndex string } |
| }) { |
| } |
| |
| // ControlKind enumerates the different kinds of control bytes. |
| type ControlKind int |
| |
| const ( |
| ControlKindNIL ControlKind = iota |
| ControlKindEOF |
| ) |
| |
| // ControlKindAll holds all labels for ControlKind. |
| var ControlKindAll = []ControlKind{ControlKindNIL, ControlKindEOF} |
| |
| // ControlKindFromString creates a ControlKind from a string label. |
| func ControlKindFromString(label string) (x ControlKind, err error) { |
| err = x.Set(label) |
| return |
| } |
| |
| // Set assigns label to x. |
| func (x *ControlKind) Set(label string) error { |
| switch label { |
| case "NIL", "nil": |
| *x = ControlKindNIL |
| return nil |
| case "EOF", "eof": |
| *x = ControlKindEOF |
| return nil |
| } |
| *x = -1 |
| return fmt.Errorf("unknown label %q in vom.ControlKind", label) |
| } |
| |
| // String returns the string label of x. |
| func (x ControlKind) String() string { |
| switch x { |
| case ControlKindNIL: |
| return "NIL" |
| case ControlKindEOF: |
| return "EOF" |
| } |
| return "" |
| } |
| |
| func (ControlKind) __VDLReflect(struct { |
| Name string "v.io/v23/vom.ControlKind" |
| Enum struct{ NIL, EOF string } |
| }) { |
| } |
| |
| func init() { |
| vdl.Register((*Primitive)(nil)) |
| vdl.Register((*DumpAtom)(nil)) |
| vdl.Register((*DumpKind)(nil)) |
| vdl.Register((*ControlKind)(nil)) |
| } |