PxRepXSerializer

Defined in include/extensions/PxRepXSerializer.h

class PxRepXSerializer

Serializer interface for RepX (Xml) serialization.

In order to serialize a class to RepX both a PxSerializer and a PxRepXSerializer implementation are needed.

A repx Serializer provides the ability to capture a live object to a descriptor or static state and the ability to write that state out to a file. Objects allocated by the Serializer using the allocator are freed when the collection itself is freed. SnRepXCoreSerializers.cpp implements a set of Serializers for the core PhysX types.

Note

Implementing a PxRepXSerializer is currently not practical without including the internal PhysXExtension header “SnRepXSerializerImpl.h”.

Public Functions

virtual const char *getTypeName() = 0

The type this Serializer is meant to operate on.

virtual void objectToFile(const PxRepXObject &inLiveObject, PxCollection *inCollection, XmlWriter &inWriter, MemoryBuffer &inTempBuffer, PxRepXInstantiationArgs &inArgs) = 0

Convert from a RepX object to a key-value pair hierarchy.

Parameters
  • inLiveObject[in] The object to convert to the passed in descriptor.

  • inCollection[in] The collection to use to find ids of references of this object.

  • inWriter[in] Interface to write data to.

  • inTempBuffer[in] used to for temporary allocations.

  • inArgs[in] The arguments used in create resources and objects.

virtual PxRepXObject fileToObject(XmlReader &inReader, XmlMemoryAllocator &inAllocator, PxRepXInstantiationArgs &inArgs, PxCollection *inCollection) = 0

Convert from a descriptor to a live object.

Must be an object of this Serializer type.

Parameters
  • inReader[in] The inverse of the writer, a key-value pair database.

  • inAllocator[in] An allocator to use for temporary allocations. These will be freed after instantiation completes.

  • inArgs[in] The arguments used in create resources and objects.

  • inCollection[in] The collection used to find references.

Returns

The new live object. It can be an invalid object if the instantiation cannot take place.

Protected Functions

inline virtual ~PxRepXSerializer()