SDK Object Pool API documentation
| Namespace: | ObjectPool | 
| Include: | #include <dmsdk/dlib/object_pool.h> | 
| STRUCTS | |
|---|---|
| struct dmObjectPool<T> | Object pool data-structure with the following prop... | 
| FUNCTIONS | |
|---|---|
| uint32_t Alloc() | Allocate a new object | 
| uint32_t Capacity() | |
| void dmObjectPool() | Constructor | 
| void Free(uint32_t index, bool clear) | Returns object index to the object pool | 
| bool Full() | Checks if the pool is full | 
| T& Get(uint32_t index) | Get object from logical index | 
| dmArray | Get the array of currently active objects | 
| void Set(uint32_t index, T& object) | Set object from logical index | 
| void SetCapacity(uint32_t capacity) | Set capacity. New capacity must be >= old_capacity | 
| uint32_t Size() | get size | 
void Free(uint32_t index, bool clear)
Returns object index to the object pool
PARAMETERS
| uint32_t | index | index of object | 
| bool | clear | If set, memset's the object memory | 
bool Full()
Checks if the pool is full
PARAMETERS
RETURNS
| bool | returns true if the pool is full | 
T& Get(uint32_t index)
Get object from logical index
PARAMETERS
| uint32_t | index | index of the object | 
RETURNS
| T& | a reference to the object | 
dmArray
Get the array of currently active objects
PARAMETERS
RETURNS
| dmArray | a reference to the array of objects | 
void Set(uint32_t index, T& object)
Set object from logical index
PARAMETERS
| uint32_t | index | index of object | 
| T& | object | reference ot object. THe object stored is copied by value. | 
void SetCapacity(uint32_t capacity)
Set capacity. New capacity must be >= old_capacity
PARAMETERS
| uint32_t | capacity | max number of objects to store | 
uint32_t Size()
Get number of objects currently stored
PARAMETERS
RETURNS
| uint32_t | returns the number of objects currently stored | 
TYPE
struct dmObjectPoolObject pool data-structure with the following properties - Mapping from logical index to physical index - Logical index does not changes - Allocated objects are contiguously laid out in memory Loop of m_Objects [0..Size()-1] times to iterate all objects - Internal physical order is not preserved and a direct consequence of the contiguous property