ardour
Public Member Functions | Protected Attributes | Private Attributes | List of all members
Pool Class Reference

#include <pool.h>

Inheritance diagram for Pool:
CrossThreadPool MultiAllocSingleReleasePool SingleAllocMultiReleasePool

Public Member Functions

 Pool (std::string name, unsigned long item_size, unsigned long nitems)
 
virtual ~Pool ()
 
virtual void * alloc ()
 
virtual void release (void *)
 
std::string name () const
 
guint available () const
 
guint used () const
 
guint total () const
 

Protected Attributes

RingBuffer< void * > free_list
 a list of pointers to free items within block More...
 
std::string _name
 

Private Attributes

void * block
 data storage area More...
 

Detailed Description

A pool of data items that can be allocated, read from and written to without system memory allocation or locking.

Definition at line 34 of file pool.h.

Constructor & Destructor Documentation

Pool::Pool ( std::string  name,
unsigned long  item_size,
unsigned long  nitems 
)

Definition at line 35 of file pool.cc.

Pool::~Pool ( )
virtual

Definition at line 58 of file pool.cc.

Member Function Documentation

void * Pool::alloc ( )
virtual

Allocate an item's worth of memory in the Pool by taking one from the free list.

Returns
Pointer to free item.

Reimplemented in CrossThreadPool, MultiAllocSingleReleasePool, and SingleAllocMultiReleasePool.

Definition at line 67 of file pool.cc.

guint Pool::available ( ) const
inline

Definition at line 44 of file pool.h.

std::string Pool::name ( ) const
inline

Definition at line 43 of file pool.h.

void Pool::release ( void *  ptr)
virtual

Release an item's memory by writing its location to the free list

Reimplemented in MultiAllocSingleReleasePool, and SingleAllocMultiReleasePool.

Definition at line 82 of file pool.cc.

guint Pool::total ( ) const
inline

Definition at line 46 of file pool.h.

guint Pool::used ( ) const
inline

Definition at line 45 of file pool.h.

Member Data Documentation

std::string Pool::_name
protected

Definition at line 50 of file pool.h.

void* Pool::block
private

data storage area

Definition at line 53 of file pool.h.

RingBuffer<void*> Pool::free_list
protected

a list of pointers to free items within block

Definition at line 49 of file pool.h.


The documentation for this class was generated from the following files: