Photon C++ Client API
Public Member Functions | List of all members
DeSerializer Class Reference
Inheritance diagram for DeSerializer:
Inheritance graph
Collaboration diagram for DeSerializer:
Collaboration graph

Public Member Functions

 DeSerializer (const nByte *data, int size)
bool pop (Object &object)
JStringtoString (JString &retStr, bool withTypes=false) const
- Public Member Functions inherited from Base
virtual ~Base (void)
- 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 Base
static void setListener (const BaseListener *baseListener)
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,
int  size 

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

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.

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.
objectan Object-instance, in which the deserialized data will be stored
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()

JString & toString ( JString retStr,
bool  withTypes = false 
) const
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.
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
a JString representation of the instance and its contents for debugging purposes.

Implements ToString.