library of assembled shared sources |
http://lass.cocamware.com |
#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. | |
Private Attributes | |
CallTraits< T >::TValue | nextId_ |
IdGenerator<unsigned> generator; LASS_COUT << generator() << "\n"; // will print '0' LASS_COUT << generator() << "\n"; // will print '1' LASS_COUT << generator() << "\n"; // will print '2' LASS_COUT << generator() << "\n"; // will print '3' ...
T
:T
must implement prefix increment, operator++
T
must be less-than comparable, operator<
T
must be copy-constructible Definition at line 87 of file id_generator.h.
lass::util::IdGenerator< T >::IdGenerator | ( | typename CallTraits< T >::TParam | iFirstId = 0 |
) | [inline] |
Construct an ID generator of which iFirstId is the first ID to be generated.
Definition at line 62 of file id_generator.inl.
CallTraits< T >::TValue lass::util::IdGenerator< T >::operator() | ( | ) | [inline] |
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.
References LASS_THROW, and lass::util::IdGenerator< T >::nextId_.
void lass::util::IdGenerator< T >::setNext | ( | typename CallTraits< T >::TParam | iNextId | ) | [inline] |
set the next ID to be drawn.
Definition at line 92 of file id_generator.inl.
References lass::util::IdGenerator< T >::nextId_.
CallTraits<T>::TValue lass::util::IdGenerator< T >::nextId_ [private] |
Definition at line 99 of file id_generator.h.
Referenced by lass::util::IdGenerator< T >::operator()(), and lass::util::IdGenerator< T >::setNext().
Generated on Mon Nov 10 14:22:17 2008 for Library of Assembled Shared Sources by 1.5.7.1 |