github.com/annchain/OG@v0.0.9/og/archive/raw_tx_gen.go (about)

     1  package archive
     2  
     3  // Code generated by github.com/tinylib/msgp DO NOT EDIT.
     4  
     5  import (
     6  	"github.com/tinylib/msgp/msgp"
     7  )
     8  
     9  // DecodeMsg implements msgp.Decodable
    10  func (z *RawArchive) DecodeMsg(dc *msgp.Reader) (err error) {
    11  	var zb0001 uint32
    12  	zb0001, err = dc.ReadArrayHeader()
    13  	if err != nil {
    14  		err = msgp.WrapError(err)
    15  		return
    16  	}
    17  	if zb0001 != 1 {
    18  		err = msgp.ArrayError{Wanted: 1, Got: zb0001}
    19  		return
    20  	}
    21  	err = z.Archive.DecodeMsg(dc)
    22  	if err != nil {
    23  		err = msgp.WrapError(err, "Archive")
    24  		return
    25  	}
    26  	return
    27  }
    28  
    29  // EncodeMsg implements msgp.Encodable
    30  func (z *RawArchive) EncodeMsg(en *msgp.Writer) (err error) {
    31  	// array header, size 1
    32  	err = en.Append(0x91)
    33  	if err != nil {
    34  		return
    35  	}
    36  	err = z.Archive.EncodeMsg(en)
    37  	if err != nil {
    38  		err = msgp.WrapError(err, "Archive")
    39  		return
    40  	}
    41  	return
    42  }
    43  
    44  // MarshalMsg implements msgp.Marshaler
    45  func (z *RawArchive) MarshalMsg(b []byte) (o []byte, err error) {
    46  	o = msgp.Require(b, z.Msgsize())
    47  	// array header, size 1
    48  	o = append(o, 0x91)
    49  	o, err = z.Archive.MarshalMsg(o)
    50  	if err != nil {
    51  		err = msgp.WrapError(err, "Archive")
    52  		return
    53  	}
    54  	return
    55  }
    56  
    57  // UnmarshalMsg implements msgp.Unmarshaler
    58  func (z *RawArchive) UnmarshalMsg(bts []byte) (o []byte, err error) {
    59  	var zb0001 uint32
    60  	zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
    61  	if err != nil {
    62  		err = msgp.WrapError(err)
    63  		return
    64  	}
    65  	if zb0001 != 1 {
    66  		err = msgp.ArrayError{Wanted: 1, Got: zb0001}
    67  		return
    68  	}
    69  	bts, err = z.Archive.UnmarshalMsg(bts)
    70  	if err != nil {
    71  		err = msgp.WrapError(err, "Archive")
    72  		return
    73  	}
    74  	o = bts
    75  	return
    76  }
    77  
    78  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
    79  func (z *RawArchive) Msgsize() (s int) {
    80  	s = 1 + z.Archive.Msgsize()
    81  	return
    82  }
    83  
    84  // DecodeMsg implements msgp.Decodable
    85  func (z *RawArchives) DecodeMsg(dc *msgp.Reader) (err error) {
    86  	var zb0002 uint32
    87  	zb0002, err = dc.ReadArrayHeader()
    88  	if err != nil {
    89  		err = msgp.WrapError(err)
    90  		return
    91  	}
    92  	if cap((*z)) >= int(zb0002) {
    93  		(*z) = (*z)[:zb0002]
    94  	} else {
    95  		(*z) = make(RawArchives, zb0002)
    96  	}
    97  	for zb0001 := range *z {
    98  		if dc.IsNil() {
    99  			err = dc.ReadNil()
   100  			if err != nil {
   101  				err = msgp.WrapError(err, zb0001)
   102  				return
   103  			}
   104  			(*z)[zb0001] = nil
   105  		} else {
   106  			if (*z)[zb0001] == nil {
   107  				(*z)[zb0001] = new(RawArchive)
   108  			}
   109  			var zb0003 uint32
   110  			zb0003, err = dc.ReadArrayHeader()
   111  			if err != nil {
   112  				err = msgp.WrapError(err, zb0001)
   113  				return
   114  			}
   115  			if zb0003 != 1 {
   116  				err = msgp.ArrayError{Wanted: 1, Got: zb0003}
   117  				return
   118  			}
   119  			err = (*z)[zb0001].Archive.DecodeMsg(dc)
   120  			if err != nil {
   121  				err = msgp.WrapError(err, zb0001, "Archive")
   122  				return
   123  			}
   124  		}
   125  	}
   126  	return
   127  }
   128  
   129  // EncodeMsg implements msgp.Encodable
   130  func (z RawArchives) EncodeMsg(en *msgp.Writer) (err error) {
   131  	err = en.WriteArrayHeader(uint32(len(z)))
   132  	if err != nil {
   133  		err = msgp.WrapError(err)
   134  		return
   135  	}
   136  	for zb0004 := range z {
   137  		if z[zb0004] == nil {
   138  			err = en.WriteNil()
   139  			if err != nil {
   140  				return
   141  			}
   142  		} else {
   143  			// array header, size 1
   144  			err = en.Append(0x91)
   145  			if err != nil {
   146  				return
   147  			}
   148  			err = z[zb0004].Archive.EncodeMsg(en)
   149  			if err != nil {
   150  				err = msgp.WrapError(err, zb0004, "Archive")
   151  				return
   152  			}
   153  		}
   154  	}
   155  	return
   156  }
   157  
   158  // MarshalMsg implements msgp.Marshaler
   159  func (z RawArchives) MarshalMsg(b []byte) (o []byte, err error) {
   160  	o = msgp.Require(b, z.Msgsize())
   161  	o = msgp.AppendArrayHeader(o, uint32(len(z)))
   162  	for zb0004 := range z {
   163  		if z[zb0004] == nil {
   164  			o = msgp.AppendNil(o)
   165  		} else {
   166  			// array header, size 1
   167  			o = append(o, 0x91)
   168  			o, err = z[zb0004].Archive.MarshalMsg(o)
   169  			if err != nil {
   170  				err = msgp.WrapError(err, zb0004, "Archive")
   171  				return
   172  			}
   173  		}
   174  	}
   175  	return
   176  }
   177  
   178  // UnmarshalMsg implements msgp.Unmarshaler
   179  func (z *RawArchives) UnmarshalMsg(bts []byte) (o []byte, err error) {
   180  	var zb0002 uint32
   181  	zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
   182  	if err != nil {
   183  		err = msgp.WrapError(err)
   184  		return
   185  	}
   186  	if cap((*z)) >= int(zb0002) {
   187  		(*z) = (*z)[:zb0002]
   188  	} else {
   189  		(*z) = make(RawArchives, zb0002)
   190  	}
   191  	for zb0001 := range *z {
   192  		if msgp.IsNil(bts) {
   193  			bts, err = msgp.ReadNilBytes(bts)
   194  			if err != nil {
   195  				return
   196  			}
   197  			(*z)[zb0001] = nil
   198  		} else {
   199  			if (*z)[zb0001] == nil {
   200  				(*z)[zb0001] = new(RawArchive)
   201  			}
   202  			var zb0003 uint32
   203  			zb0003, bts, err = msgp.ReadArrayHeaderBytes(bts)
   204  			if err != nil {
   205  				err = msgp.WrapError(err, zb0001)
   206  				return
   207  			}
   208  			if zb0003 != 1 {
   209  				err = msgp.ArrayError{Wanted: 1, Got: zb0003}
   210  				return
   211  			}
   212  			bts, err = (*z)[zb0001].Archive.UnmarshalMsg(bts)
   213  			if err != nil {
   214  				err = msgp.WrapError(err, zb0001, "Archive")
   215  				return
   216  			}
   217  		}
   218  	}
   219  	o = bts
   220  	return
   221  }
   222  
   223  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   224  func (z RawArchives) Msgsize() (s int) {
   225  	s = msgp.ArrayHeaderSize
   226  	for zb0004 := range z {
   227  		if z[zb0004] == nil {
   228  			s += msgp.NilSize
   229  		} else {
   230  			s += 1 + z[zb0004].Archive.Msgsize()
   231  		}
   232  	}
   233  	return
   234  }