Nv::Blast::ExtSerialization Class Reference

#include <NvBlastExtSerialization.h>

List of all members.

Classes

class  BufferProvider
struct  EncodingID

Public Member Functions

virtual void * deserializeFromBuffer (const void *buffer, uint64_t bufferSize, uint32_t *objectTypeIDPtr=nullptr)=0
virtual uint32_t getSerializationEncoding () const =0
virtual bool peekHeader (uint32_t *objectTypeID, uint32_t *encodingID, uint64_t *dataSize, const void *buffer, uint64_t bufferSize)=0
virtual void release ()=0
virtual uint64_t serializeIntoBuffer (void *&buffer, const void *object, uint32_t objectTypeID)=0
virtual void setBufferProvider (BufferProvider *bufferProvider)=0
virtual bool setSerializationEncoding (uint32_t encodingID)=0
virtual const void * skipObject (uint64_t &bufferSize, const void *buffer)=0

Protected Member Functions

virtual ~ExtSerialization ()


Detailed Description

Serialization manager interface

Constructor & Destructor Documentation

virtual Nv::Blast::ExtSerialization::~ExtSerialization (  )  [inline, protected, virtual]

Destructor is virtual and not public - use the release() method instead of explicitly deleting the serialization manager


Member Function Documentation

virtual void* Nv::Blast::ExtSerialization::deserializeFromBuffer ( const void *  buffer,
uint64_t  bufferSize,
uint32_t *  objectTypeIDPtr = nullptr 
) [pure virtual]

Deserialize from a buffer into a newly allocated object.

Parameters:
[in] buffer Pointer to the buffer to read.
[in] bufferSize Size of the buffer to read.
[out] objectTypeIDPtr Optional, if not NULL then *objectTypeIDPtr will be filled with the deserialized object's type ID if deserialization is successful, or 0 if unsuccessful.
Returns:
object pointer; returns null if failed to deserialize.

virtual uint32_t Nv::Blast::ExtSerialization::getSerializationEncoding (  )  const [pure virtual]

Retrieve the current serialization encoding being used. Note, by default this is set to the encoding of the first serializer registered by a module. Currently this is done automatically by the NvBlastExtLlExtension module.

Returns:
the current serialization encoding (zero if none is set).

virtual bool Nv::Blast::ExtSerialization::peekHeader ( uint32_t *  objectTypeID,
uint32_t *  encodingID,
uint64_t *  dataSize,
const void *  buffer,
uint64_t  bufferSize 
) [pure virtual]

Reads information from a buffer, returning the contained object type ID, encoding ID, and data size.

Parameters:
[out] objectTypeID If not NULL, the object type ID is written to *objectTypeID.
[out] encodingID If not NULL, the encoding ID is written to *encodingID.
[out] dataSize If not NULL, the data size is written to *dataSize. (Does not include the size of the header.)
[in] buffer Pointer to the buffer to read.
[in] bufferSize Size of the buffer to read.
Returns:
true iff the header is successfully read.

virtual void Nv::Blast::ExtSerialization::release (  )  [pure virtual]

Release the serialization manager and all contained objects.

virtual uint64_t Nv::Blast::ExtSerialization::serializeIntoBuffer ( void *&  buffer,
const void *  object,
uint32_t  objectTypeID 
) [pure virtual]

Serialize into a buffer. Allocates the buffer internally using the callack set in setBufferProvider.

Parameters:
[out] buffer Pointer to the buffer created.
[in] object Object pointer.
[in] objectTypeID Object type ID.
Returns:
the number of bytes serialized into the buffer (zero if unsuccessful).

virtual void Nv::Blast::ExtSerialization::setBufferProvider ( BufferProvider bufferProvider  )  [pure virtual]

Set the buffer provider callback to use. (See BufferProvider.) If not set, a default provider using NVBLAST_ALLOC (see NvBlastGlobals.h) is used, which may be freed using NvBLAST_FREE.

Parameters:
[in] bufferProvider Buffer provider callback to use. If NULL, uses the default provider using the allocator given in NvBlastGlobals.

virtual bool Nv::Blast::ExtSerialization::setSerializationEncoding ( uint32_t  encodingID  )  [pure virtual]

Set the serialization encoding to use. (See EncodingID.)

Returns:
true iff successful.

virtual const void* Nv::Blast::ExtSerialization::skipObject ( uint64_t &  bufferSize,
const void *  buffer 
) [pure virtual]

Determines the current object in the buffer and returns the position in the buffer immediately after the object.

Parameters:
[in,out] bufferSize Size of the buffer to read on input, on output the remaining buffer size given the return buffer value.
[in] buffer Pointer to the buffer to read.
Returns:
a pointer to the new position in the buffer after the skipped object if successful, NULL otherwise. The bufferSize field is only updated if a valid pointer is returned.


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