| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

GaudiUtils::AllocatorPool Class Reference

Allocator pool. More...

#include <GaudiKernel/AllocatorPool.h>

Collaboration diagram for GaudiUtils::AllocatorPool:

[legend]
List of all members.

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

AllocatorPooloperator= (const AllocatorPool &right)
 Private equality operator.
void Grow ()
 Make pool larger.

Private Attributes

const unsigned int esize
const unsigned int csize
PoolChunkchunks
PoolLinkhead
int nchunks

Classes

class  PoolChunk
struct  PoolLink

Detailed Description

Allocator pool.

Class is imported from Geant4 project

Date:
2006-02-14

Definition at line 63 of file AllocatorPool.h.


Constructor & Destructor Documentation

GaudiUtils::AllocatorPool::AllocatorPool ( unsigned int  n = 0  )  [explicit]

Create a pool of elements of size n.

GaudiUtils::AllocatorPool::~AllocatorPool (  ) 

Destructor. Return storage to the free store.

GaudiUtils::AllocatorPool::AllocatorPool ( const AllocatorPool right  ) 

Copy constructor.


Member Function Documentation

void * GaudiUtils::AllocatorPool::Alloc (  )  [inline]

Allocate one element.

Definition at line 125 of file AllocatorPool.h.

00126 {
00127   if ( head==0 ) { Grow(); }
00128   PoolLink* p = head;  // return first element
00129   head = p->next;
00130   return p;
00131 }

void GaudiUtils::AllocatorPool::Free ( void *  b  )  [inline]

Return an element back to the pool.

Definition at line 138 of file AllocatorPool.h.

00139 {
00140   PoolLink* p = static_cast<PoolLink*>(b);
00141   p->next = head;        // put b back as first element
00142   head = p;
00143 }

unsigned int GaudiUtils::AllocatorPool::Size (  )  const [inline]

Return storage size.

Definition at line 150 of file AllocatorPool.h.

00151 {
00152   return nchunks*csize;
00153 }

void GaudiUtils::AllocatorPool::Reset (  ) 

Return storage to the free store.

AllocatorPool& GaudiUtils::AllocatorPool::operator= ( const AllocatorPool right  )  [private]

Private equality operator.

void GaudiUtils::AllocatorPool::Grow (  )  [private]

Make pool larger.


Member Data Documentation

const unsigned int GaudiUtils::AllocatorPool::esize [private]

Definition at line 109 of file AllocatorPool.h.

const unsigned int GaudiUtils::AllocatorPool::csize [private]

Definition at line 110 of file AllocatorPool.h.

PoolChunk* GaudiUtils::AllocatorPool::chunks [private]

Definition at line 111 of file AllocatorPool.h.

PoolLink* GaudiUtils::AllocatorPool::head [private]

Definition at line 112 of file AllocatorPool.h.

int GaudiUtils::AllocatorPool::nchunks [private]

Definition at line 113 of file AllocatorPool.h.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:57:17 2011 for GaudiKernel by doxygen 1.4.7