Photon C++ Client API
5.0.7.3
|
Public Member Functions | |
Serializer (nByte protocol=SerializationProtocol::DEFAULT) | |
const nByte * | getData (void) const |
int | getSize (void) const |
template<typename T > | |
bool | push (const T &data) |
template<typename T > | |
bool | push (const T pData, int arraySize) |
template<typename T > | |
bool | push (const T pData, const int *arraySizes) |
virtual JString & | toString (JString &retStr, bool withTypes=false) const |
virtual JString & | toString (JString &retStr, bool withTypes=false) const=0 |
JString | toString (bool withTypes=false) const |
Public Member Functions inherited from Base | |
virtual | ~Base (void)=0 |
Public Member Functions inherited from LoggingBase< Base > | |
virtual | ~LoggingBase (void)=0 |
Public Member Functions inherited from ToString | |
virtual | ~ToString (void) |
virtual JString | typeToString (void) const |
JString | toString (bool withTypes=false) const |
Additional Inherited Members | |
Static Public Member Functions inherited from LoggingBase< Base > | |
static void | setListener (const BaseListener *pBaseListener) |
static int | getDebugOutputLevel (void) |
static bool | setDebugOutputLevel (int debugLevel) |
static const LogFormatOptions & | getLogFormatOptions (void) |
static void | setLogFormatOptions (const LogFormatOptions &options) |
The Serializer class serializes everything, that gets added to it, into a byte-array.
You can add data of suported types to a Serializer instance by calling push() on it, passing that data. A call to push() will automatically serialize the data before adding it to the instance. The content of a Serializer instance can be retrieved in form form of a byte array by calling getData().
If you do multiple calls to push() on the same instance, then the array retrieved by getData() will contain serialized representations of the passed data for all of them. The order in which these representations are stored will match the order of the calls.
The serialized data can be used to construct a Deserializer instance from it, which provides the interface for retrieving the original datatypes from the byte array.
const nByte * getData | ( | void | ) | const |
int getSize | ( | void | ) | const |
bool push | ( | const T & | data | ) |
Adds a serialized representation of parameter data to the Serializer-instance on which it is called.
T | type of parameter data - has to be of one of the supported datatypes |
data | data to serialize |
bool push | ( | const T | pData, |
int | arraySize | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This overload accepts singledimensional arrays and NULL-pointers passed for parameter pData.
pData | array of data to serialize |
arraySize | the size of the value array |
bool push | ( | const T | pData, |
const int * | arraySizes | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This overload accepts multidimensional arrays and NULL-pointers passed for parameter val. The array, passed for parameter pData has to be a pointer of the correct abstraction level, meaning a normal pointer for a singledimensional array, a doublepointer for a twodimensional array, a triplepointer for a threedimensional array and so on.
pData | array of data to serialize |
arraySizes | the sizes for every dimension of the array |
retStr | reference to a string, to store the return-value in; the information, which is generated by this function, will be attached at the end of any eventually existing previous content of the string |
withTypes | set to true, to include type information in the generated string |
Implements ToString.
toString |
retStr | reference to a string, to store the return-value in; the information, which is generated by this function, will be attached at the end of any eventually existing previous content of the string |
withTypes | set to true, to include type information in the generated string |
JString toString |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
withTypes | set to true, to include type information in the generated string |