eq::base::IDPool Class Reference

A identifier pool. More...

#include <idPool.h>

Inheritance diagram for eq::base::IDPool:

Inheritance graph
[legend]
Collaboration diagram for eq::base::IDPool:

Collaboration graph
[legend]

List of all members.

Classes

struct  Block

Public Types

enum  MaxCapacity { MAX_CAPACITY = 0xfffffff0u }

Public Member Functions

 IDPool (const uint32_t initialCapacity)
 Construct a new identifier pool.
 ~IDPool ()
 Destruct the identifier pool.
uint32_t genIDs (const uint32_t range)
 Generate a new, consecutive block of identifiers.
void freeIDs (const uint32_t start, const uint32_t range)
 Release a block of previously generated identifiers.


Detailed Description

A identifier pool.

Manages re-usable, unique identifiers. Can allocate up to MAX_CAPACITY identifiers. Used in Equalizer for session-unique object identifiers. Access to the identifier pool is thread-safe.

Definition at line 42 of file idPool.h.


Constructor & Destructor Documentation

eq::base::IDPool::IDPool ( const uint32_t  initialCapacity  ) 

Construct a new identifier pool.

Parameters:
initialCapacity the initial capacity of the pool, the identifiers from initialCapacity to MAX_CAPACITY are considered as allocated.

Definition at line 33 of file idPool.cpp.

eq::base::IDPool::~IDPool (  ) 

Destruct the identifier pool.

Definition at line 46 of file idPool.cpp.


Member Function Documentation

uint32_t eq::base::IDPool::genIDs ( const uint32_t  range  ) 

Generate a new, consecutive block of identifiers.

Parameters:
range The number of identifiers to allocate
Returns:
the first identifier of the block, or EQ_ID_INVALID if no block of size range is available.

Definition at line 62 of file idPool.cpp.

Referenced by eq::net::Session::genIDs().

Here is the caller graph for this function:

void eq::base::IDPool::freeIDs ( const uint32_t  start,
const uint32_t  range 
)

Release a block of previously generated identifiers.

Parameters:
start the first identifier of the block.
range the number of consecutive identifiers.

Definition at line 99 of file idPool.cpp.

Referenced by eq::net::Session::freeIDs().

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Mon Aug 10 18:58:43 2009 for Equalizer 0.9 by  doxygen 1.5.8