#include <NumberGen.h>
Common usage:
registration_uid_t rid1 = NumberGen::Instance("registration_uid_t")->GetVal(); registration_uid_t rid2 = NumberGen::Instance("registration_uid_t")->GetVal(); registration_uid_t rid3 = NumberGen::Instance("registration_uid_t")->GetVal(); registration_uid_t rid4 = NumberGen::Instance("registration_uid_t")->GetVal();
Each call to GetVal returns a new value, incremented from the last call. Each index string is a different series. If the index string is also a parameter set, it is used as the initial value. Otherwise, DEFAULT_BASE is used.
When simulating, the node number is appended to the index, to ensure each node gets a different series.
NumberGen is used for registration uids and port offsets.
Definition at line 69 of file NumberGen.h.
Public Member Functions | |
unsigned | GetVal () |
returns the next value in the series. | |
Static Public Member Functions | |
static void | Reset () |
Use only in the modelchecker/simulator. Clears all number gen values. | |
static void | Reset (const mace::string &index) |
clears a specific number gen value. Used only in the modelchecker/simulator. | |
static NumberGen * | Instance (mace::string index) |
returns the number generator for the given index |