19 #ifndef avro_Encoder_hh__
20 #define avro_Encoder_hh__
27 #include "ValidSchema.hh"
30 #include <boost/shared_ptr.hpp>
62 virtual void flush() = 0;
65 virtual void encodeNull() = 0;
68 virtual void encodeBool(
bool b) = 0;
71 virtual void encodeInt(int32_t i) = 0;
74 virtual void encodeLong(int64_t l) = 0;
77 virtual void encodeFloat(
float f) = 0;
80 virtual void encodeDouble(
double d) = 0;
83 virtual void encodeString(
const std::string& s) = 0;
91 virtual void encodeBytes(
const uint8_t *bytes,
size_t len) = 0;
100 encodeBytes(bytes.empty() ? &b : &bytes[0], bytes.size());
104 virtual void encodeFixed(
const uint8_t *bytes,
size_t len) = 0;
112 encodeFixed(&bytes[0], bytes.size());
116 virtual void encodeEnum(
size_t e) = 0;
119 virtual void arrayStart() = 0;
122 virtual void arrayEnd() = 0;
125 virtual void mapStart() = 0;
128 virtual void mapEnd() = 0;
132 virtual void setItemCount(
size_t count) = 0;
135 virtual void startItem() = 0;
138 virtual void encodeUnionIndex(
size_t e) = 0;
156 const EncoderPtr& base);
AVRO_DECL EncoderPtr jsonPrettyEncoder(const ValidSchema &schema)
Returns an encoder that encodes Avro standard for pretty printed JSON.
void encodeFixed(const std::vector< uint8_t > &bytes)
Encodes an Avro data type Fixed.
Definition: Encoder.hh:111
void encodeBytes(const std::vector< uint8_t > &bytes)
Encodes aribtray binary data into tthe current stream as Avro "bytes" data type.
Definition: Encoder.hh:98
A bunch of templates and specializations for encoding and decoding specific types.
Definition: AvroParse.hh:31
AVRO_DECL EncoderPtr jsonEncoder(const ValidSchema &schema)
Returns an encoder that encodes Avro standard for JSON.
A no-copy output stream.
Definition: Stream.hh:81
A ValidSchema is basically a non-mutable Schema that has passed some minumum of sanity checks...
Definition: ValidSchema.hh:40
AVRO_DECL EncoderPtr validatingEncoder(const ValidSchema &schema, const EncoderPtr &base)
Returns an encoder that validates sequence of calls to an underlying Encoder against the given schema...
boost::shared_ptr< Encoder > EncoderPtr
Shared pointer to Encoder.
Definition: Encoder.hh:144
AVRO_DECL EncoderPtr binaryEncoder()
Returns an encoder that can encode binary Avro standard.
The abstract base class for all Avro encoders.
Definition: Encoder.hh:53