Public Member Functions | List of all members
PxSerializer Class Referenceabstract

Serialization interface class. More...

#include <PxSerializer.h>

Inheritance diagram for PxSerializer:
Inheritance graph
[legend]

Public Member Functions

virtual ~PxSerializer ()
 
Basics needed for Binary- and RepX-Serialization
virtual const char * getConcreteTypeName () const =0
 Returns string name of dynamic type. More...
 
virtual void requires (PxBase &, PxProcessPxBaseCallback &) const =0
 Adds required objects to the collection. More...
 
virtual bool isSubordinate () const =0
 Whether the object is subordinate. More...
 
Functionality needed for Binary Serialization only
virtual void exportExtraData (PxBase &, PxSerializationContext &) const =0
 Exports object's extra data to stream. More...
 
virtual void exportData (PxBase &, PxSerializationContext &) const =0
 Exports object's data to stream. More...
 
virtual void registerReferences (PxBase &obj, PxSerializationContext &s) const =0
 Register references that the object maintains to other objects. More...
 
virtual size_t getClassSize () const =0
 Returns size needed to create the class instance. More...
 
virtual PxBasecreateObject (PxU8 *&address, PxDeserializationContext &context) const =0
 Create object at a given address, resolve references and import extra data. More...
 

Detailed Description

Serialization interface class.

PxSerializer is used to extend serializable PxBase classes with serialization functionality. The interface is structured such that per-class adapter instances can be used as opposed to per-object adapter instances, avoiding per object allocations. Hence the methods take a reference to PxBase as a parameter.

The PxSerializer interface needs to be implemented for binary or RepX serialization to work on custom types. If only RepX serialization is needed, some methods can be left empty, as they are only needed for binary serialization.

A default implementation is available as a template adapter (PxSerializerDefaultAdapter).

See Also
PxSerializerDefaultAdapter, PX_NEW_SERIALIZER_ADAPTER, PxSerializationRegistry::registerSerializer

Constructor & Destructor Documentation

virtual PxSerializer::~PxSerializer ( )
inlinevirtual

Member Function Documentation

virtual PxBase* PxSerializer::createObject ( PxU8 *&  address,
PxDeserializationContext context 
) const
pure virtual

Create object at a given address, resolve references and import extra data.

Parameters
addressLocation at which object is created. Address is increased by the size of the created object.
contextContext for reading external data and resolving references.
Returns
Created PxBase pointer (needs to be identical to address before increment).

Implemented in PxSerializerDefaultAdapter< T >.

virtual void PxSerializer::exportData ( PxBase ,
PxSerializationContext  
) const
pure virtual

Exports object's data to stream.

Implemented in PxSerializerDefaultAdapter< T >.

virtual void PxSerializer::exportExtraData ( PxBase ,
PxSerializationContext  
) const
pure virtual

Exports object's extra data to stream.

Implemented in PxSerializerDefaultAdapter< T >.

virtual size_t PxSerializer::getClassSize ( ) const
pure virtual

Returns size needed to create the class instance.

Returns
sizeof class instance.

Implemented in PxSerializerDefaultAdapter< T >.

virtual const char* PxSerializer::getConcreteTypeName ( ) const
pure virtual

Returns string name of dynamic type.

Returns
Class name of most derived type of this object.

Implemented in PxSerializerDefaultAdapter< T >.

virtual bool PxSerializer::isSubordinate ( ) const
pure virtual

Whether the object is subordinate.

A class is subordinate, if it can only be instantiated in the context of another class.

Returns
Whether the class is subordinate
See Also
PxSerialization::isSerializable

Implemented in PxSerializerDefaultAdapter< T >.

virtual void PxSerializer::registerReferences ( PxBase obj,
PxSerializationContext s 
) const
pure virtual

Register references that the object maintains to other objects.

Implemented in PxSerializerDefaultAdapter< T >.

virtual void PxSerializer::requires ( PxBase ,
PxProcessPxBaseCallback  
) const
pure virtual

Adds required objects to the collection.

This method does not add the required objects recursively, e.g. objects required by required objects.

See Also
PxCollection, PxSerialization::complete

Implemented in PxSerializerDefaultAdapter< T >.


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


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com