Defined in include/common/PxSerializer.h

Inheritance Relationships

Derived Type

class PxSerializer

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).

Subclassed by PxSerializerDefaultAdapter< T >

Basics needed for Binary- and RepX-Serialization

virtual const char *getConcreteTypeName() const = 0

Returns string name of dynamic type.


Class name of most derived type of this object.

virtual void requiresObjects(PxBase&, PxProcessPxBaseCallback&) const = 0

Adds required objects to the collection.

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

virtual bool isSubordinate() const = 0

Whether the object is subordinate.

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


Whether the class is subordinate

Functionality needed for Binary Serialization only

virtual void exportExtraData(PxBase&, PxSerializationContext&) const = 0

Exports object’s extra data to stream.

virtual void exportData(PxBase&, PxSerializationContext&) const = 0

Exports object’s data to stream.

virtual void registerReferences(PxBase &obj, PxSerializationContext &s) const = 0

Register references that the object maintains to other objects.

virtual size_t getClassSize() const = 0

Returns size needed to create the class instance.


sizeof class instance.

virtual PxBase *createObject(PxU8 *&address, PxDeserializationContext &context) const = 0

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

  • address – Location at which object is created. Address is increased by the size of the created object.

  • context – Context for reading external data and resolving references.


Created PxBase pointer (needs to be identical to address before increment).

inline virtual ~PxSerializer()