** 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:
- Default constructor, copy constructor, and assignment operator.
- All addition and subtraction operators.
- All comparison operators.
- A method
*adevs_inf* that returns a value for infinity.
- A method
*adevs_zero* that returns a value for zero.
- 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