jubilant-funicular
|
Class for generating unique (integral) IDs. More...
#include <IDFactory.h>
Public Member Functions | |
void | clear () |
Resets this to a new IDFactory. | |
void | reset () |
Resets this to a new IDFactory. | |
T | gen_id () |
Generates a new, unused ID. | |
void | free_id (T id) |
void | free (T id) |
calls free_id | |
bool | is_free (T id) const |
Returns whether or not an id is free. | |
bool | is_in_use (T id) const |
Returns whether or not the id is in use. | |
std::size_t | get_count () const |
Returns the number of active ids. | |
T | get_last_id () const |
Returns m_last_id. | |
T | operator() () |
Calls (and returns) gen_id. | |
Private Attributes | |
std::vector< T > | m_free |
IDs that were previously active but have since been freed. | |
T | m_last_id |
The smallest id that has never been assigned. | |
Class for generating unique (integral) IDs.
Definition at line 14 of file IDFactory.h.
void nta::utils::IDFactory< T >::free_id | ( | T | id | ) |
Marks an id as free so that it can be reused
id must not already be free
Definition at line 59 of file IDFactory.h.
Referenced by nta::utils::IDFactory< SlotMapKey<> >::free(), and nta::utils::IDFactory< GenIndex< IndexType, GenType > >::free().