#include <nstime.h>
Public Member Functions | |
bool | IsZero (void) const |
bool | IsNegative (void) const |
bool | IsPositive (void) const |
bool | IsStrictlyNegative (void) const |
bool | IsStrictlyPositive (void) const |
HighPrecision const & | GetHighPrecision (void) const |
Related Functions | |
(Note that these are not member functions.) | |
template<int N> | |
TimeUnit< N > | Abs (TimeUnit< N > const &time) |
template<int N> | |
TimeUnit< N > | Max (TimeUnit< N > const &ta, TimeUnit< N > const &tb) |
template<int N> | |
TimeUnit< N > | Min (TimeUnit< N > const &ta, TimeUnit< N > const &tb) |
This template class is used to keep track of the value of a specific time unit: the type TimeUnit<1> is used to keep track of seconds, the type TimeUnit<2> is used to keep track of seconds squared, the type TimeUnit<-1> is used to keep track of 1/seconds, etc.
This base class defines all the functionality shared by all these time unit objects: it defines all the classic arithmetic operators +, -, *, /, and all the classic comparison operators: ==, !=, <, >, <=, >=. It is thus easy to add, substract, or multiply multiple TimeUnit objects. The return type of any such arithmetic expression is always a TimeUnit object.
The ns3::Scalar, ns3::Time, ns3::TimeSquare, and ns3::TimeInvert classes are aliases for the TimeUnit<0>, TimeUnit<1>, TimeUnit<2> and TimeUnit<-1> types respectively.
For example:
Time<1> t1 = Seconds (10.0); Time<1> t2 = Seconds (10.0); Time<2> t3 = t1 * t2; Time<0> t4 = t1 / t2; Time<3> t5 = t3 * t1; Time<-2> t6 = t1 / t5; TimeSquare t7 = t3; Scalar s = t4;
If you try to assign the result of an expression which does not match the type of the variable it is assigned to, you will get a compiler error. For example, the following will not compile:
You can also use the following non-member functions to manipulate any of these ns3::TimeUnit object:
HighPrecision const & ns3::TimeUnit< N >::GetHighPrecision | ( | void | ) | const [inline] |
This is really an internal method exported for the needs of the implementation. Please, Do not try to use this method, ever.
Referenced by ns3::TimeUnit< N >::Abs(), ns3::TimeUnit< N >::Max(), and ns3::TimeUnit< N >::Min().
bool ns3::TimeUnit< N >::IsNegative | ( | void | ) | const [inline] |
bool ns3::TimeUnit< N >::IsPositive | ( | void | ) | const [inline] |
bool ns3::TimeUnit< N >::IsStrictlyNegative | ( | void | ) | const [inline] |
bool ns3::TimeUnit< N >::IsStrictlyPositive | ( | void | ) | const [inline] |
bool ns3::TimeUnit< N >::IsZero | ( | void | ) | const [inline] |
time | the input value |
References ns3::TimeUnit< N >::GetHighPrecision().
ta | the first value | |
tb | the seconds value |
References ns3::TimeUnit< N >::GetHighPrecision().
ta | the first value | |
tb | the seconds value |
References ns3::TimeUnit< N >::GetHighPrecision().