Kaim::BaseBlobBuilder< T > Class Template Reference

Kaim::BaseBlobBuilder< T > Class Template Referenceabstract

#include <baseblobbuilder.h>

Class Description

template<class T>
class Kaim::BaseBlobBuilder< T >

BaseBlobBuilder is an abstract base class that builds a blob within a contiguous block of memory.

Template Parameters
TThe name of the blob class that this object will handle.

This class cannot be used directly. If you are building a blob for a class that is supplied with the Gameware Navigation SDK, use the derived BaseBlobBuilder class that corresponds to the blob class you want to build. If you want to use the blob framework to serialize a custom class, derive your own custom class from BaseBlobBuilder<YourBlobClassName>, and implement DoBuild().

Inherits Kaim::NewOverrideBase< Stat >.

Inherited by Kaim::RawDataBlobBuilder< T >.

Public Member Functions

T * Build (BlobHandler< T > &blobHandler)
 
void BuildFlatBlob (T &blob)
 
void DoAllocAndBuildReferencedBlob (BlobBuffer *blobBuffer, BlobRef< T > *blobRef)
 
void DoBuildAllocatedBlob (BlobBuffer *blobBuffer, T *blob)
 
BlobBuffer * GetBlobBufferToBuildThis ()
 
bool IsWriteMode ()
 

Public Attributes

T * m_blob
 
BlobBuffer * m_blobBuffer
 

Private Member Functions

virtual void DoBuild ()=0
 

Member Function Documentation

template<class T>
T * Kaim::BaseBlobBuilder< T >::Build ( BlobHandler< T > &  blobHandler)

This method:

  1. Calls DoBuild() in COUNT mode to determine the amount of memory needed for the blob to be built.

  1. Allocates the amount of memory in the specified BlobHandler.
  2. Calls DoBuild() again, in WRITE mode, to actually build the blob in the buffer allocated by the BlobHandler.
template<class T>
void Kaim::BaseBlobBuilder< T >::BuildFlatBlob ( T &  blob)

Simple way to use DoBuild in case of flat blob (that is, a blob that does not have a BlobArray or BlobRef)

template<class T>
void Kaim::BaseBlobBuilder< T >::DoAllocAndBuildReferencedBlob ( BlobBuffer *  blobBuffer,
BlobRef< T > *  blobRef 
)

For internal use. Use BUILD_REFERENCED_BLOB instead.

template<class T>
virtual void Kaim::BaseBlobBuilder< T >::DoBuild ( )
privatepure virtual

Implement this function in any class that derives from BaseBlobBuilder.

Its responsibility is to set the data for each class member maintained by m_blob. In your implementation, use one of the macros sets supplied for this purpose:

Implemented in Kaim::BoxObstaclesCollectionBlobBuilder, Kaim::NavGraphBlobBuilder, Kaim::GeneratorSectorBlobBuilder, and Kaim::GeneratorSectorListBlobBuilder.

template<class T>
void Kaim::BaseBlobBuilder< T >::DoBuildAllocatedBlob ( BlobBuffer *  blobBuffer,
T *  blob 
)

For internal use. Use BLOB_BUILD instead.

template<class T>
BlobBuffer* Kaim::BaseBlobBuilder< T >::GetBlobBufferToBuildThis ( )
inline

For internal use. Check if m_buildingPart == BUILDING_SHALLOW_PART and return this.

template<class T>
bool Kaim::BaseBlobBuilder< T >::IsWriteMode ( )
inline

Indicates whether the builder is operating in COUNT mode or in WRITE mode.

This can be used in implementations of DoBuild().

Member Data Documentation

template<class T>
T* Kaim::BaseBlobBuilder< T >::m_blob

The blob maintained by this builder. Only modify using the macros listed under DoBuild().

template<class T>
BlobBuffer* Kaim::BaseBlobBuilder< T >::m_blobBuffer

For internal use. Use BLOB_SET and BLOB_ARRAY instead.


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