19 #ifndef avro_Serializer_hh__ 20 #define avro_Serializer_hh__ 23 #include <boost/noncopyable.hpp> 33 template<
class Writer>
50 writer_.writeValue(
Null());
53 void writeBool(
bool val) {
54 writer_.writeValue(val);
57 void writeInt(int32_t val) {
58 writer_.writeValue(val);
61 void writeLong(int64_t val) {
62 writer_.writeValue(val);
65 void writeFloat(
float val) {
66 writer_.writeValue(val);
69 void writeDouble(
double val) {
70 writer_.writeValue(val);
73 void writeBytes(
const void *val,
size_t size) {
74 writer_.writeBytes(val);
78 void writeFixed(
const uint8_t (&val)[N]) {
79 writer_.writeFixed(val);
83 void writeFixed(
const std::array<uint8_t, N> &val) {
84 writer_.writeFixed(val);
87 void writeString(
const std::string &val) {
88 writer_.writeValue(val);
92 writer_.writeRecord();
95 void writeRecordEnd() {
96 writer_.writeRecordEnd();
99 void writeArrayBlock(int64_t size) {
100 writer_.writeArrayBlock(size);
103 void writeArrayEnd() {
104 writer_.writeArrayEnd();
107 void writeMapBlock(int64_t size) {
108 writer_.writeMapBlock(size);
112 writer_.writeMapEnd();
115 void writeUnion(int64_t choice) {
116 writer_.writeUnion(choice);
119 void writeEnum(int64_t choice) {
120 writer_.writeEnum(choice);
123 InputBuffer buffer()
const {
124 return writer_.buffer();
A bunch of templates and specializations for encoding and decoding specific types.
Definition: AvroParse.hh:30
define a type to identify Null in template functions
Definition: Types.hh:102
Serializer(const ValidSchema &schema)
Constructor only works with ValidatingWriter.
Definition: Serializer.hh:45
A ValidSchema is basically a non-mutable Schema that has passed some minumum of sanity checks...
Definition: ValidSchema.hh:40
Class that wraps a Writer or ValidatingWriter with an interface that uses explicit write* names inste...
Definition: Serializer.hh:34
Serializer()
Constructor only works with Writer.
Definition: Serializer.hh:40