blob: 26a06affae6029f453a081d69a5cbcd0717a55ba [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.
// Package: vom
package vom
import (
"fmt"
"v.io/v23/vdl"
)
var _ = __VDLInit() // Must be first; see __VDLInit comments for details.
//////////////////////////////////////////////////
// Type definitions
// ControlKind enumerates the different kinds of control bytes.
type ControlKind int
const (
ControlKindNil ControlKind = iota
ControlKindEnd
ControlKindIncompleteType
)
// ControlKindAll holds all labels for ControlKind.
var ControlKindAll = [...]ControlKind{ControlKindNil, ControlKindEnd, ControlKindIncompleteType}
// 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
case "IncompleteType", "incompletetype":
*x = ControlKindIncompleteType
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"
case ControlKindIncompleteType:
return "IncompleteType"
}
return ""
}
func (ControlKind) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.ControlKind"`
Enum struct{ Nil, End, IncompleteType string }
}) {
}
func (x ControlKind) VDLIsZero() bool {
return x == ControlKindNil
}
func (x ControlKind) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*ControlKind)(nil))); err != nil {
return err
}
if err := enc.EncodeString(x.String()); err != nil {
return err
}
return enc.FinishValue()
}
func (x *ControlKind) VDLRead(dec vdl.Decoder) error {
if err := dec.StartValue(); err != nil {
return err
}
enum, err := dec.DecodeString()
if err != nil {
return err
}
if err := x.Set(enum); err != nil {
return err
}
return dec.FinishValue()
}
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)
VDLIsZero() bool
VDLWrite(vdl.Encoder) error
}
// 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) {}
func (x PrimitivePBool) VDLIsZero() bool {
return !x.Value
}
func (x PrimitivePByte) VDLIsZero() bool {
return false
}
func (x PrimitivePUint) VDLIsZero() bool {
return false
}
func (x PrimitivePInt) VDLIsZero() bool {
return false
}
func (x PrimitivePFloat) VDLIsZero() bool {
return false
}
func (x PrimitivePString) VDLIsZero() bool {
return false
}
func (x PrimitivePControl) VDLIsZero() bool {
return false
}
func (x PrimitivePBool) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*Primitive)(nil))); err != nil {
return err
}
if err := enc.NextField("PBool"); err != nil {
return err
}
if err := enc.StartValue(vdl.BoolType); err != nil {
return err
}
if err := enc.EncodeBool(x.Value); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x PrimitivePByte) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*Primitive)(nil))); err != nil {
return err
}
if err := enc.NextField("PByte"); err != nil {
return err
}
if err := enc.StartValue(vdl.ByteType); err != nil {
return err
}
if err := enc.EncodeUint(uint64(x.Value)); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x PrimitivePUint) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*Primitive)(nil))); err != nil {
return err
}
if err := enc.NextField("PUint"); err != nil {
return err
}
if err := enc.StartValue(vdl.Uint64Type); err != nil {
return err
}
if err := enc.EncodeUint(x.Value); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x PrimitivePInt) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*Primitive)(nil))); err != nil {
return err
}
if err := enc.NextField("PInt"); err != nil {
return err
}
if err := enc.StartValue(vdl.Int64Type); err != nil {
return err
}
if err := enc.EncodeInt(x.Value); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x PrimitivePFloat) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*Primitive)(nil))); err != nil {
return err
}
if err := enc.NextField("PFloat"); err != nil {
return err
}
if err := enc.StartValue(vdl.Float64Type); err != nil {
return err
}
if err := enc.EncodeFloat(x.Value); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x PrimitivePString) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*Primitive)(nil))); err != nil {
return err
}
if err := enc.NextField("PString"); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x.Value); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x PrimitivePControl) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*Primitive)(nil))); err != nil {
return err
}
if err := enc.NextField("PControl"); err != nil {
return err
}
if err := x.Value.VDLWrite(enc); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func VDLReadPrimitive(dec vdl.Decoder, x *Primitive) error {
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(x), dec.Type()) {
return fmt.Errorf("incompatible union %T, from %v", x, dec.Type())
}
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "PBool":
var field PrimitivePBool
if err := dec.StartValue(); err != nil {
return err
}
var err error
if field.Value, err = dec.DecodeBool(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
*x = field
case "PByte":
var field PrimitivePByte
if err := dec.StartValue(); err != nil {
return err
}
tmp, err := dec.DecodeUint(8)
if err != nil {
return err
}
field.Value = byte(tmp)
if err := dec.FinishValue(); err != nil {
return err
}
*x = field
case "PUint":
var field PrimitivePUint
if err := dec.StartValue(); err != nil {
return err
}
var err error
if field.Value, err = dec.DecodeUint(64); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
*x = field
case "PInt":
var field PrimitivePInt
if err := dec.StartValue(); err != nil {
return err
}
var err error
if field.Value, err = dec.DecodeInt(64); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
*x = field
case "PFloat":
var field PrimitivePFloat
if err := dec.StartValue(); err != nil {
return err
}
var err error
if field.Value, err = dec.DecodeFloat(64); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
*x = field
case "PString":
var field PrimitivePString
if err := dec.StartValue(); err != nil {
return err
}
var err error
if field.Value, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
*x = field
case "PControl":
var field PrimitivePControl
if err := field.Value.VDLRead(dec); err != nil {
return err
}
*x = field
case "":
return fmt.Errorf("missing field in union %T, from %v", x, dec.Type())
default:
return fmt.Errorf("field %q not in union %T, from %v", f, x, dec.Type())
}
switch f, err := dec.NextField(); {
case err != nil:
return err
case f != "":
return fmt.Errorf("extra field %q in union %T, from %v", f, x, dec.Type())
}
return dec.FinishValue()
}
// DumpKind enumerates the different kinds of dump atoms.
type DumpKind int
const (
DumpKindVersion DumpKind = iota
DumpKindControl
DumpKindMsgId
DumpKindTypeMsg
DumpKindValueMsg
DumpKindMsgLen
DumpKindAnyMsgLen
DumpKindAnyLensLen
DumpKindTypeIdsLen
DumpKindTypeId
DumpKindPrimValue
DumpKindByteLen
DumpKindValueLen
DumpKindIndex
DumpKindWireTypeIndex
)
// DumpKindAll holds all labels for DumpKind.
var DumpKindAll = [...]DumpKind{DumpKindVersion, DumpKindControl, DumpKindMsgId, DumpKindTypeMsg, DumpKindValueMsg, DumpKindMsgLen, DumpKindAnyMsgLen, DumpKindAnyLensLen, DumpKindTypeIdsLen, 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 "AnyMsgLen", "anymsglen":
*x = DumpKindAnyMsgLen
return nil
case "AnyLensLen", "anylenslen":
*x = DumpKindAnyLensLen
return nil
case "TypeIdsLen", "typeidslen":
*x = DumpKindTypeIdsLen
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 DumpKindAnyMsgLen:
return "AnyMsgLen"
case DumpKindAnyLensLen:
return "AnyLensLen"
case DumpKindTypeIdsLen:
return "TypeIdsLen"
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, AnyMsgLen, AnyLensLen, TypeIdsLen, TypeId, PrimValue, ByteLen, ValueLen, Index, WireTypeIndex string }
}) {
}
func (x DumpKind) VDLIsZero() bool {
return x == DumpKindVersion
}
func (x DumpKind) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*DumpKind)(nil))); err != nil {
return err
}
if err := enc.EncodeString(x.String()); err != nil {
return err
}
return enc.FinishValue()
}
func (x *DumpKind) VDLRead(dec vdl.Decoder) error {
if err := dec.StartValue(); err != nil {
return err
}
enum, err := dec.DecodeString()
if err != nil {
return err
}
if err := x.Set(enum); err != nil {
return err
}
return dec.FinishValue()
}
// 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"`
}) {
}
func (x DumpAtom) VDLIsZero() bool {
if x.Kind != DumpKindVersion {
return false
}
if len(x.Bytes) != 0 {
return false
}
if x.Data != nil && !x.Data.VDLIsZero() {
return false
}
if x.Debug != "" {
return false
}
return true
}
func (x DumpAtom) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*DumpAtom)(nil)).Elem()); err != nil {
return err
}
if x.Kind != DumpKindVersion {
if err := enc.NextField("Kind"); err != nil {
return err
}
if err := x.Kind.VDLWrite(enc); err != nil {
return err
}
}
if len(x.Bytes) != 0 {
if err := enc.NextField("Bytes"); err != nil {
return err
}
if err := enc.StartValue(vdl.TypeOf((*[]byte)(nil))); err != nil {
return err
}
if err := enc.EncodeBytes(x.Bytes); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if x.Data != nil && !x.Data.VDLIsZero() {
if err := enc.NextField("Data"); err != nil {
return err
}
if err := x.Data.VDLWrite(enc); err != nil {
return err
}
}
if x.Debug != "" {
if err := enc.NextField("Debug"); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x.Debug); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x *DumpAtom) VDLRead(dec vdl.Decoder) error {
*x = DumpAtom{
Data: PrimitivePBool{},
}
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible struct %T, from %v", *x, dec.Type())
}
for {
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "":
return dec.FinishValue()
case "Kind":
if err := x.Kind.VDLRead(dec); err != nil {
return err
}
case "Bytes":
if err := dec.StartValue(); err != nil {
return err
}
if err := dec.DecodeBytes(-1, &x.Bytes); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
case "Data":
if err := VDLReadPrimitive(dec, &x.Data); err != nil {
return err
}
case "Debug":
if err := dec.StartValue(); err != nil {
return err
}
var err error
if x.Debug, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
default:
if err := dec.SkipValue(); err != nil {
return err
}
}
}
}
// Version is the vom version.
type Version byte
func (Version) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.Version"`
}) {
}
func (x Version) VDLIsZero() bool {
return x == 0
}
func (x Version) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*Version)(nil))); err != nil {
return err
}
if err := enc.EncodeUint(uint64(x)); err != nil {
return err
}
return enc.FinishValue()
}
func (x *Version) VDLRead(dec vdl.Decoder) error {
if err := dec.StartValue(); err != nil {
return err
}
tmp, err := dec.DecodeUint(8)
if err != nil {
return err
}
*x = Version(tmp)
return dec.FinishValue()
}
// TypeId uniquely identifies a type definition within a vom stream.
type TypeId uint64
func (TypeId) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.TypeId"`
}) {
}
func (x TypeId) VDLIsZero() bool {
return x == 0
}
func (x TypeId) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*TypeId)(nil))); err != nil {
return err
}
if err := enc.EncodeUint(uint64(x)); err != nil {
return err
}
return enc.FinishValue()
}
func (x *TypeId) VDLRead(dec vdl.Decoder) error {
if err := dec.StartValue(); err != nil {
return err
}
tmp, err := dec.DecodeUint(64)
if err != nil {
return err
}
*x = TypeId(tmp)
return dec.FinishValue()
}
// wireNamed represents a type definition for named primitives.
type wireNamed struct {
Name string
Base TypeId
}
func (wireNamed) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.wireNamed"`
}) {
}
func (x wireNamed) VDLIsZero() bool {
return x == wireNamed{}
}
func (x wireNamed) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireNamed)(nil)).Elem()); err != nil {
return err
}
if x.Name != "" {
if err := enc.NextField("Name"); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x.Name); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if x.Base != 0 {
if err := enc.NextField("Base"); err != nil {
return err
}
if err := x.Base.VDLWrite(enc); err != nil {
return err
}
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x *wireNamed) VDLRead(dec vdl.Decoder) error {
*x = wireNamed{}
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible struct %T, from %v", *x, dec.Type())
}
for {
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "":
return dec.FinishValue()
case "Name":
if err := dec.StartValue(); err != nil {
return err
}
var err error
if x.Name, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
case "Base":
if err := x.Base.VDLRead(dec); err != nil {
return err
}
default:
if err := dec.SkipValue(); err != nil {
return err
}
}
}
}
// wireEnum represents an type definition for enum types.
type wireEnum struct {
Name string
Labels []string
}
func (wireEnum) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.wireEnum"`
}) {
}
func (x wireEnum) VDLIsZero() bool {
if x.Name != "" {
return false
}
if len(x.Labels) != 0 {
return false
}
return true
}
func (x wireEnum) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireEnum)(nil)).Elem()); err != nil {
return err
}
if x.Name != "" {
if err := enc.NextField("Name"); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x.Name); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if len(x.Labels) != 0 {
if err := enc.NextField("Labels"); err != nil {
return err
}
if err := __VDLWriteAnon_list_1(enc, x.Labels); err != nil {
return err
}
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func __VDLWriteAnon_list_1(enc vdl.Encoder, x []string) error {
if err := enc.StartValue(vdl.TypeOf((*[]string)(nil))); err != nil {
return err
}
if err := enc.SetLenHint(len(x)); err != nil {
return err
}
for i := 0; i < len(x); i++ {
if err := enc.NextEntry(false); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x[i]); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if err := enc.NextEntry(true); err != nil {
return err
}
return enc.FinishValue()
}
func (x *wireEnum) VDLRead(dec vdl.Decoder) error {
*x = wireEnum{}
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible struct %T, from %v", *x, dec.Type())
}
for {
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "":
return dec.FinishValue()
case "Name":
if err := dec.StartValue(); err != nil {
return err
}
var err error
if x.Name, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
case "Labels":
if err := __VDLReadAnon_list_1(dec, &x.Labels); err != nil {
return err
}
default:
if err := dec.SkipValue(); err != nil {
return err
}
}
}
}
func __VDLReadAnon_list_1(dec vdl.Decoder, x *[]string) error {
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible list %T, from %v", *x, dec.Type())
}
switch len := dec.LenHint(); {
case len > 0:
*x = make([]string, 0, len)
default:
*x = nil
}
for {
switch done, err := dec.NextEntry(); {
case err != nil:
return err
case done:
return dec.FinishValue()
}
var elem string
if err := dec.StartValue(); err != nil {
return err
}
var err error
if elem, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
*x = append(*x, elem)
}
}
// wireArray represents an type definition for array types.
type wireArray struct {
Name string
Elem TypeId
Len uint64
}
func (wireArray) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.wireArray"`
}) {
}
func (x wireArray) VDLIsZero() bool {
return x == wireArray{}
}
func (x wireArray) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireArray)(nil)).Elem()); err != nil {
return err
}
if x.Name != "" {
if err := enc.NextField("Name"); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x.Name); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if x.Elem != 0 {
if err := enc.NextField("Elem"); err != nil {
return err
}
if err := x.Elem.VDLWrite(enc); err != nil {
return err
}
}
if x.Len != 0 {
if err := enc.NextField("Len"); err != nil {
return err
}
if err := enc.StartValue(vdl.Uint64Type); err != nil {
return err
}
if err := enc.EncodeUint(x.Len); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x *wireArray) VDLRead(dec vdl.Decoder) error {
*x = wireArray{}
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible struct %T, from %v", *x, dec.Type())
}
for {
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "":
return dec.FinishValue()
case "Name":
if err := dec.StartValue(); err != nil {
return err
}
var err error
if x.Name, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
case "Elem":
if err := x.Elem.VDLRead(dec); err != nil {
return err
}
case "Len":
if err := dec.StartValue(); err != nil {
return err
}
var err error
if x.Len, err = dec.DecodeUint(64); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
default:
if err := dec.SkipValue(); err != nil {
return err
}
}
}
}
// wireList represents a type definition for list types.
type wireList struct {
Name string
Elem TypeId
}
func (wireList) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.wireList"`
}) {
}
func (x wireList) VDLIsZero() bool {
return x == wireList{}
}
func (x wireList) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireList)(nil)).Elem()); err != nil {
return err
}
if x.Name != "" {
if err := enc.NextField("Name"); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x.Name); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if x.Elem != 0 {
if err := enc.NextField("Elem"); err != nil {
return err
}
if err := x.Elem.VDLWrite(enc); err != nil {
return err
}
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x *wireList) VDLRead(dec vdl.Decoder) error {
*x = wireList{}
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible struct %T, from %v", *x, dec.Type())
}
for {
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "":
return dec.FinishValue()
case "Name":
if err := dec.StartValue(); err != nil {
return err
}
var err error
if x.Name, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
case "Elem":
if err := x.Elem.VDLRead(dec); err != nil {
return err
}
default:
if err := dec.SkipValue(); err != nil {
return err
}
}
}
}
// wireSet represents a type definition for set types.
type wireSet struct {
Name string
Key TypeId
}
func (wireSet) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.wireSet"`
}) {
}
func (x wireSet) VDLIsZero() bool {
return x == wireSet{}
}
func (x wireSet) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireSet)(nil)).Elem()); err != nil {
return err
}
if x.Name != "" {
if err := enc.NextField("Name"); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x.Name); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if x.Key != 0 {
if err := enc.NextField("Key"); err != nil {
return err
}
if err := x.Key.VDLWrite(enc); err != nil {
return err
}
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x *wireSet) VDLRead(dec vdl.Decoder) error {
*x = wireSet{}
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible struct %T, from %v", *x, dec.Type())
}
for {
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "":
return dec.FinishValue()
case "Name":
if err := dec.StartValue(); err != nil {
return err
}
var err error
if x.Name, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
case "Key":
if err := x.Key.VDLRead(dec); err != nil {
return err
}
default:
if err := dec.SkipValue(); err != nil {
return err
}
}
}
}
// wireMap represents a type definition for map types.
type wireMap struct {
Name string
Key TypeId
Elem TypeId
}
func (wireMap) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.wireMap"`
}) {
}
func (x wireMap) VDLIsZero() bool {
return x == wireMap{}
}
func (x wireMap) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireMap)(nil)).Elem()); err != nil {
return err
}
if x.Name != "" {
if err := enc.NextField("Name"); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x.Name); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if x.Key != 0 {
if err := enc.NextField("Key"); err != nil {
return err
}
if err := x.Key.VDLWrite(enc); err != nil {
return err
}
}
if x.Elem != 0 {
if err := enc.NextField("Elem"); err != nil {
return err
}
if err := x.Elem.VDLWrite(enc); err != nil {
return err
}
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x *wireMap) VDLRead(dec vdl.Decoder) error {
*x = wireMap{}
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible struct %T, from %v", *x, dec.Type())
}
for {
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "":
return dec.FinishValue()
case "Name":
if err := dec.StartValue(); err != nil {
return err
}
var err error
if x.Name, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
case "Key":
if err := x.Key.VDLRead(dec); err != nil {
return err
}
case "Elem":
if err := x.Elem.VDLRead(dec); err != nil {
return err
}
default:
if err := dec.SkipValue(); err != nil {
return err
}
}
}
}
// wireField represents a field in a struct or union type.
type wireField struct {
Name string
Type TypeId
}
func (wireField) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.wireField"`
}) {
}
func (x wireField) VDLIsZero() bool {
return x == wireField{}
}
func (x wireField) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireField)(nil)).Elem()); err != nil {
return err
}
if x.Name != "" {
if err := enc.NextField("Name"); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x.Name); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if x.Type != 0 {
if err := enc.NextField("Type"); err != nil {
return err
}
if err := x.Type.VDLWrite(enc); err != nil {
return err
}
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x *wireField) VDLRead(dec vdl.Decoder) error {
*x = wireField{}
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible struct %T, from %v", *x, dec.Type())
}
for {
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "":
return dec.FinishValue()
case "Name":
if err := dec.StartValue(); err != nil {
return err
}
var err error
if x.Name, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
case "Type":
if err := x.Type.VDLRead(dec); err != nil {
return err
}
default:
if err := dec.SkipValue(); err != nil {
return err
}
}
}
}
// wireStruct represents a type definition for struct types.
type wireStruct struct {
Name string
Fields []wireField
}
func (wireStruct) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.wireStruct"`
}) {
}
func (x wireStruct) VDLIsZero() bool {
if x.Name != "" {
return false
}
if len(x.Fields) != 0 {
return false
}
return true
}
func (x wireStruct) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireStruct)(nil)).Elem()); err != nil {
return err
}
if x.Name != "" {
if err := enc.NextField("Name"); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x.Name); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if len(x.Fields) != 0 {
if err := enc.NextField("Fields"); err != nil {
return err
}
if err := __VDLWriteAnon_list_2(enc, x.Fields); err != nil {
return err
}
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func __VDLWriteAnon_list_2(enc vdl.Encoder, x []wireField) error {
if err := enc.StartValue(vdl.TypeOf((*[]wireField)(nil))); err != nil {
return err
}
if err := enc.SetLenHint(len(x)); err != nil {
return err
}
for i := 0; i < len(x); i++ {
if err := enc.NextEntry(false); err != nil {
return err
}
if err := x[i].VDLWrite(enc); err != nil {
return err
}
}
if err := enc.NextEntry(true); err != nil {
return err
}
return enc.FinishValue()
}
func (x *wireStruct) VDLRead(dec vdl.Decoder) error {
*x = wireStruct{}
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible struct %T, from %v", *x, dec.Type())
}
for {
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "":
return dec.FinishValue()
case "Name":
if err := dec.StartValue(); err != nil {
return err
}
var err error
if x.Name, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
case "Fields":
if err := __VDLReadAnon_list_2(dec, &x.Fields); err != nil {
return err
}
default:
if err := dec.SkipValue(); err != nil {
return err
}
}
}
}
func __VDLReadAnon_list_2(dec vdl.Decoder, x *[]wireField) error {
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible list %T, from %v", *x, dec.Type())
}
switch len := dec.LenHint(); {
case len > 0:
*x = make([]wireField, 0, len)
default:
*x = nil
}
for {
switch done, err := dec.NextEntry(); {
case err != nil:
return err
case done:
return dec.FinishValue()
}
var elem wireField
if err := elem.VDLRead(dec); err != nil {
return err
}
*x = append(*x, elem)
}
}
// wireUnion represents a type definition for union types.
type wireUnion struct {
Name string
Fields []wireField
}
func (wireUnion) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.wireUnion"`
}) {
}
func (x wireUnion) VDLIsZero() bool {
if x.Name != "" {
return false
}
if len(x.Fields) != 0 {
return false
}
return true
}
func (x wireUnion) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireUnion)(nil)).Elem()); err != nil {
return err
}
if x.Name != "" {
if err := enc.NextField("Name"); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x.Name); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if len(x.Fields) != 0 {
if err := enc.NextField("Fields"); err != nil {
return err
}
if err := __VDLWriteAnon_list_2(enc, x.Fields); err != nil {
return err
}
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x *wireUnion) VDLRead(dec vdl.Decoder) error {
*x = wireUnion{}
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible struct %T, from %v", *x, dec.Type())
}
for {
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "":
return dec.FinishValue()
case "Name":
if err := dec.StartValue(); err != nil {
return err
}
var err error
if x.Name, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
case "Fields":
if err := __VDLReadAnon_list_2(dec, &x.Fields); err != nil {
return err
}
default:
if err := dec.SkipValue(); err != nil {
return err
}
}
}
}
// wireOptional represents an type definition for optional types.
type wireOptional struct {
Name string
Elem TypeId
}
func (wireOptional) __VDLReflect(struct {
Name string `vdl:"v.io/v23/vom.wireOptional"`
}) {
}
func (x wireOptional) VDLIsZero() bool {
return x == wireOptional{}
}
func (x wireOptional) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireOptional)(nil)).Elem()); err != nil {
return err
}
if x.Name != "" {
if err := enc.NextField("Name"); err != nil {
return err
}
if err := enc.StartValue(vdl.StringType); err != nil {
return err
}
if err := enc.EncodeString(x.Name); err != nil {
return err
}
if err := enc.FinishValue(); err != nil {
return err
}
}
if x.Elem != 0 {
if err := enc.NextField("Elem"); err != nil {
return err
}
if err := x.Elem.VDLWrite(enc); err != nil {
return err
}
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x *wireOptional) VDLRead(dec vdl.Decoder) error {
*x = wireOptional{}
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(*x), dec.Type()) {
return fmt.Errorf("incompatible struct %T, from %v", *x, dec.Type())
}
for {
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "":
return dec.FinishValue()
case "Name":
if err := dec.StartValue(); err != nil {
return err
}
var err error
if x.Name, err = dec.DecodeString(); err != nil {
return err
}
if err := dec.FinishValue(); err != nil {
return err
}
case "Elem":
if err := x.Elem.VDLRead(dec); err != nil {
return err
}
default:
if err := dec.SkipValue(); err != nil {
return err
}
}
}
}
type (
// wireType represents any single field of the wireType union type.
//
// The wireType union is used to encode the payload part of each type message,
// using the regular rules for encoding union values. But unlike our regular
// encoding, the type message for wireType itself (and its fields) are never
// encoded; we need to bootstrap the system. Thus unlike regular values, the
// ordering of fields within the wire* types cannot be changed.
wireType 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 wireType union type.
__VDLReflect(__wireTypeReflect)
VDLIsZero() bool
VDLWrite(vdl.Encoder) error
}
// wireTypeNamedT represents field NamedT of the wireType union type.
//
// FIELD INDICES MUST NOT BE CHANGED.
wireTypeNamedT struct{ Value wireNamed } // INDEX = 0
// wireTypeEnumT represents field EnumT of the wireType union type.
wireTypeEnumT struct{ Value wireEnum } // INDEX = 1
// wireTypeArrayT represents field ArrayT of the wireType union type.
wireTypeArrayT struct{ Value wireArray } // INDEX = 2
// wireTypeListT represents field ListT of the wireType union type.
wireTypeListT struct{ Value wireList } // INDEX = 3
// wireTypeSetT represents field SetT of the wireType union type.
wireTypeSetT struct{ Value wireSet } // INDEX = 4
// wireTypeMapT represents field MapT of the wireType union type.
wireTypeMapT struct{ Value wireMap } // INDEX = 5
// wireTypeStructT represents field StructT of the wireType union type.
wireTypeStructT struct{ Value wireStruct } // INDEX = 6
// wireTypeUnionT represents field UnionT of the wireType union type.
wireTypeUnionT struct{ Value wireUnion } // INDEX = 7
// wireTypeOptionalT represents field OptionalT of the wireType union type.
wireTypeOptionalT struct{ Value wireOptional } // INDEX = 8
// __wireTypeReflect describes the wireType union type.
__wireTypeReflect struct {
Name string `vdl:"v.io/v23/vom.wireType"`
Type wireType
Union struct {
NamedT wireTypeNamedT
EnumT wireTypeEnumT
ArrayT wireTypeArrayT
ListT wireTypeListT
SetT wireTypeSetT
MapT wireTypeMapT
StructT wireTypeStructT
UnionT wireTypeUnionT
OptionalT wireTypeOptionalT
}
}
)
func (x wireTypeNamedT) Index() int { return 0 }
func (x wireTypeNamedT) Interface() interface{} { return x.Value }
func (x wireTypeNamedT) Name() string { return "NamedT" }
func (x wireTypeNamedT) __VDLReflect(__wireTypeReflect) {}
func (x wireTypeEnumT) Index() int { return 1 }
func (x wireTypeEnumT) Interface() interface{} { return x.Value }
func (x wireTypeEnumT) Name() string { return "EnumT" }
func (x wireTypeEnumT) __VDLReflect(__wireTypeReflect) {}
func (x wireTypeArrayT) Index() int { return 2 }
func (x wireTypeArrayT) Interface() interface{} { return x.Value }
func (x wireTypeArrayT) Name() string { return "ArrayT" }
func (x wireTypeArrayT) __VDLReflect(__wireTypeReflect) {}
func (x wireTypeListT) Index() int { return 3 }
func (x wireTypeListT) Interface() interface{} { return x.Value }
func (x wireTypeListT) Name() string { return "ListT" }
func (x wireTypeListT) __VDLReflect(__wireTypeReflect) {}
func (x wireTypeSetT) Index() int { return 4 }
func (x wireTypeSetT) Interface() interface{} { return x.Value }
func (x wireTypeSetT) Name() string { return "SetT" }
func (x wireTypeSetT) __VDLReflect(__wireTypeReflect) {}
func (x wireTypeMapT) Index() int { return 5 }
func (x wireTypeMapT) Interface() interface{} { return x.Value }
func (x wireTypeMapT) Name() string { return "MapT" }
func (x wireTypeMapT) __VDLReflect(__wireTypeReflect) {}
func (x wireTypeStructT) Index() int { return 6 }
func (x wireTypeStructT) Interface() interface{} { return x.Value }
func (x wireTypeStructT) Name() string { return "StructT" }
func (x wireTypeStructT) __VDLReflect(__wireTypeReflect) {}
func (x wireTypeUnionT) Index() int { return 7 }
func (x wireTypeUnionT) Interface() interface{} { return x.Value }
func (x wireTypeUnionT) Name() string { return "UnionT" }
func (x wireTypeUnionT) __VDLReflect(__wireTypeReflect) {}
func (x wireTypeOptionalT) Index() int { return 8 }
func (x wireTypeOptionalT) Interface() interface{} { return x.Value }
func (x wireTypeOptionalT) Name() string { return "OptionalT" }
func (x wireTypeOptionalT) __VDLReflect(__wireTypeReflect) {}
func (x wireTypeNamedT) VDLIsZero() bool {
return x.Value == wireNamed{}
}
func (x wireTypeEnumT) VDLIsZero() bool {
return false
}
func (x wireTypeArrayT) VDLIsZero() bool {
return false
}
func (x wireTypeListT) VDLIsZero() bool {
return false
}
func (x wireTypeSetT) VDLIsZero() bool {
return false
}
func (x wireTypeMapT) VDLIsZero() bool {
return false
}
func (x wireTypeStructT) VDLIsZero() bool {
return false
}
func (x wireTypeUnionT) VDLIsZero() bool {
return false
}
func (x wireTypeOptionalT) VDLIsZero() bool {
return false
}
func (x wireTypeNamedT) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireType)(nil))); err != nil {
return err
}
if err := enc.NextField("NamedT"); err != nil {
return err
}
if err := x.Value.VDLWrite(enc); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x wireTypeEnumT) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireType)(nil))); err != nil {
return err
}
if err := enc.NextField("EnumT"); err != nil {
return err
}
if err := x.Value.VDLWrite(enc); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x wireTypeArrayT) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireType)(nil))); err != nil {
return err
}
if err := enc.NextField("ArrayT"); err != nil {
return err
}
if err := x.Value.VDLWrite(enc); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x wireTypeListT) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireType)(nil))); err != nil {
return err
}
if err := enc.NextField("ListT"); err != nil {
return err
}
if err := x.Value.VDLWrite(enc); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x wireTypeSetT) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireType)(nil))); err != nil {
return err
}
if err := enc.NextField("SetT"); err != nil {
return err
}
if err := x.Value.VDLWrite(enc); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x wireTypeMapT) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireType)(nil))); err != nil {
return err
}
if err := enc.NextField("MapT"); err != nil {
return err
}
if err := x.Value.VDLWrite(enc); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x wireTypeStructT) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireType)(nil))); err != nil {
return err
}
if err := enc.NextField("StructT"); err != nil {
return err
}
if err := x.Value.VDLWrite(enc); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x wireTypeUnionT) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireType)(nil))); err != nil {
return err
}
if err := enc.NextField("UnionT"); err != nil {
return err
}
if err := x.Value.VDLWrite(enc); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func (x wireTypeOptionalT) VDLWrite(enc vdl.Encoder) error {
if err := enc.StartValue(vdl.TypeOf((*wireType)(nil))); err != nil {
return err
}
if err := enc.NextField("OptionalT"); err != nil {
return err
}
if err := x.Value.VDLWrite(enc); err != nil {
return err
}
if err := enc.NextField(""); err != nil {
return err
}
return enc.FinishValue()
}
func __VDLRead_wireType(dec vdl.Decoder, x *wireType) error {
if err := dec.StartValue(); err != nil {
return err
}
if (dec.StackDepth() == 1 || dec.IsAny()) && !vdl.Compatible(vdl.TypeOf(x), dec.Type()) {
return fmt.Errorf("incompatible union %T, from %v", x, dec.Type())
}
f, err := dec.NextField()
if err != nil {
return err
}
switch f {
case "NamedT":
var field wireTypeNamedT
if err := field.Value.VDLRead(dec); err != nil {
return err
}
*x = field
case "EnumT":
var field wireTypeEnumT
if err := field.Value.VDLRead(dec); err != nil {
return err
}
*x = field
case "ArrayT":
var field wireTypeArrayT
if err := field.Value.VDLRead(dec); err != nil {
return err
}
*x = field
case "ListT":
var field wireTypeListT
if err := field.Value.VDLRead(dec); err != nil {
return err
}
*x = field
case "SetT":
var field wireTypeSetT
if err := field.Value.VDLRead(dec); err != nil {
return err
}
*x = field
case "MapT":
var field wireTypeMapT
if err := field.Value.VDLRead(dec); err != nil {
return err
}
*x = field
case "StructT":
var field wireTypeStructT
if err := field.Value.VDLRead(dec); err != nil {
return err
}
*x = field
case "UnionT":
var field wireTypeUnionT
if err := field.Value.VDLRead(dec); err != nil {
return err
}
*x = field
case "OptionalT":
var field wireTypeOptionalT
if err := field.Value.VDLRead(dec); err != nil {
return err
}
*x = field
case "":
return fmt.Errorf("missing field in union %T, from %v", x, dec.Type())
default:
return fmt.Errorf("field %q not in union %T, from %v", f, x, dec.Type())
}
switch f, err := dec.NextField(); {
case err != nil:
return err
case f != "":
return fmt.Errorf("extra field %q in union %T, from %v", f, x, dec.Type())
}
return dec.FinishValue()
}
//////////////////////////////////////////////////
// Const definitions
const Version80 = Version(128)
const Version81 = Version(129)
const DefaultVersion = Version(129)
// Primitive types.
const WireIdBool = TypeId(1)
const WireIdByte = TypeId(2)
const WireIdString = TypeId(3)
const WireIdUint16 = TypeId(4)
const WireIdUint32 = TypeId(5)
const WireIdUint64 = TypeId(6)
const WireIdInt16 = TypeId(7)
const WireIdInt32 = TypeId(8)
const WireIdInt64 = TypeId(9)
const WireIdFloat32 = TypeId(10)
const WireIdFloat64 = TypeId(11)
// Wire ids 12 and 13 were previously used for complex64 and complex 128.
const WireIdTypeObject = TypeId(14)
const WireIdAny = TypeId(15)
const WireIdInt8 = TypeId(16)
// Other commonly used composites.
const WireIdByteList = TypeId(39)
const WireIdStringList = TypeId(40)
// The first user-defined TypeId is 41.
const WireIdFirstUserType = TypeId(41)
const WireCtrlNil = byte(224) // Nil in optional or any
const WireCtrlEnd = byte(225) // End of struct or union
const WireCtrlTypeIncomplete = byte(226) // Marks that the type message is incomplete until future messages are received
var __VDLInitCalled bool
// __VDLInit performs vdl initialization. It is safe to call multiple times.
// If you have an init ordering issue, just insert the following line verbatim
// into your source files in this package, right after the "package foo" clause:
//
// var _ = __VDLInit()
//
// The purpose of this function is to ensure that vdl initialization occurs in
// the right order, and very early in the init sequence. In particular, vdl
// registration and package variable initialization needs to occur before
// functions like vdl.TypeOf will work properly.
//
// This function returns a dummy value, so that it can be used to initialize the
// first var in the file, to take advantage of Go's defined init order.
func __VDLInit() struct{} {
if __VDLInitCalled {
return struct{}{}
}
__VDLInitCalled = true
// Register types.
vdl.Register((*ControlKind)(nil))
vdl.Register((*Primitive)(nil))
vdl.Register((*DumpKind)(nil))
vdl.Register((*DumpAtom)(nil))
vdl.Register((*Version)(nil))
vdl.Register((*TypeId)(nil))
vdl.Register((*wireNamed)(nil))
vdl.Register((*wireEnum)(nil))
vdl.Register((*wireArray)(nil))
vdl.Register((*wireList)(nil))
vdl.Register((*wireSet)(nil))
vdl.Register((*wireMap)(nil))
vdl.Register((*wireField)(nil))
vdl.Register((*wireStruct)(nil))
vdl.Register((*wireUnion)(nil))
vdl.Register((*wireOptional)(nil))
vdl.Register((*wireType)(nil))
return struct{}{}
}