19 #ifndef avro_Encoder_hh__ 20 #define avro_Encoder_hh__ 28 #include "ValidSchema.hh" 61 virtual void flush() = 0;
65 virtual int64_t byteCount()
const = 0;
68 virtual void encodeNull() = 0;
71 virtual void encodeBool(
bool b) = 0;
74 virtual void encodeInt(int32_t i) = 0;
77 virtual void encodeLong(int64_t l) = 0;
80 virtual void encodeFloat(
float f) = 0;
83 virtual void encodeDouble(
double d) = 0;
86 virtual void encodeString(
const std::string& s) = 0;
94 virtual void encodeBytes(
const uint8_t *bytes,
size_t len) = 0;
103 encodeBytes(bytes.empty() ? &b : bytes.data(), bytes.size());
107 virtual void encodeFixed(
const uint8_t *bytes,
size_t len) = 0;
115 encodeFixed(bytes.data(), bytes.size());
119 virtual void encodeEnum(
size_t e) = 0;
122 virtual void arrayStart() = 0;
125 virtual void arrayEnd() = 0;
128 virtual void mapStart() = 0;
131 virtual void mapEnd() = 0;
135 virtual void setItemCount(
size_t count) = 0;
138 virtual void startItem() = 0;
141 virtual void encodeUnionIndex(
size_t e) = 0;
159 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:114
void encodeBytes(const std::vector< uint8_t > &bytes)
Encodes aribtray binary data into tthe current stream as Avro "bytes" data type.
Definition: Encoder.hh:101
A bunch of templates and specializations for encoding and decoding specific types.
Definition: AvroParse.hh:30
AVRO_DECL EncoderPtr jsonEncoder(const ValidSchema &schema)
Returns an encoder that encodes Avro standard for JSON.
std::shared_ptr< Encoder > EncoderPtr
Shared pointer to Encoder.
Definition: Encoder.hh:147
A no-copy output stream.
Definition: Stream.hh:110
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...
AVRO_DECL EncoderPtr binaryEncoder()
Returns an encoder that can encode binary Avro standard.
The abstract base class for all Avro encoders.
Definition: Encoder.hh:52