blob: 806d1d340ab01f8c24df29700503f9a1786dd016 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// This file was auto-generated by the vanadium 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 `vdl:"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 `vdl:"v.io/v23/vom.DumpAtom"`
}) {
}
// DumpKind enumerates the different kinds of dump atoms.
type DumpKind int
const (
DumpKindVersion DumpKind = iota
DumpKindControl
DumpKindMsgId
DumpKindTypeMsg
DumpKindValueMsg
DumpKindMsgLen
DumpKindTypeId
DumpKindPrimValue
DumpKindByteLen
DumpKindValueLen
DumpKindIndex
DumpKindWireTypeIndex
)
// DumpKindAll holds all labels for DumpKind.
var DumpKindAll = [...]DumpKind{DumpKindVersion, 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 "Version", "version":
*x = DumpKindVersion
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 DumpKindVersion:
return "Version"
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 `vdl:"v.io/v23/vom.DumpKind"`
Enum struct{ Version, 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
ControlKindEnd
)
// ControlKindAll holds all labels for ControlKind.
var ControlKindAll = [...]ControlKind{ControlKindNil, ControlKindEnd}
// 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 "End", "end":
*x = ControlKindEnd
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 ControlKindEnd:
return "End"
}
return ""
}
func (ControlKind) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.ControlKind"`
Enum struct{ Nil, End string }
}) {
}
func init() {
vdl.Register((*Primitive)(nil))
vdl.Register((*DumpAtom)(nil))
vdl.Register((*DumpKind)(nil))
vdl.Register((*ControlKind)(nil))
}