PxDeserializationContext
Defined in include/common/PxSerialFramework.h
-
class PxDeserializationContext
Binary deserialization context class.
This class is used to resolve references and access extra data during deserialization. It is mainly used by the serialization framework. Except for custom serializable types, users should not have to worry about it.
See also
Public Functions
-
virtual PxBase *resolveReference(PxU32 kind, size_t reference) const = 0
Retrieves a pointer to a deserialized PxBase object given a corresponding deserialized reference value.
This method is assumed to be called in the implementation of PxSerializer::createObject in order to update reference values on deserialization.
To update a PxBase reference the corresponding deserialized pointer value needs to be provided in order to retrieve the location of the corresponding deserialized PxBase object. (PxDeserializationContext::translatePxBase simplifies this common case).
For other kinds of references the reverence values need to be updated by deduction given the corresponding PxBase instance.
See also
PxSerializationContext::registerReference, PX_SERIAL_REF_KIND_PXBASE, PX_SERIAL_REF_KIND_MATERIAL_IDX, translatePxBase
- Parameters
kind – [in] What kind of reference this is (PX_SERIAL_REF_KIND_PXBASE, PX_SERIAL_REF_KIND_MATERIAL_IDX or custom kind)
reference – [in] Deserialized reference value
- Returns
PxBase object associated with the reference value
-
template<typename T>
inline void translatePxBase(T *&base) Helper function to update PxBase pointer on deserialization.
See also
resolveReference, PX_SERIAL_REF_KIND_PXBASE
-
inline void readName(const char *&name)
Helper function to read a name from the extra data during deserialization.
This function is assumed to be called within the implementation of PxSerializer::createObject.
See also
-
template<typename T>
inline T *readExtraData(PxU32 count = 1) Function to read extra data during deserialization.
This function is assumed to be called within the implementation of PxSerializer::createObject.
-
template<typename T, PxU32 alignment>
inline T *readExtraData(PxU32 count = 1) Function to read extra data during deserialization optionally aligning the extra data stream before reading.
This function is assumed to be called within the implementation of PxSerializer::createObject.
-
inline void alignExtraData(PxU32 alignment = 16)
Function to align the extra data stream to a power of 2 alignment.
This function is assumed to be called within the implementation of PxSerializer::createObject.
-
virtual PxBase *resolveReference(PxU32 kind, size_t reference) const = 0