Public Member Functions | Protected Member Functions | List of all members
PxSerializationContext Class Referenceabstract

Binary serialization context class. More...

#include <PxSerialFramework.h>

Public Member Functions

virtual void registerReference (PxBase &base, PxU32 kind, size_t reference)=0
 Registers a reference value corresponding to a PxBase object. More...
 
virtual const PxCollectiongetCollection () const =0
 Returns the collection that is being serialized. More...
 
virtual void writeData (const void *data, PxU32 size)=0
 Serializes object data and object extra data. More...
 
virtual void alignData (PxU32 alignment=PX_SERIAL_ALIGN)=0
 Aligns the serialized data. More...
 
virtual void writeName (const char *name)=0
 Helper function to write a name to the extraData if serialization is configured to save names. More...
 

Protected Member Functions

 PxSerializationContext ()
 
virtual ~PxSerializationContext ()
 

Detailed Description

Binary serialization context class.

This class is used to register reference values and write object and object extra data during serialization. It is mainly used by the serialization framework. Except for custom serializable types, users should not have to worry about it.

See Also
PxDeserializationContext

Constructor & Destructor Documentation

PxSerializationContext::PxSerializationContext ( )
inlineprotected
virtual PxSerializationContext::~PxSerializationContext ( )
inlineprotectedvirtual

Member Function Documentation

virtual void PxSerializationContext::alignData ( PxU32  alignment = PX_SERIAL_ALIGN)
pure virtual

Aligns the serialized data.

This function is assumed to be called within the implementation of PxSerializer::exportData and PxSerializer::exportExtraData.

See Also
PxSerializer::exportData, PxSerializer::exportExtraData, PxDeserializationContext::alignExtraData
virtual const PxCollection& PxSerializationContext::getCollection ( ) const
pure virtual

Returns the collection that is being serialized.

virtual void PxSerializationContext::registerReference ( PxBase base,
PxU32  kind,
size_t  reference 
)
pure virtual

Registers a reference value corresponding to a PxBase object.

This method is assumed to be called in the implementation of PxSerializer::registerReferences for serialized references that need to be resolved on deserialization.

A reference needs to be associated with exactly one PxBase object in either the collection or the external references collection.

Different kinds of references are supported and need to be specified. In the most common case (PX_SERIAL_REF_KIND_PXBASE) the PxBase object matches the reference value (which is the pointer to the PxBase object). Integer references maybe registered as well (used for internal material indices with PX_SERIAL_REF_KIND_MATERIAL_IDX). Other kinds could be added with the restriction that for pointer types the kind value needs to be marked with the PX_SERIAL_REF_KIND_PTR_TYPE_BIT.

Parameters
[in]basePxBase object associated with the reference
[in]kindWhat kind of reference this is (PX_SERIAL_REF_KIND_PXBASE, PX_SERIAL_REF_KIND_MATERIAL_IDX or custom kind)
[in]referenceValue of reference
See Also
PxDeserializationContext::resolveReference, PX_SERIAL_REF_KIND_PXBASE, PX_SERIAL_REF_KIND_MATERIAL_IDX, PxSerializer::registerReferences

Referenced by PxSerializerDefaultAdapter< T >::registerReferences().

virtual void PxSerializationContext::writeData ( const void *  data,
PxU32  size 
)
pure virtual

Serializes object data and object extra data.

This function is assumed to be called within the implementation of PxSerializer::exportData and PxSerializer::exportExtraData.

See Also
PxSerializer::exportData, PxSerializer::exportExtraData, PxSerializer::createObject, PxDeserializationContext::readExtraData

Referenced by PxSerializerDefaultAdapter< T >::exportData().

virtual void PxSerializationContext::writeName ( const char *  name)
pure virtual

Helper function to write a name to the extraData if serialization is configured to save names.

This function is assumed to be called within the implementation of PxSerializer::exportExtraData.

See Also
PxSerialization::serializeCollectionToBinary, PxDeserializationContext::readName

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