ClassChunker< T > Class Template Reference

#include <dataChunker.h>

Inheritance diagram for ClassChunker< T >:

Inheritance graph
[legend]
List of all members.

Detailed Description


template<class T> class ClassChunker< T >

Templatized data chunker class with proper construction and destruction of its elements.

DataChunker just allocates space. This subclass actually constructs/destructs the elements. This class is appropriate for more complex classes.


Public Member Functions

 ClassChunker (S32 size=DataChunker::ChunkSize)
T * alloc ()
 Allocates and properly constructs in place a new element.
void free (T *elem)
 Properly destructs and frees an element allocated with the alloc method.
void freeBlocks ()

Private Attributes

S32 mElementSize
 the size of each element, or the size of a pointer, whichever is greater
T * mFreeListHead
 a pointer to a linked list of freed elements for reuse


Constructor & Destructor Documentation

template<class T>
ClassChunker< T >::ClassChunker ( S32  size = DataChunker::ChunkSize  )  [inline]


Member Function Documentation

template<class T>
T* ClassChunker< T >::alloc (  )  [inline]

Allocates and properly constructs in place a new element.

template<class T>
void ClassChunker< T >::free ( T *  elem  )  [inline]

Properly destructs and frees an element allocated with the alloc method.

template<class T>
void ClassChunker< T >::freeBlocks (  )  [inline]


Member Data Documentation

template<class T>
S32 ClassChunker< T >::mElementSize [private]

the size of each element, or the size of a pointer, whichever is greater

template<class T>
T* ClassChunker< T >::mFreeListHead [private]

a pointer to a linked list of freed elements for reuse