netLink C++ 11
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Friends | List of all members
MsgPack::Element Class Referenceabstract

Abstract class to represent one element in a MsgPack stream. More...

#include <Element.h>

Inheritance diagram for MsgPack::Element:
MsgPack::Header MsgPack::Number MsgPack::Primitive MsgPack::ArrayHeader MsgPack::Data MsgPack::MapHeader MsgPack::Array MsgPack::Binary MsgPack::Extended MsgPack::String MsgPack::Map

Public Member Functions

virtual std::unique_ptr< Elementcopy () const =0
 Creates a deep copy of this element.
 
virtual void toJSON (std::ostream &stream) const =0
 Writes a human readable JSON-like string into the given stream.
 
virtual Type getType () const =0
 Returns the MsgPack::Type.
 
virtual uint32_t getSizeInBytes () const
 Returns the size in bytes this MsgPack::Element takes if completely serialized.
 

Protected Member Functions

virtual int64_t startSerialize ()
 Returns the initial serializer position in bytes (negative value if there is a header)
 
virtual int64_t startDeserialize (uint8_t firstByte)=0
 Reads in one byte and returns the initial deserializer position in bytes (negative value if there is a header)
 
virtual std::streamsize serialize (int64_t &pos, std::basic_streambuf< char > *streamBuffer, std::streamsize bytes)=0
 Serializes bytes at the given serializer position pos into streamBuffer.
 
virtual std::streamsize deserialize (int64_t &pos, std::basic_streambuf< char > *streamBuffer, std::streamsize bytes)
 Deserializes bytes at the given deserializer position pos from streamBuffer.
 
virtual bool containerDeserialized ()
 Returns true if the header of a container is deserialized and reserves the necessary space for its element vector.
 
virtual std::vector< std::unique_ptr< Element > > * getElementsVector ()
 Returns a raw pointer to the element vector of a container.
 
virtual int64_t getEndPos () const =0
 Returns the first invalid (de)serializer position.
 

Friends

class Serializer
 
class Deserializer
 

Detailed Description

Abstract class to represent one element in a MsgPack stream.

Member Function Documentation

◆ containerDeserialized()

virtual bool MsgPack::Element::containerDeserialized ( )
inlineprotectedvirtual

Returns true if the header of a container is deserialized and reserves the necessary space for its element vector.

Reimplemented in MsgPack::Array, and MsgPack::Map.

◆ copy()

virtual std::unique_ptr< Element > MsgPack::Element::copy ( ) const
pure virtual

◆ deserialize()

virtual std::streamsize MsgPack::Element::deserialize ( int64_t &  pos,
std::basic_streambuf< char > *  streamBuffer,
std::streamsize  bytes 
)
inlineprotectedvirtual

Deserializes bytes at the given deserializer position pos from streamBuffer.

Reimplemented in MsgPack::Data, MsgPack::Header, and MsgPack::Number.

◆ getElementsVector()

virtual std::vector< std::unique_ptr< Element > > * MsgPack::Element::getElementsVector ( )
inlineprotectedvirtual

Returns a raw pointer to the element vector of a container.

Reimplemented in MsgPack::Array, and MsgPack::Map.

◆ getEndPos()

virtual int64_t MsgPack::Element::getEndPos ( ) const
protectedpure virtual

Returns the first invalid (de)serializer position.

Implemented in MsgPack::Binary, MsgPack::Extended, MsgPack::String, MsgPack::Header, MsgPack::Number, and MsgPack::Primitive.

◆ getSizeInBytes()

virtual uint32_t MsgPack::Element::getSizeInBytes ( ) const
inlinevirtual

Returns the size in bytes this MsgPack::Element takes if completely serialized.

Reimplemented in MsgPack::Array, MsgPack::Map, MsgPack::ArrayHeader, MsgPack::MapHeader, and MsgPack::Header.

◆ getType()

virtual Type MsgPack::Element::getType ( ) const
pure virtual

Returns the MsgPack::Type.

Implemented in MsgPack::Header, MsgPack::Number, and MsgPack::Primitive.

◆ serialize()

virtual std::streamsize MsgPack::Element::serialize ( int64_t &  pos,
std::basic_streambuf< char > *  streamBuffer,
std::streamsize  bytes 
)
protectedpure virtual

Serializes bytes at the given serializer position pos into streamBuffer.

Implemented in MsgPack::Data, MsgPack::Header, MsgPack::Number, and MsgPack::Primitive.

◆ startDeserialize()

virtual int64_t MsgPack::Element::startDeserialize ( uint8_t  firstByte)
protectedpure virtual

Reads in one byte and returns the initial deserializer position in bytes (negative value if there is a header)

Implemented in MsgPack::Header, MsgPack::Number, and MsgPack::Primitive.

◆ startSerialize()

virtual int64_t MsgPack::Element::startSerialize ( )
inlineprotectedvirtual

Returns the initial serializer position in bytes (negative value if there is a header)

Reimplemented in MsgPack::Header.

◆ toJSON()

virtual void MsgPack::Element::toJSON ( std::ostream &  stream) const
pure virtual

Writes a human readable JSON-like string into the given stream.

Implemented in MsgPack::Array, MsgPack::Map, MsgPack::ArrayHeader, MsgPack::MapHeader, MsgPack::Binary, MsgPack::Extended, MsgPack::String, MsgPack::Number, and MsgPack::Primitive.


The documentation for this class was generated from the following file: