feisty meow concerns codebase
2.140
|
Maintains a pseudo-unique identifier number and issues a new one on demand. More...
#include <roller.h>
Public Member Functions | |
roller (contents start_of_range, contents end_of_range) | |
constructs a roller between the start and end ranges. More... | |
~roller () | |
contents | minimum () |
the smallest value that the roller can have. More... | |
contents | maximum () |
the outer limit of the roller; it should never reach this. More... | |
contents | next_id () |
returns a unique (per instance of this type) id. More... | |
contents | current () const |
returns the current id to be used; be careful! More... | |
void | set_current (contents new_current) |
allows the current id to be manipulated. More... | |
Maintains a pseudo-unique identifier number and issues a new one on demand.
The unique id is templated on the type of identifier, but the type used must support: 1) assigment to a value, 2) a greater than or equal operator (>=), and 3) the increment operator (++). Zero is often treated as the invalid / empty / inactive identifier, but roller does not prevent its use since some ranges might need to bridge between negative and positive numbers.
structures::roller< contents >::roller | ( | contents | start_of_range, |
contents | end_of_range | ||
) |
constructs a roller between the start and end ranges.
this constructs a roller that runs from the value "start_of_range" and will stay smaller than "end_of_range" (unless the initial parameters are screwed up; this class doesn't validate the start and end of range). when the roller hits the end of range, then its value is reset to the "start_of_range" again.
structures::roller< contents >::~roller |
contents structures::roller< contents >::current |
returns the current id to be used; be careful!
this value will be the next one returned, so only look at the current id and don't use it unwisely. this function is useful if you want to assign an id provisionally but might not want to complete the issuance of it.
Definition at line 102 of file roller.h.
Referenced by processes::safe_roller::current(), configuration::ini_roller::current_id(), configuration::ini_roller::ini_roller(), configuration::ini_roller::next_id(), and configuration::ini_roller::~ini_roller().
|
inline |
the outer limit of the roller; it should never reach this.
Definition at line 51 of file roller.h.
Referenced by configuration::ini_roller::next_id().
|
inline |
contents structures::roller< contents >::next_id |
returns a unique (per instance of this type) id.
Definition at line 105 of file roller.h.
Referenced by processes::thread_cabinet::add_thread(), configuration::ini_roller::next_id(), processes::safe_roller::next_id(), and cromp::cromp_client::next_id().
void structures::roller< contents >::set_current | ( | contents | new_current | ) |
allows the current id to be manipulated.
this must be done with care lest existing ids be re-used.
Definition at line 94 of file roller.h.
Referenced by configuration::ini_roller::ini_roller(), cromp::cromp_client::reset(), and processes::safe_roller::set_current().