Orxonox: src/orxonox/tools/Timer.h File Reference

# Timer.h File Reference

Definition and Implementation of the Timer class. More...

`#include "OrxonoxPrereqs.h"`
`#include "core/Executor.h"`
`#include "core/OrxonoxClass.h"`
`#include "interfaces/TimeFactorListener.h"`

## Namespaces

namespace | orxonox

## Classes

class | orxonox::StaticTimer
| The StaticTimer is a callback-object, calling a static function after a given time-interval. More...
class | orxonox::Timer< T >
| The Timer is a callback-object, calling a given function after a given time-interval. More...
class | orxonox::TimerBase
| TimerBase is the parent of the Timer class. More...

## Functions

void | orxonox::delay (float delay, const std::string &command)
| Calls a console command after 'delay' seconds.
void | orxonox::executeDelayedCommand (StaticTimer *timer, const std::string &command)
| Executes the command.
void | orxonox::killdelays ()
| Kills all delayed commands.

## Detailed Description

Definition and Implementation of the Timer class.

The Timer is a callback-object, calling a given function after a given time-interval.

Usage: header.h: class ClassName { public: ClassName(); void functionName(); Timer<ClassName> myTimer; };

source.cc: include "core/Executor.h"

ClassName::ClassName() { myTimer.setTimer(interval_in_seconds, bLoop, this, createExecutor(createFunctor(&ClassName::functionName))); }

void ClassName::functionName() { whateveryouwant(); something(else); }