A fixed size, lock-free Memory Pool with reference counted memory. More...
#include <rtt/MemoryPool.hpp>
Classes | |
| struct | Item |
| Adds a reference count. More... | |
Public Types | |
| typedef T * | pointer |
| typedef unsigned int | size_type |
Public Member Functions | |
| FixedSizeMemoryPool (size_type fixed_size, const T &initial_value=T()) | |
| Initialise the memory pool with fixed_size elements. | |
| ~FixedSizeMemoryPool () | |
| Release all memory from the pool. | |
| size_type | size () const |
| Returns the number of elements currently available. | |
| size_type | capacity () const |
| Returns the maximum number of elements. | |
| pointer | allocate () |
| Acquire a pointer to memory of type T. | |
| bool | lock (pointer m) |
| Increase the reference count of a piece of memory. | |
| bool | unlock (pointer m) |
| Decrease the reference count of a piece of memory. | |
| bool | deallocate (pointer m) |
| Decrease the reference count of a piece of memory m, which becomes available for allocation. | |
Protected Types | |
| typedef AtomicQueue< void * > | QueueType |
| The pool stores memory as void pointers. | |
Protected Member Functions | |
| void | make_pool (size_type growsize) |
| For each additional pool, also store the location of the Item pointer. | |
Protected Attributes | |
| QueueType | mpool |
| T | minit |
| Item * | mpit |
A fixed size, lock-free Memory Pool with reference counted memory.
| T | A class type for which memory will be allocated. |
Definition at line 266 of file MemoryPool.hpp.
| RTT::FixedSizeMemoryPool< T >::FixedSizeMemoryPool | ( | size_type | fixed_size, | |
| const T & | initial_value = T() | |||
| ) | [inline] |
Initialise the memory pool with fixed_size elements.
| fixed_size | the number of elements, must be at least 1. |
Definition at line 315 of file MemoryPool.hpp.
| bool RTT::FixedSizeMemoryPool< T >::lock | ( | pointer | m | ) | [inline] |
Increase the reference count of a piece of memory.
Returns false if already released.
Definition at line 362 of file MemoryPool.hpp.
| bool RTT::FixedSizeMemoryPool< T >::unlock | ( | pointer | m | ) | [inline] |
Decrease the reference count of a piece of memory.
Returns false if already released.
Definition at line 374 of file MemoryPool.hpp.
Referenced by RTT::BufferLockFree< T, ReadPolicy, WritePolicy >::front().
1.6.3