Public Member Functions

KBaseAllocator Class Reference

Search for all occurrences

Detailed Description

An allocator class for use as a template parameter to one of the container class (KMap, KSet2, KDynamicArray...) must implement these.

Definition at line 51 of file kcontainerallocators.h.

#include <kcontainerallocators.h>

List of all members.

Public Member Functions

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

Constructor & Destructor Documentation

KBaseAllocator ( size_t const  pRecordSize ) [inline]

The class constructor.

Parameters:
pRecordSize the 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 60 of file kcontainerallocators.h.

        : mRecordSize(pRecordSize)
    {
    }

Member Function Documentation

void Reserve ( size_t const  pRecordCount ) [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 72 of file kcontainerallocators.h.

    {
        // By default, ignore all preallocating requests.
    }
void* AllocateRecords ( size_t const  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 82 of file kcontainerallocators.h.

    {
        return FbxSdkMalloc(pRecordCount * mRecordSize);
    }
void FreeMemory ( void *  pRecord ) [inline]

Frees a block of memory returned by AllocateRecords.

Parameters:
pRecord

Definition at line 90 of file kcontainerallocators.h.

    {
        FbxSdkFree(pRecord);
    }
size_t GetRecordSize ( ) const [inline]
Returns:
the size of each record allocated.

Definition at line 97 of file kcontainerallocators.h.

    {
        return mRecordSize;
    }

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

KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator
KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator KBaseAllocator