RTT::FixedSizeMemoryPool< T > Class Template Reference

A fixed size, lock-free Memory Pool with reference counted memory. More...

#include <rtt/MemoryPool.hpp>

List of all members.

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
minit
Itemmpit

Detailed Description

template<class T>
class RTT::FixedSizeMemoryPool< T >

A fixed size, lock-free Memory Pool with reference counted memory.

Parameters:
T A class type for which memory will be allocated.
See also:
MemoryPool for a flexible size memory pool.

Definition at line 266 of file MemoryPool.hpp.


Constructor & Destructor Documentation

template<class T>
RTT::FixedSizeMemoryPool< T >::FixedSizeMemoryPool ( size_type  fixed_size,
const T &  initial_value = T() 
) [inline]

Initialise the memory pool with fixed_size elements.

Parameters:
fixed_size the number of elements, must be at least 1.

Definition at line 315 of file MemoryPool.hpp.


Member Function Documentation

template<class T>
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.

template<class T>
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().


The documentation for this class was generated from the following file:
Generated on Thu Dec 23 13:22:43 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3