Dataflow Runtime API
3.1.1.0
|
fixed size pool allocator More...
#include <Imt.Base.Core.Util/ObjectPoolAllocator.h>
Public Member Functions | |
ObjectPoolAllocator (T pool[], size_t poolSize) | |
Ctor. More... | |
T * | allocate () |
Instantiates an object out of the memory pool. More... | |
void | deallocate (T *obj) |
Deallocates the pool memory pointed by obj. More... | |
bool | isFull () const |
get is allocator full flag More... | |
size_t | remainingSize () const |
return the remaining size of Ts More... | |
const void * | endAddr () const |
returns the end address More... | |
const void * | startAddr () const |
returns the start address More... | |
size_t | capacity () const |
return the maixmal size More... | |
Static Public Member Functions | |
static size_t | getValueSize () |
get size of T More... | |
fixed size pool allocator
Some IMT constraints are vioalted with this class
This fixed size pool allocator can be used as a kind of heap for object with the same size. E.g. an object of this class can be used behind a stack, queue and so on. The memory ressource used for this allocator must have a constant size and start address during the lifetime of an ObjectPoolAllocator object.
T | is a non-trivial type like a class used with ctor and so on. The bytes size of T must be greator or equal sizeof(Node) |
imt::base::core::util::ObjectPoolAllocator< T >::ObjectPoolAllocator | ( | T | pool[], |
size_t | poolSize | ||
) |
Ctor.
pool | object pool / array start address |
poolSize | buffer size |
|
inline |
Instantiates an object out of the memory pool.
Allocates the a number of bytes, calls the constructor of the object (new) and returns a pointer to it. The number of bytes must be <= elemSize.
|
inline |
return the maixmal size
|
inline |
Deallocates the pool memory pointed by obj.
obj | Reference to the object, which points to the memory to deallocate. |
|
inline |
returns the end address
|
inlinestatic |
get size of T
|
inline |
get is allocator full flag
|
inline |
return the remaining size of Ts
|
inline |
returns the start address