![]() |
Number5
Visualisierung 2 Project - Florian Schober (0828151, f.schober@live.com), Andreas Walch (0926780, walch.andreas89@gmail.com)
|
#include <IdCache.hpp>
Public Member Functions | |
IdCache () | |
TId | createId () |
void | deleteId (TId id) |
void | reset () |
Private Attributes | |
vector< TId > | m_unusedIds |
TId | m_highestId |
IdCache can be used to assign unique ids to objects. Ids that are "given back" (i.e. when the object is destructed) will be reused. 0 will never be assigned as id.
Definition at line 11 of file IdCache.hpp.
|
inline |
Constructs an IdCache.
Definition at line 20 of file IdCache.hpp.
|
inline |
Creates a new id (or pops an unused one) and returns it.
Definition at line 28 of file IdCache.hpp.
|
inline |
Gives back the passed id.
Definition at line 41 of file IdCache.hpp.
|
inline |
Resets its state to default. All used/unused ids will be forgotten.
Definition at line 50 of file IdCache.hpp.
|
private |
The next id that will be used (if there are no unused ids in the vector)
Definition at line 14 of file IdCache.hpp.
|
private |
All ids that were given back and are not in use again
Definition at line 13 of file IdCache.hpp.