NumberGen Class Reference

#include <NumberGen.h>

List of all members.


Detailed Description

The NumberGen class provides a key based map for generating incremental values.

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 NumberGenInstance (mace::string index)
 returns the number generator for the given index

The documentation for this class was generated from the following files:

Generated on Sat Oct 4 21:30:29 2008 for Mace Library by  doxygen 1.5.5