...

Source file src/github.com/gogo/protobuf/test/cachedsize/cachedsize.pb.go

Documentation: github.com/gogo/protobuf/test/cachedsize

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: cachedsize.proto
     3  
     4  package cachedsize
     5  
     6  import (
     7  	bytes "bytes"
     8  	fmt "fmt"
     9  	_ "github.com/gogo/protobuf/gogoproto"
    10  	proto "github.com/gogo/protobuf/proto"
    11  	math "math"
    12  	math_bits "math/bits"
    13  )
    14  
    15  // Reference imports to suppress errors if they are not otherwise used.
    16  var _ = proto.Marshal
    17  var _ = fmt.Errorf
    18  var _ = math.Inf
    19  
    20  // This is a compile-time assertion to ensure that this generated file
    21  // is compatible with the proto package it is being compiled against.
    22  // A compilation error at this line likely means your copy of the
    23  // proto package needs to be updated.
    24  const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
    25  
    26  type Foo struct {
    27  	Field1               *Bar     `protobuf:"bytes,1,opt,name=field1" json:"field1,omitempty"`
    28  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
    29  	XXX_unrecognized     []byte   `json:"-"`
    30  	XXX_sizecache        int32    `json:"-"`
    31  }
    32  
    33  func (m *Foo) Reset()         { *m = Foo{} }
    34  func (m *Foo) String() string { return proto.CompactTextString(m) }
    35  func (*Foo) ProtoMessage()    {}
    36  func (*Foo) Descriptor() ([]byte, []int) {
    37  	return fileDescriptor_dd0d29d364e4fbd8, []int{0}
    38  }
    39  func (m *Foo) XXX_Unmarshal(b []byte) error {
    40  	return xxx_messageInfo_Foo.Unmarshal(m, b)
    41  }
    42  func (m *Foo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    43  	return xxx_messageInfo_Foo.Marshal(b, m, deterministic)
    44  }
    45  func (m *Foo) XXX_Merge(src proto.Message) {
    46  	xxx_messageInfo_Foo.Merge(m, src)
    47  }
    48  func (m *Foo) XXX_Size() int {
    49  	return xxx_messageInfo_Foo.Size(m)
    50  }
    51  func (m *Foo) XXX_DiscardUnknown() {
    52  	xxx_messageInfo_Foo.DiscardUnknown(m)
    53  }
    54  
    55  var xxx_messageInfo_Foo proto.InternalMessageInfo
    56  
    57  func (m *Foo) GetField1() *Bar {
    58  	if m != nil {
    59  		return m.Field1
    60  	}
    61  	return nil
    62  }
    63  
    64  type Bar struct {
    65  	Field2               bool     `protobuf:"varint,1,opt,name=field2" json:"field2"`
    66  	XXX_NoUnkeyedLiteral struct{} `json:"-"`
    67  	XXX_unrecognized     []byte   `json:"-"`
    68  	XXX_sizecache        int32    `json:"-"`
    69  }
    70  
    71  func (m *Bar) Reset()         { *m = Bar{} }
    72  func (m *Bar) String() string { return proto.CompactTextString(m) }
    73  func (*Bar) ProtoMessage()    {}
    74  func (*Bar) Descriptor() ([]byte, []int) {
    75  	return fileDescriptor_dd0d29d364e4fbd8, []int{1}
    76  }
    77  func (m *Bar) XXX_Unmarshal(b []byte) error {
    78  	return xxx_messageInfo_Bar.Unmarshal(m, b)
    79  }
    80  func (m *Bar) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    81  	return xxx_messageInfo_Bar.Marshal(b, m, deterministic)
    82  }
    83  func (m *Bar) XXX_Merge(src proto.Message) {
    84  	xxx_messageInfo_Bar.Merge(m, src)
    85  }
    86  func (m *Bar) XXX_Size() int {
    87  	return xxx_messageInfo_Bar.Size(m)
    88  }
    89  func (m *Bar) XXX_DiscardUnknown() {
    90  	xxx_messageInfo_Bar.DiscardUnknown(m)
    91  }
    92  
    93  var xxx_messageInfo_Bar proto.InternalMessageInfo
    94  
    95  func (m *Bar) GetField2() bool {
    96  	if m != nil {
    97  		return m.Field2
    98  	}
    99  	return false
   100  }
   101  
   102  func init() {
   103  	proto.RegisterType((*Foo)(nil), "cachedsize.Foo")
   104  	proto.RegisterType((*Bar)(nil), "cachedsize.Bar")
   105  }
   106  
   107  func init() { proto.RegisterFile("cachedsize.proto", fileDescriptor_dd0d29d364e4fbd8) }
   108  
   109  var fileDescriptor_dd0d29d364e4fbd8 = []byte{
   110  	// 162 bytes of a gzipped FileDescriptorProto
   111  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x48, 0x4e, 0x4c, 0xce,
   112  	0x48, 0x4d, 0x29, 0xce, 0xac, 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0x88,
   113  	0x48, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7,
   114  	0xe7, 0xeb, 0x83, 0x95, 0x24, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0xd1, 0xaa, 0xa4,
   115  	0xc7, 0xc5, 0xec, 0x96, 0x9f, 0x2f, 0xa4, 0xce, 0xc5, 0x96, 0x96, 0x99, 0x9a, 0x93, 0x62, 0x28,
   116  	0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0xc4, 0xaf, 0x87, 0x64, 0x89, 0x53, 0x62, 0x51, 0x10, 0x54,
   117  	0x5a, 0x49, 0x99, 0x8b, 0xd9, 0x29, 0xb1, 0x48, 0x48, 0x06, 0xaa, 0xde, 0x08, 0xac, 0x9e, 0xc3,
   118  	0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x06, 0xa8, 0x22, 0x23, 0x27, 0x89, 0x07, 0x0f, 0xe5, 0x18, 0x57,
   119  	0x3c, 0x92, 0x63, 0x3c, 0xf1, 0x48, 0x8e, 0xe1, 0xc2, 0x23, 0x39, 0x86, 0x07, 0x8f, 0xe4, 0x18,
   120  	0x3f, 0x3c, 0x92, 0x63, 0x04, 0x04, 0x00, 0x00, 0xff, 0xff, 0x95, 0xd6, 0x7b, 0xf2, 0xbc, 0x00,
   121  	0x00, 0x00,
   122  }
   123  
   124  func (this *Foo) VerboseEqual(that interface{}) error {
   125  	if that == nil {
   126  		if this == nil {
   127  			return nil
   128  		}
   129  		return fmt.Errorf("that == nil && this != nil")
   130  	}
   131  
   132  	that1, ok := that.(*Foo)
   133  	if !ok {
   134  		that2, ok := that.(Foo)
   135  		if ok {
   136  			that1 = &that2
   137  		} else {
   138  			return fmt.Errorf("that is not of type *Foo")
   139  		}
   140  	}
   141  	if that1 == nil {
   142  		if this == nil {
   143  			return nil
   144  		}
   145  		return fmt.Errorf("that is type *Foo but is nil && this != nil")
   146  	} else if this == nil {
   147  		return fmt.Errorf("that is type *Foo but is not nil && this == nil")
   148  	}
   149  	if !this.Field1.Equal(that1.Field1) {
   150  		return fmt.Errorf("Field1 this(%v) Not Equal that(%v)", this.Field1, that1.Field1)
   151  	}
   152  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   153  		return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
   154  	}
   155  	return nil
   156  }
   157  func (this *Foo) Equal(that interface{}) bool {
   158  	if that == nil {
   159  		return this == nil
   160  	}
   161  
   162  	that1, ok := that.(*Foo)
   163  	if !ok {
   164  		that2, ok := that.(Foo)
   165  		if ok {
   166  			that1 = &that2
   167  		} else {
   168  			return false
   169  		}
   170  	}
   171  	if that1 == nil {
   172  		return this == nil
   173  	} else if this == nil {
   174  		return false
   175  	}
   176  	if !this.Field1.Equal(that1.Field1) {
   177  		return false
   178  	}
   179  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   180  		return false
   181  	}
   182  	return true
   183  }
   184  func (this *Bar) VerboseEqual(that interface{}) error {
   185  	if that == nil {
   186  		if this == nil {
   187  			return nil
   188  		}
   189  		return fmt.Errorf("that == nil && this != nil")
   190  	}
   191  
   192  	that1, ok := that.(*Bar)
   193  	if !ok {
   194  		that2, ok := that.(Bar)
   195  		if ok {
   196  			that1 = &that2
   197  		} else {
   198  			return fmt.Errorf("that is not of type *Bar")
   199  		}
   200  	}
   201  	if that1 == nil {
   202  		if this == nil {
   203  			return nil
   204  		}
   205  		return fmt.Errorf("that is type *Bar but is nil && this != nil")
   206  	} else if this == nil {
   207  		return fmt.Errorf("that is type *Bar but is not nil && this == nil")
   208  	}
   209  	if this.Field2 != that1.Field2 {
   210  		return fmt.Errorf("Field2 this(%v) Not Equal that(%v)", this.Field2, that1.Field2)
   211  	}
   212  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   213  		return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
   214  	}
   215  	return nil
   216  }
   217  func (this *Bar) Equal(that interface{}) bool {
   218  	if that == nil {
   219  		return this == nil
   220  	}
   221  
   222  	that1, ok := that.(*Bar)
   223  	if !ok {
   224  		that2, ok := that.(Bar)
   225  		if ok {
   226  			that1 = &that2
   227  		} else {
   228  			return false
   229  		}
   230  	}
   231  	if that1 == nil {
   232  		return this == nil
   233  	} else if this == nil {
   234  		return false
   235  	}
   236  	if this.Field2 != that1.Field2 {
   237  		return false
   238  	}
   239  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   240  		return false
   241  	}
   242  	return true
   243  }
   244  func (m *Foo) Size() (n int) {
   245  	if m == nil {
   246  		return 0
   247  	}
   248  	var l int
   249  	_ = l
   250  	if m.Field1 != nil {
   251  		l = m.Field1.Size()
   252  		n += 1 + l + sovCachedsize(uint64(l))
   253  	}
   254  	if m.XXX_unrecognized != nil {
   255  		n += len(m.XXX_unrecognized)
   256  	}
   257  	return n
   258  }
   259  
   260  func (m *Bar) Size() (n int) {
   261  	if m == nil {
   262  		return 0
   263  	}
   264  	var l int
   265  	_ = l
   266  	n += 2
   267  	if m.XXX_unrecognized != nil {
   268  		n += len(m.XXX_unrecognized)
   269  	}
   270  	return n
   271  }
   272  
   273  func sovCachedsize(x uint64) (n int) {
   274  	return (math_bits.Len64(x|1) + 6) / 7
   275  }
   276  func sozCachedsize(x uint64) (n int) {
   277  	return sovCachedsize(uint64((x << 1) ^ uint64((int64(x) >> 63))))
   278  }
   279  

View as plain text