ClassChunker

Engine/source/core/dataChunker.h

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

More...

Private Attributes

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

T *

a pointer to a linked list of freed elements for reuse

Public Functions

T *

Allocates and properly constructs in place a new element.

free(T * elem)

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

freeBlocks(bool keepOne)

Detailed Description

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.

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

Public Functions

ClassChunker(S32 size)

alloc()

Allocates and properly constructs in place a new element.

free(T * elem)

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

freeBlocks(bool keepOne)