Namespace: ObjectPool
Language: C++
Type: Defold C++
File: object_pool.h
Source: engine/dlib/src/dmsdk/dlib/object_pool.h
Include: dmsdk/dlib/object_pool.h
Object Pool API documentation
Type: FUNCTION Allocate a new object
Returns
index (uint32_t) - logical indexType: FUNCTION
Returns
capacity (uint32_t) - maximum number of objectsType: STRUCT Object pool data-structure with the following properties
Template Parameters
TType: FUNCTION Constructor
Type: FUNCTION Returns object index to the object pool
Parameters
index (uint32_t) - index of objectclear (bool) - If set, memset’s the object memoryType: FUNCTION Checks if the pool is full
Returns
result (bool) - returns true if the pool is fullType: FUNCTION Get object from logical index
Parameters
index (uint32_t) - index of the objectReturns
object (T&) - a reference to the objectType: FUNCTION Get object pointer from logical index
Parameters
index (uint32_t) - index of the objectReturns
object (T*) - a pointer to the object. Null if the logical index wasn’t validType: FUNCTION Get the array of currently active objects
Notes
Returns
object (dmArrayType: FUNCTION Grow by an amount.
Parameters
grow (uint32_t) - number of items to growType: FUNCTION Set object from logical index
Parameters
index (uint32_t) - index of objectobject (T&) - reference ot object. THe object stored is copied by value.Type: FUNCTION Set capacity. New capacity must be >= old_capacity
Parameters
capacity (uint32_t) - max number of objects to storeType: FUNCTION Get number of objects currently stored
Returns
size (uint32_t) - returns the number of objects currently stored