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

MsgPack::Element for all types of numbers. More...

#include <Number.h>

Inheritance diagram for MsgPack::Number:
MsgPack::Element

Public Member Functions

 Number (uint64_t value)
 Initialize from unsigned 64 bit integer.
 
 Number (int64_t value)
 Initialize from signed 64 bit integer.
 
 Number (float value)
 Initialize from 32 bit float.
 
 Number (double value)
 Initialize from 64 bit float.
 
std::unique_ptr< Elementcopy () const
 Creates a deep copy of this element.
 
void toJSON (std::ostream &stream) const
 Writes a human readable JSON-like string into the given stream.
 
Type getType () const
 Returns the MsgPack::Type.
 
bool isUnsignedInteger () const
 Returns true if getType() is one of FIXUINT, UINT_8, UINT_16, UINT_32, UINT_64.
 
bool isSignedInteger () const
 Returns true if getType() is one of FIXINT, INT_8, INT_16, INT_32, INT_64.
 
bool isFloatingPoint () const
 Returns true if getType() is one of FLOAT_32, FLOAT_64.
 
template<class T >
getValue () const
 Returns the value as given data type T.
 
- Public Member Functions inherited from MsgPack::Element
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

int64_t startDeserialize (uint8_t firstByte)
 Reads in one byte and returns the initial deserializer position in bytes (negative value if there is a header)
 
std::streamsize serialize (int64_t &pos, std::basic_streambuf< char > *streamBuffer, std::streamsize bytes)
 Serializes bytes at the given serializer position pos into streamBuffer.
 
std::streamsize deserialize (int64_t &pos, std::basic_streambuf< char > *streamBuffer, std::streamsize bytes)
 Deserializes bytes at the given deserializer position pos from streamBuffer.
 
int64_t getEndPos () const
 Returns the first invalid (de)serializer position.
 
- Protected Member Functions inherited from MsgPack::Element
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.
 

Protected Attributes

char data [9]
 Internal raw represenation of the number.
 

Friends

class Serializer
 
class Deserializer
 

Detailed Description

MsgPack::Element for all types of numbers.

Member Function Documentation

◆ copy()

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

Creates a deep copy of this element.

Implements MsgPack::Element.

◆ deserialize()

std::streamsize MsgPack::Number::deserialize ( int64_t &  pos,
std::basic_streambuf< char > *  streamBuffer,
std::streamsize  bytes 
)
protectedvirtual

Deserializes bytes at the given deserializer position pos from streamBuffer.

Reimplemented from MsgPack::Element.

◆ getEndPos()

int64_t MsgPack::Number::getEndPos ( ) const
protectedvirtual

Returns the first invalid (de)serializer position.

Implements MsgPack::Element.

◆ getType()

Type MsgPack::Number::getType ( ) const
virtual

Returns the MsgPack::Type.

Implements MsgPack::Element.

◆ serialize()

std::streamsize MsgPack::Number::serialize ( int64_t &  pos,
std::basic_streambuf< char > *  streamBuffer,
std::streamsize  bytes 
)
protectedvirtual

Serializes bytes at the given serializer position pos into streamBuffer.

Implements MsgPack::Element.

◆ startDeserialize()

int64_t MsgPack::Number::startDeserialize ( uint8_t  firstByte)
protectedvirtual

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

Implements MsgPack::Element.

◆ toJSON()

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

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

Implements MsgPack::Element.


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