19 #ifndef avro_Serializer_hh__
20 #define avro_Serializer_hh__
22 #include <boost/noncopyable.hpp>
32 template<
class Writer>
49 writer_.writeValue(
Null());
52 void writeBool(
bool val) {
53 writer_.writeValue(val);
56 void writeInt(int32_t val) {
57 writer_.writeValue(val);
60 void writeLong(int64_t val) {
61 writer_.writeValue(val);
64 void writeFloat(
float val) {
65 writer_.writeValue(val);
68 void writeDouble(
double val) {
69 writer_.writeValue(val);
72 void writeBytes(
const void *val,
size_t size) {
73 writer_.writeBytes(val);
77 void writeFixed(
const uint8_t (&val)[N]) {
78 writer_.writeFixed(val);
82 void writeFixed(
const boost::array<uint8_t, N> &val) {
83 writer_.writeFixed(val);
86 void writeString(
const std::string &val) {
87 writer_.writeValue(val);
91 writer_.writeRecord();
94 void writeRecordEnd() {
95 writer_.writeRecordEnd();
98 void writeArrayBlock(int64_t size) {
99 writer_.writeArrayBlock(size);
102 void writeArrayEnd() {
103 writer_.writeArrayEnd();
106 void writeMapBlock(int64_t size) {
107 writer_.writeMapBlock(size);
111 writer_.writeMapEnd();
114 void writeUnion(int64_t choice) {
115 writer_.writeUnion(choice);
118 void writeEnum(int64_t choice) {
119 writer_.writeEnum(choice);
122 InputBuffer buffer()
const {
123 return writer_.buffer();
A bunch of templates and specializations for encoding and decoding specific types.
Definition: AvroParse.hh:31
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:44
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:33
Serializer()
Constructor only works with Writer.
Definition: Serializer.hh:39