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 |
Detailed Description
class bitpit::IndexGenerator< id_t >
The IndexGenerator class allows to generate unique ids.
Definition at line 39 of file index_generator.hpp.
Member Typedef Documentation
◆ id_type
typedef id_t bitpit::IndexGenerator< id_t >::id_type |
Definition at line 45 of file index_generator.hpp.
Constructor & Destructor Documentation
◆ IndexGenerator()
bitpit::IndexGenerator< id_t >::IndexGenerator | ( | ) |
Creates a new generator.
Definition at line 37 of file index_generator.tpp.
Member Function Documentation
◆ dump()
void bitpit::IndexGenerator< id_t >::dump | ( | std::ostream & | stream | ) | const |
Write the index generator to the specified stream.
- Parameters
-
stream is the stream to write to
Definition at line 280 of file index_generator.tpp.
◆ generate()
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.
- Returns
- A new unique index.
Definition at line 52 of file index_generator.tpp.
◆ getHighest()
IndexGenerator< id_t >::id_type bitpit::IndexGenerator< id_t >::getHighest | ( | ) |
Gets the highest assigned id.
- Returns
- The highest assigned index.
Definition at line 94 of file index_generator.tpp.
◆ getLatest()
IndexGenerator< id_t >::id_type bitpit::IndexGenerator< id_t >::getLatest | ( | ) |
Gets the latest assigned id.
- Returns
- The latest assigned index.
Definition at line 83 of file index_generator.tpp.
◆ isAssigned()
bool bitpit::IndexGenerator< id_t >::isAssigned | ( | id_type | id | ) |
Checks if an id is currently assigned.
- Returns
- True if the id has already been assigned, false otherwise.
Definition at line 105 of file index_generator.tpp.
◆ reset()
void bitpit::IndexGenerator< id_t >::reset | ( | ) |
Reset the generator.
Definition at line 242 of file index_generator.tpp.
◆ restore()
void bitpit::IndexGenerator< id_t >::restore | ( | std::istream & | stream | ) |
Restore the index generator from the specified stream.
- Parameters
-
stream is the stream to read from
Definition at line 299 of file index_generator.tpp.
◆ setAssigned()
void bitpit::IndexGenerator< id_t >::setAssigned | ( | id_type | id | ) |
Marks the specified id as currently assigned.
- Parameters
-
id is the id to be marked as assigned
Definition at line 136 of file index_generator.tpp.
◆ trash()
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.
- Parameters
-
id is the index that will be trashed
Definition at line 182 of file index_generator.tpp.
Member Data Documentation
◆ NULL_ID
|
static |
Definition at line 47 of file index_generator.hpp.
The documentation for this class was generated from the following files:
- src/IO/index_generator.hpp
- src/IO/index_generator.tpp
