Photon C++ Client API  5.0.7.3
Public Member Functions | List of all members
Deserializer Class Reference
Inheritance diagram for Deserializer:
Inheritance graph
[legend]
Collaboration diagram for Deserializer:
Collaboration graph
[legend]

Public Member Functions

 Deserializer (const nByte *data, unsigned int size, nByte protocol=SerializationProtocol::DEFAULT)
 
bool pop (Object &object)
 
virtual JStringtoString (JString &retStr, bool withTypes=false) const
 
virtual JStringtoString (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 LogFormatOptionsgetLogFormatOptions (void)
 
static void setLogFormatOptions (const LogFormatOptions &options)
 

Detailed Description

With a Deserializer instance you can retrieve the original data that has been serialized into a byte-array by a Serializer instance, by the Photon Server or by other Photon Client platforms.

Constructor & Destructor Documentation

◆ Deserializer()

Deserializer ( const nByte *  data,
unsigned int  size,
nByte  protocol = SerializationProtocol::DEFAULT 
)

Constructor: Creates a new instance that contains the passed data as payload.

Parameters
dataa byte array, that has been retrieved by a call to Serializer::getData(), an unchanged copy of such a byte array or a byte array that is otherwise guaranteed to 100% conform to the format that's used by Serializer (for example data, that has been serialized by a compatible version of the Photon Server or of other Photon Client platforms), otherwise the behavior of this class is undefined.
sizethe size in bytes of data

Member Function Documentation

◆ pop()

bool pop ( Object object)

This function will deserialize all data in the Deserializer-instance, that has been serialized via a single call to Serializer::push(). If the Deserializer instance has been created by passing a byte array that has been created by a Serializer instance on which multiple push() calls have taken place, then an equivalent amount of calls to this function will be valid.

Remarks
Any potentially existing old payload of parameter object will get overridden in a successful call. In case that there is nothing more to deserialize parameter object will remain unchanged. In case that a call to this function fails due to corrupt data (read: the byte array passed to the Deserializer instance on construction has neither been retrieved by a call to Serializer::getData() nor been an unchanged copy of such data) the content of parameter object is undefined.
Parameters
objectan Object-instance, in which the deserialized data will be stored
Returns
true on success, false when all data has already been deserialized in previous calls or when the data is corrupt and can't be deserialized

◆ toString() [1/3]

JString & toString ( JString retStr,
bool  withTypes = false 
) const
virtual
Remarks
The cost of this function depends a lot on implementation details of the implementing subclasses, but for container classes this function can become quite expensive, if the instance contains huge amounts of data, as its cost for many container class implementations increases disproportionately high to the size of the payload.
Parameters
retStrreference 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
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.

Implements ToString.

◆ toString() [2/3]

toString
Remarks
The cost of this function depends a lot on implementation details of the implementing subclasses, but for container classes this function can become quite expensive, if the instance contains huge amounts of data, as its cost for many container class implementations increases disproportionately high to the size of the payload.
Parameters
retStrreference 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
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.

◆ toString() [3/3]

JString toString

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.
See also
JString