next up previous contents
Next: Random Numbers Up: A Discrete EVent system Previous: Models with Many Input/Output   Contents


Alternate types for time

The second template argument for the simulator and model classes is used to select an alternate representation of time for your simulation. The default type for time is double. This may be replaced with the primitive types int or the Adevs class double_fcmp by supplying those as the second template argument. If you want to use your own class for time, it must support the following:
  1. Default constructor, copy constructor, and assignment operator.
  2. All addition and subtraction operators.
  3. All comparison operators.
  4. A method adevs_inf that returns a value for infinity.
  5. A method adevs_zero that returns a value for zero.
  6. A method adevs_sentinel that returns a value less than zero.
The three methods adevs_inf, adevs_zero, and adevs_sentinel must be template functions defined as follows (these examples are for using the int primitive for time).
template <> inline int adevs_inf() {
    return std::numeric_limits<double>::max(); }
template <> inline int adevs_zero() { return 0; }
template <> inline int adevs_sentinel() { return -1; }


rotten 2014-02-19