The IndexGenerator class allows to generate unique ids. More...
Public Types | |
typedef id_t | id_type |
Public Member Functions | |
IndexGenerator () | |
void | dump (std::ostream &stream) const |
id_type | generate () |
id_type | getHighest () |
id_type | getLatest () |
bool | isAssigned (id_type id) |
void | reset () |
void | restore (std::istream &stream) |
void | setAssigned (id_type id) |
void | trash (id_type id) |
Static Public Attributes | |
static BITPIT_PUBLIC_API const id_type | NULL_ID = std::numeric_limits<typename IndexGenerator<id_t>::id_type>::min() |
The IndexGenerator class allows to generate unique ids.
Definition at line 39 of file index_generator.hpp.
typedef id_t bitpit::IndexGenerator< id_t >::id_type |
Definition at line 45 of file index_generator.hpp.
bitpit::IndexGenerator< id_t >::IndexGenerator | ( | ) |
Creates a new generator.
Definition at line 37 of file index_generator.tpp.
void bitpit::IndexGenerator< id_t >::dump | ( | std::ostream & | stream | ) | const |
Write the index generator to the specified stream.
stream | is the stream to write to |
Definition at line 280 of file index_generator.tpp.
IndexGenerator< id_t >::id_type bitpit::IndexGenerator< id_t >::generate | ( | ) |
Generates a unique index.
If the trash is empty a new index is generated, otherwise an index taken from the trash is recycled.
Definition at line 52 of file index_generator.tpp.
IndexGenerator< id_t >::id_type bitpit::IndexGenerator< id_t >::getHighest | ( | ) |
Gets the highest assigned id.
Definition at line 94 of file index_generator.tpp.
IndexGenerator< id_t >::id_type bitpit::IndexGenerator< id_t >::getLatest | ( | ) |
Gets the latest assigned id.
Definition at line 83 of file index_generator.tpp.
bool bitpit::IndexGenerator< id_t >::isAssigned | ( | id_type | id | ) |
Checks if an id is currently assigned.
Definition at line 105 of file index_generator.tpp.
void bitpit::IndexGenerator< id_t >::reset | ( | ) |
Reset the generator.
Definition at line 242 of file index_generator.tpp.
void bitpit::IndexGenerator< id_t >::restore | ( | std::istream & | stream | ) |
Restore the index generator from the specified stream.
stream | is the stream to read from |
Definition at line 299 of file index_generator.tpp.
void bitpit::IndexGenerator< id_t >::setAssigned | ( | id_type | id | ) |
Marks the specified id as currently assigned.
id | is the id to be marked as assigned |
Definition at line 136 of file index_generator.tpp.
void bitpit::IndexGenerator< id_t >::trash | ( | id_type | id | ) |
Trashes an index.
A trashed index is an index no more used that can be recycled.
id | is the index that will be trashed |
Definition at line 182 of file index_generator.tpp.
|
static |
Definition at line 47 of file index_generator.hpp.