eq::base::IDPool Class Reference

An 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 = EQ_ID_MAX }

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

An 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 43 of file idPool.h.


Member Enumeration Documentation

Enumerator:
MAX_CAPACITY 

The maximum capacity of the pool.

Definition at line 46 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.
Version:
1.0

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 the range is available.
Version:
1.0

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.
Version:
1.0

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 Sat Feb 6 13:07:58 2010 for Equalizer 0.9.1 by  doxygen 1.6.1