Dataflow Runtime API
3.1.1.0
|
fixed size pool allocator More...
#include <Imt.Base.Core.Util/TrivialPoolAllocator.h>
Public Types | |
typedef T | value_type |
value_type definition More... | |
Public Member Functions | |
TrivialPoolAllocator (T pool[], size_t poolSize) | |
Ctor. More... | |
T * | allocate () |
Allocates memory out of the memory pool. More... | |
void | deallocate (T *obj) |
Deallocates the pool memory pointed by ptr. More... | |
bool | isFull () const |
get is allocator full flag More... | |
size_t | remainingSize () const |
return the remaining size of Ts 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 TrivialPoolAllocator object.
T | is a trivial type like a struct used as the element to allocate. The bytes size of T must be greator or equal sizeof(Node) |
typedef T imt::base::core::util::TrivialPoolAllocator< T >::value_type |
value_type definition
imt::base::core::util::TrivialPoolAllocator< T >::TrivialPoolAllocator | ( | T | pool[], |
size_t | poolSize | ||
) |
Ctor.
pool | object pool / array start address |
poolSize | buffer size |
|
inline |
Allocates memory out of the memory pool.
Allocates the a number of bytes and returns a pointer to the memory location. The number of bytes must be <= elemSize.
|
inline |
return the maixmal size
|
inline |
Deallocates the pool memory pointed by ptr.
obj | Referenz to the object, which points to the memory to deallocate. (void*& allows writing ptr) |
|
inlinestatic |
get size of T
|
inline |
get is allocator full flag
|
inline |
return the remaining size of Ts