Orxonox: orxonox::TimerBase Class Reference

# orxonox::TimerBase Class Reference

TimerBase is the parent of the Timer class. More...

`#include <src/orxonox/tools/Timer.h>`

Inheritance diagram for orxonox::TimerBase:

List of all members.

## Public Member Functions

void | addTime (float time)
| Gives the Timer some extra time.
void | deleteExecutor ()
| Deletes the executor.
float | getRemainingTime () const
| Returns the remaining time until the Timer calls the function.
bool | isActive () const
| Returns true if the Timer is active (= not stoped, not paused).
void | pauseTimer ()
| Pauses the Timer - it will continue with the actual state if you unpause it.
void | removeTime (float time)
| Decreases the remaining time of the Timer.
void | run () const
| Executes the executor.
void | setInterval (float interval)
| Sets the interval of the Timer.
void | setLoop (bool bLoop)
| Sets bLoop to a given value.
void | startTimer ()
| Starts the Timer: Function-call after 'interval' seconds.
void | stopTimer ()
| Stops the Timer.
void | tick (const Clock &time)
| Updates the timer before the frames are rendered.
void | unpauseTimer ()
| Unpauses the Timer - continues with the given state.
| ~TimerBase ()
| Deletes the executor.

## Protected Member Functions

| TimerBase ()
| Constructor: Sets the default-values.

## Protected Attributes

bool | bActive_
| If true, the Timer ticks and calls the function if the time's up.
bool | bKillAfterCall_
| If true the timer gets deleted after it called the function.
bool | bLoop_
| If true, the function gets called every 'interval' seconds.
Executor * | executor_
| The executor of the function that should be called when the time expires.
long long | interval_
| The time-interval in micro seconds.
long long | time_
| Internal variable, counting the time till the next function-call.

## Detailed Description

TimerBase is the parent of the Timer class.

## Constructor & Destructor Documentation

orxonox::TimerBase::~TimerBase | ( |  | ) |

Deletes the executor.

References deleteExecutor().

orxonox::TimerBase::TimerBase | ( |  | ) | `[protected]`

Constructor: Sets the default-values.

References bActive_, bKillAfterCall_, bLoop_, executor_, interval_, RegisterObject, and time_.

## Member Function Documentation

void orxonox::TimerBase::addTime | ( | float | time | ) | `[inline]`

Gives the Timer some extra time.

Parameters:

  | time | The amount of extra time in seconds

void orxonox::TimerBase::deleteExecutor | ( |  | ) |

Deletes the executor.

References executor_.

Referenced by orxonox::StaticTimer::setTimer(), orxonox::Timer< orxonox::FadeoutText >::setTimer(), and ~TimerBase().

float orxonox::TimerBase::getRemainingTime | ( |  | ) | const`[inline]`

Returns the remaining time until the Timer calls the function.

Returns:
  The remaining time

bool orxonox::TimerBase::isActive | ( | void |  | ) | const`[inline]`

Returns true if the Timer is active (= not stoped, not paused).

Returns:
  True = Time is active

void orxonox::TimerBase::pauseTimer | ( |  | ) | `[inline]`

Pauses the Timer - it will continue with the actual state if you unpause it.

void orxonox::TimerBase::removeTime | ( | float | time | ) | `[inline]`

Decreases the remaining time of the Timer.

Parameters:

  | time | The amount of time to remove

void orxonox::TimerBase::run | ( |  | ) | const

Executes the executor.

References bKillAfterCall_, and executor_.

Referenced by tick().

void orxonox::TimerBase::setInterval | ( | float | interval | ) | `[inline]`

Sets the interval of the Timer.

Parameters:

  | interval | The interval

Referenced by orxonox::StaticTimer::setTimer(), and orxonox::Timer< orxonox::FadeoutText >::setTimer().

void orxonox::TimerBase::setLoop | ( | bool | bLoop | ) | `[inline]`

Sets bLoop to a given value.

Parameters:

  | bLoop | True = loop

void orxonox::TimerBase::startTimer | ( |  | ) | `[inline]`

Starts the Timer: Function-call after 'interval' seconds.

void orxonox::TimerBase::stopTimer | ( |  | ) | `[inline]`

Stops the Timer.

Referenced by tick().

void orxonox::TimerBase::tick | ( | const Clock & | time | ) |

Updates the timer before the frames are rendered.

References bActive_, bKillAfterCall_, bLoop_, orxonox::Clock::getDeltaTimeMicroseconds(), orxonox::TimeFactorListener::getTimeFactor(), interval_, run(), stopTimer(), and time_.

void orxonox::TimerBase::unpauseTimer | ( |  | ) | `[inline]`

Unpauses the Timer - continues with the given state.

## Member Data Documentation

bool orxonox::TimerBase::bActive_`[protected]`

If true, the Timer ticks and calls the function if the time's up.

Referenced by orxonox::StaticTimer::setTimer(), orxonox::Timer< orxonox::FadeoutText >::setTimer(), tick(), and TimerBase().

bool orxonox::TimerBase::bKillAfterCall_`[protected]`

If true the timer gets deleted after it called the function.

Referenced by run(), orxonox::StaticTimer::setTimer(), orxonox::Timer< orxonox::FadeoutText >::setTimer(), tick(), and TimerBase().

bool orxonox::TimerBase::bLoop_`[protected]`

If true, the function gets called every 'interval' seconds.

Referenced by orxonox::StaticTimer::setTimer(), orxonox::Timer< orxonox::FadeoutText >::setTimer(), tick(), and TimerBase().

Executor* orxonox::TimerBase::executor_`[protected]`

The executor of the function that should be called when the time expires.

Referenced by deleteExecutor(), run(), orxonox::StaticTimer::setTimer(), orxonox::Timer< orxonox::FadeoutText >::setTimer(), and TimerBase().

long long orxonox::TimerBase::interval_`[protected]`

The time-interval in micro seconds.

Referenced by orxonox::StaticTimer::setTimer(), orxonox::Timer< orxonox::FadeoutText >::setTimer(), tick(), and TimerBase().

long long orxonox::TimerBase::time_`[protected]`

Internal variable, counting the time till the next function-call.

Referenced by orxonox::StaticTimer::setTimer(), orxonox::Timer< orxonox::FadeoutText >::setTimer(), tick(), and TimerBase().

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

- src/orxonox/tools/Timer.h
- src/orxonox/tools/Timer.cc