|
Gaudi Framework, version v23r1 |
| Home | Generated: Wed Feb 29 2012 |
#include <GaudiKernel/AllocatorPool.h>

Classes | |
| class | PoolChunk |
| struct | PoolLink |
Public Member Functions | |
| AllocatorPool (unsigned int n=0) | |
| Create a pool of elements of size n. | |
| ~AllocatorPool () | |
| Destructor. Return storage to the free store. | |
| AllocatorPool (const AllocatorPool &right) | |
| Copy constructor. | |
| void * | Alloc () |
| Allocate one element. | |
| void | Free (void *b) |
| Return an element back to the pool. | |
| unsigned int | Size () const |
| Return storage size. | |
| void | Reset () |
| Return storage to the free store. | |
Private Member Functions | |
| AllocatorPool & | operator= (const AllocatorPool &right) |
| Private equality operator. | |
| void | Grow () |
| Make pool larger. | |
Private Attributes | |
| const unsigned int | esize |
| const unsigned int | csize |
| PoolChunk * | chunks |
| PoolLink * | head |
| int | nchunks |
Allocator pool.
Class is imported from Geant4 project
Definition at line 65 of file AllocatorPool.h.
| GaudiUtils::AllocatorPool::AllocatorPool | ( | unsigned int | n = 0 ) |
[explicit] |
| GaudiUtils::AllocatorPool::~AllocatorPool | ( | ) |
Destructor. Return storage to the free store.
Definition at line 88 of file AllocatorPool.cpp.
{
Reset();
}
| GaudiUtils::AllocatorPool::AllocatorPool | ( | const AllocatorPool & | right ) |
| void * GaudiUtils::AllocatorPool::Alloc | ( | ) | [inline] |
| void GaudiUtils::AllocatorPool::Free | ( | void * | b ) | [inline] |
| void GaudiUtils::AllocatorPool::Grow | ( | ) | [private] |
Make pool larger.
Definition at line 118 of file AllocatorPool.cpp.
{
// Allocate new chunk, organize it as a linked list of
// elements of size 'esize'
//
PoolChunk* n = new PoolChunk(csize);
n->next = chunks;
chunks = n;
nchunks++;
const int nelem = csize/esize;
char* start = n->mem;
char* last = &start[(nelem-1)*esize];
for (char* p=start; p<last; p+=esize)
{
reinterpret_cast<PoolLink*>(p)->next
= reinterpret_cast<PoolLink*>(p+esize);
}
reinterpret_cast<PoolLink*>(last)->next = 0;
head = reinterpret_cast<PoolLink*>(start);
}
| GaudiUtils::AllocatorPool & GaudiUtils::AllocatorPool::operator= | ( | const AllocatorPool & | right ) | [private] |
| void GaudiUtils::AllocatorPool::Reset | ( | void | ) |
| unsigned int GaudiUtils::AllocatorPool::Size | ( | ) | const [inline] |
PoolChunk* GaudiUtils::AllocatorPool::chunks [private] |
Definition at line 113 of file AllocatorPool.h.
const unsigned int GaudiUtils::AllocatorPool::csize [private] |
Definition at line 112 of file AllocatorPool.h.
const unsigned int GaudiUtils::AllocatorPool::esize [private] |
Definition at line 111 of file AllocatorPool.h.
PoolLink* GaudiUtils::AllocatorPool::head [private] |
Definition at line 114 of file AllocatorPool.h.
int GaudiUtils::AllocatorPool::nchunks [private] |
Definition at line 115 of file AllocatorPool.h.