- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# CoinTimer Class Reference

This class implements a timer that also implements a tracing functionality. More...

`#include <CoinTime.hpp>`

List of all members.

## Public Member Functions
| CoinTimer ()
| Default constructor creates a timer with no time limit and no tracing.
| CoinTimer (double lim)
| Create a timer with the given time limit and with no tracing.
void | restart ()
| Restart the timer (keeping the same time limit).
void | reset ()
| An alternate name for `restart()`.
void | reset (double lim)
| Reset (and restart) the timer and change its time limit.
bool | isPastPercent (double pct) const
| Return whether the given percentage of the time limit has elapsed since the timer was started.
bool | isPast (double lim) const
| Return whether the given amount of time has elapsed since the timer was started.
bool | isExpired () const
| Return whether the originally specified time limit has passed since the timer was started.
double | timeLeft () const
| Return how much time is left on the timer.
double | timeElapsed () const
| Return how much time has elapsed.
void | setLimit (double l)
## Private Member Functions
bool | evaluate (const bool b_tmp) const
double | evaluate (const double d_tmp) const
## Private Attributes
double | start
| When the timer was initialized/reset/restarted.
double | limit
double | end

## Detailed Description

This class implements a timer that also implements a tracing functionality.

The timer stores the start time of the timer, for how much time it was set to and when does it expire (start + limit = end). Queries can be made that tell whether the timer is expired, is past an absolute time, is past a percentage of the length of the timer. All times are given in seconds, but as double numbers, so there can be fractional values.

The timer can also be initialized with a stream and a specification whether to write to or read from the stream. In the former case the result of every query is written into the stream, in the latter case timing is not tested at all, rather the supposed result is read out from the stream. This makes it possible to exactly retrace time sensitive program execution.

Definition at line 195 of file CoinTime.hpp.

## Constructor & Destructor Documentation

CoinTimer::CoinTimer | ( |  | ) | `[inline]`

Default constructor creates a timer with no time limit and no tracing.

Definition at line 240 of file CoinTime.hpp.

CoinTimer::CoinTimer | ( | double | lim | ) | `[inline]`

Create a timer with the given time limit and with no tracing.

Definition at line 248 of file CoinTime.hpp.

## Member Function Documentation

bool CoinTimer::evaluate | ( | const bool | b_tmp | ) | const`[inline, private]`

Definition at line 230 of file CoinTime.hpp.

Referenced by isExpired(), isPast(), isPastPercent(), timeElapsed(), and timeLeft().

double CoinTimer::evaluate | ( | const double | d_tmp | ) | const`[inline, private]`

Definition at line 233 of file CoinTime.hpp.

void CoinTimer::restart | ( |  | ) | `[inline]`

Restart the timer (keeping the same time limit).

Definition at line 270 of file CoinTime.hpp.

References CoinCpuTime(), end, limit, and start.

Referenced by reset().

void CoinTimer::reset | ( |  | ) | `[inline]`

An alternate name for `restart()`.

Definition at line 272 of file CoinTime.hpp.

References restart().

void CoinTimer::reset | ( | double | lim | ) | `[inline]`

Reset (and restart) the timer and change its time limit.

Definition at line 274 of file CoinTime.hpp.

References limit, and restart().

bool CoinTimer::isPastPercent | ( | double | pct | ) | const`[inline]`

Return whether the given percentage of the time limit has elapsed since the timer was started.

Definition at line 278 of file CoinTime.hpp.

References CoinCpuTime(), evaluate(), limit, and start.

bool CoinTimer::isPast | ( | double | lim | ) | const`[inline]`

Return whether the given amount of time has elapsed since the timer was started.

Definition at line 283 of file CoinTime.hpp.

References CoinCpuTime(), evaluate(), and start.

bool CoinTimer::isExpired | ( |  | ) | const`[inline]`

Return whether the originally specified time limit has passed since the timer was started.

Definition at line 288 of file CoinTime.hpp.

References CoinCpuTime(), end, and evaluate().

double CoinTimer::timeLeft | ( |  | ) | const`[inline]`

Return how much time is left on the timer.

Definition at line 293 of file CoinTime.hpp.

References CoinCpuTime(), end, and evaluate().

double CoinTimer::timeElapsed | ( |  | ) | const`[inline]`

Return how much time has elapsed.

Definition at line 298 of file CoinTime.hpp.

References CoinCpuTime(), evaluate(), and start.

void CoinTimer::setLimit | ( | double | l | ) | `[inline]`

Definition at line 302 of file CoinTime.hpp.

References limit.

## Member Data Documentation

double CoinTimer::start`[private]`

When the timer was initialized/reset/restarted.

Definition at line 199 of file CoinTime.hpp.

Referenced by isPast(), isPastPercent(), restart(), and timeElapsed().

double CoinTimer::limit`[private]`

Definition at line 201 of file CoinTime.hpp.

Referenced by isPastPercent(), reset(), restart(), and setLimit().

double CoinTimer::end`[private]`

Definition at line 202 of file CoinTime.hpp.

Referenced by isExpired(), restart(), and timeLeft().

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

- /home/coin/SVN-release/Bcps-0.91.0/CoinUtils/src/CoinTime.hpp