FBX C++ API Reference
FbxBaseAllocator Class Reference

An allocator class for use as a template parameter to one of the container class (FbxMap, FbxSet, FbxDynamicArray...) must implement these. More...

#include <fbxcontainerallocators.h>

Public Member Functions

 FbxBaseAllocator (const size_t pRecordSize)
 The class constructor. More...
 
void Reserve (const size_t)
 This tells the allocator that we are about to call AllocateRecords one or many times to allocate pRecordCount records. More...
 
void * AllocateRecords (const size_t pRecordCount=1)
 Returns a pointer to a uninitialized continuous block of memory able to hold pRecordCount * pRecordSize bytes. More...
 
void FreeMemory (void *pRecord)
 Frees a block of memory returned by AllocateRecords. More...
 
size_t GetRecordSize () const
 

Detailed Description

An allocator class for use as a template parameter to one of the container class (FbxMap, FbxSet, FbxDynamicArray...) must implement these.

Definition at line 28 of file fbxcontainerallocators.h.

Constructor & Destructor Documentation

FbxBaseAllocator ( const size_t  pRecordSize)
inline

The class constructor.

Parameters
pRecordSizethe size of one record held by the container.
Remarks
The parameter pRecordSize is not necessarily the same size as of the value type, since the container may wrap the value into a private class.

Definition at line 37 of file fbxcontainerallocators.h.

37  :
38  mRecordSize(pRecordSize)
39  {
40  }

Member Function Documentation

void Reserve ( const size_t  )
inline

This tells the allocator that we are about to call AllocateRecords one or many times to allocate pRecordCount records.

Parameters
pRecordCount
Remarks
This gives the allocator a chance to do whatever it deems necessary to optimize subsequent allocations, for example, by preallocating a sufficiently large pool of memory.

Definition at line 49 of file fbxcontainerallocators.h.

50  {
51  // By default, ignore all preallocating requests.
52  }
void* AllocateRecords ( const size_t  pRecordCount = 1)
inline

Returns a pointer to a uninitialized continuous block of memory able to hold pRecordCount * pRecordSize bytes.

Parameters
pRecordCount
Remarks
pRecordSize was defined in the Constructor description, above.

Definition at line 59 of file fbxcontainerallocators.h.

60  {
61  return FbxMalloc(FbxAllocSize(pRecordCount, mRecordSize));
62  }
void FreeMemory ( void *  pRecord)
inline

Frees a block of memory returned by AllocateRecords.

Parameters
pRecord

Definition at line 67 of file fbxcontainerallocators.h.

68  {
69  FbxFree(pRecord);
70  }
size_t GetRecordSize ( ) const
inline
Returns
the size of each record allocated.

Definition at line 74 of file fbxcontainerallocators.h.

75  {
76  return mRecordSize;
77  }

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