Library of Assembled Shared Sources
|
Generates sequential and unique ID's. More...
#include <id_generator.h>
Public Member Functions | |
IdGenerator (typename CallTraits< T >::TParam iFirstId=0) | |
Construct an ID generator of which iFirstId is the first ID to be generated. | |
CallTraits< T >::TValue | operator() () |
Generate an ID. | |
void | setNext (typename CallTraits< T >::TParam iNextId) |
set the next ID to be drawn. | |
Generates sequential and unique ID's.
Pretty simple. This object generates unique ID numbers, each incremented by one, starting from a given ID.
T
:T
must implement prefix increment, operator++
T
must be less-than comparable, operator<
T
must be copy-constructible Definition at line 89 of file id_generator.h.
CallTraits< T >::TValue lass::util::IdGenerator< T >::operator() | ( | ) |
Generate an ID.
Each call to this operator will give you a new ID incremented by one.
an | exception is thrown if the generator can no longer increment the id field. Since the generator stores the id that will be returned on the next call, this means the maximum id returned will be num::NumTraits<T>::max-1 |
Definition at line 76 of file id_generator.inl.