Public Member Functions

avro::Encoder Class Reference

The abstract base class for all Avro encoders. More...

#include <Encoder.hh>

List of all members.

Public Member Functions

virtual void init (OutputStream &os)=0
 All future encodings will go to os, which should be valid until it is reset with another call to init() or the encoder is destructed.
virtual void flush ()=0
 Flushes any data in internal buffers.
virtual void encodeNull ()=0
 Encodes a null to the current stream.
virtual void encodeBool (bool b)=0
 Encodes a bool to the current stream.
virtual void encodeInt (int32_t i)=0
 Encodes a 32-bit int to the current stream.
virtual void encodeLong (int64_t l)=0
 Encodes a 64-bit signed int to the current stream.
virtual void encodeFloat (float f)=0
 Encodes a single-precision floating point number to the current stream.
virtual void encodeDouble (double d)=0
 Encodes a double-precision floating point number to the current stream.
virtual void encodeString (const std::string &s)=0
 Encodes a UTF-8 string to the current stream.
virtual void encodeBytes (const uint8_t *bytes, size_t len)=0
 Encodes aribtray binary data into tthe current stream as Avro "bytes" data type.
void encodeBytes (const std::vector< uint8_t > &bytes)
 Encodes aribtray binary data into tthe current stream as Avro "bytes" data type.
virtual void encodeFixed (const uint8_t *bytes, size_t len)=0
 Encodes fixed length binary to the current stream.
void encodeFixed (const std::vector< uint8_t > &bytes)
 Encodes an Avro data type Fixed.
virtual void encodeEnum (size_t e)=0
 Encodes enum to the current stream.
virtual void arrayStart ()=0
 Indicates that an array of items is being encoded.
virtual void arrayEnd ()=0
 Indicates that the current array of items have ended.
virtual void mapStart ()=0
 Indicates that a map of items is being encoded.
virtual void mapEnd ()=0
 Indicates that the current map of items have ended.
virtual void setItemCount (size_t count)=0
 Indicates that count number of items are to follow in the current array or map.
virtual void startItem ()=0
 Marks a beginning of an item in the current array or map.
virtual void encodeUnionIndex (size_t e)=0
 Encodes a branch of a union. The actual value is to follow.

Detailed Description

The abstract base class for all Avro encoders.

The implementations differ in the method of encoding (binary vresus JSON) or in capabilities such as ability to verify the order of invocation of different functions.


Member Function Documentation

virtual void avro::Encoder::encodeBytes ( const uint8_t *  bytes,
size_t  len 
) [pure virtual]

Encodes aribtray binary data into tthe current stream as Avro "bytes" data type.

Parameters:
bytes Where the data is
len Number of bytes at bytes.

Referenced by avro::codec_traits< std::vector< uint8_t > >::encode().

void avro::Encoder::encodeBytes ( const std::vector< uint8_t > &  bytes  )  [inline]

Encodes aribtray binary data into tthe current stream as Avro "bytes" data type.

Parameters:
bytes The data.
void avro::Encoder::encodeFixed ( const std::vector< uint8_t > &  bytes  )  [inline]

Encodes an Avro data type Fixed.

Parameters:
bytes The fixed, the length of which is taken as the size of fixed.
virtual void avro::Encoder::init ( OutputStream os  )  [pure virtual]

All future encodings will go to os, which should be valid until it is reset with another call to init() or the encoder is destructed.

virtual void avro::Encoder::setItemCount ( size_t  count  )  [pure virtual]

Indicates that count number of items are to follow in the current array or map.

Referenced by avro::codec_traits< std::map< std::string, T > >::encode(), and avro::codec_traits< std::vector< T > >::encode().


The documentation for this class was generated from the following file: