19 #ifndef avro_Decoder_hh__
20 #define avro_Decoder_hh__
29 #include "ValidSchema.hh"
91 std::vector<uint8_t> result;
110 std::vector<uint8_t> result;
111 decodeFixed(n, result);
121 virtual void decodeFixed(
size_t n, std::vector<uint8_t> &value) = 0;
Decoder is an interface implemented by every decoder capable of decoding Avro data.
Definition: Decoder.hh:48
virtual size_t mapNext()=0
Returns the number of entries in next chunk. 0 if last.
virtual void skipFixed(size_t n)=0
Skips fixed length binary on the current stream.
virtual void decodeFixed(size_t n, std::vector< uint8_t > &value)=0
Decodes a fixed from the current stream.
virtual void decodeNull()=0
Decodes a null from the current stream.
virtual int32_t decodeInt()=0
Decodes a 32-bit int from the current stream.
virtual size_t arrayNext()=0
Returns the number of entries in next chunk. 0 if last.
virtual void init(InputStream &is)=0
All future decoding will come from is, which should be valid until replaced by another call to init()...
virtual void skipBytes()=0
Skips bytes on the current stream.
std::vector< uint8_t > decodeBytes()
Decodes arbitrary binary data from the current stream.
Definition: Decoder.hh:90
virtual size_t mapStart()=0
Start decoding a map. Returns the number of entries in first chunk.
virtual size_t decodeUnionIndex()=0
Decodes a branch of a union. The actual value is to follow.
virtual size_t arrayStart()=0
Start decoding an array. Returns the number of entries in first chunk.
virtual bool decodeBool()=0
Decodes a bool from the current stream.
virtual float decodeFloat()=0
Decodes a single-precision floating point number from current stream.
virtual size_t skipMap()=0
Tries to skip a map.
virtual void decodeBytes(std::vector< uint8_t > &value)=0
Decodes arbitrary binary data from the current stream and puts it in value.
virtual size_t decodeEnum()=0
Decodes enum from the current stream.
virtual size_t skipArray()=0
Tries to skip an array.
virtual int64_t decodeLong()=0
Decodes a 64-bit signed int from the current stream.
virtual void decodeString(std::string &value)=0
Decodes a UTF-8 string from the stream and assigns it to value.
virtual void skipString()=0
Skips a string on the current stream.
std::vector< uint8_t > decodeFixed(size_t n)
Decodes fixed length binary from the current stream.
Definition: Decoder.hh:109
virtual double decodeDouble()=0
Decodes a double-precision floating point number from current stream.
virtual void drain()=0
Drains any additional data at the end of the current entry in a stream.
std::string decodeString()
Decodes a UTF-8 string from the current stream.
Definition: Decoder.hh:75
ResolvingDecoder is derived from Decoder, with an additional function to obtain the field ordering of...
Definition: Decoder.hh:183
virtual const std::vector< size_t > & fieldOrder()=0
Returns the order of fields for records.
A ValidSchema is basically a non-mutable Schema that has passed some minimum of sanity checks.
Definition: ValidSchema.hh:40
A bunch of templates and specializations for encoding and decoding specific types.
Definition: AvroParse.hh:30
AVRO_DECL DecoderPtr binaryDecoder()
Returns an decoder that can decode binary Avro standard.
std::shared_ptr< Decoder > DecoderPtr
Shared pointer to Decoder.
Definition: Decoder.hh:177
AVRO_DECL DecoderPtr jsonDecoder(const ValidSchema &schema)
Returns an decoder that can decode Avro standard for JSON.
AVRO_DECL DecoderPtr validatingDecoder(const ValidSchema &schema, const DecoderPtr &base)
Returns an decoder that validates sequence of calls to an underlying Decoder against the given schema...
std::shared_ptr< ResolvingDecoder > ResolvingDecoderPtr
Shared pointer to ResolvingDecoder.
Definition: Decoder.hh:196
AVRO_DECL ResolvingDecoderPtr resolvingDecoder(const ValidSchema &writer, const ValidSchema &reader, const DecoderPtr &base)
Returns a decoder that decodes avro data from base written according to writerSchema and resolves aga...