GG::Timer Class Reference

Timer provides a means for one or more Wnds to receive periodic notifications of the passage of time. More...

#include <Timer.h>

List of all members.

Public Attributes

FiredSignalType FiredSignal

Signal Types



typedef boost::signal< void(unsigned
int, Timer *) 
FiredSignalType )

Structors



 Timer (unsigned int interval, unsigned int start_time=0)
 ~Timer ()

Accessors



unsigned int Interval () const
bool Running () const

Mutators



void Reset (unsigned int start_time=0)
void SetInterval (unsigned int interval)
void Connect (Wnd *wnd)
void Disconnect (Wnd *wnd)
void Start ()
void Stop ()
void Update (unsigned int ticks)


Detailed Description

Timer provides a means for one or more Wnds to receive periodic notifications of the passage of time.

The rate at which the Timer fires is not realtime. That is, there are no guarantees on the interval between firings other than that a minimum of Interval() ms will have elapsed. Note that Timers do not rely on Boost signals to propagate firing messages, so a Timers's Wnd connections will survive a serialization-deserialization cycle.

Definition at line 49 of file Timer.h.


Member Typedef Documentation

typedef boost::signal<void (unsigned int, Timer*) GG::Timer::FiredSignalType)

Emitted when the timer fires.

Definition at line 53 of file Timer.h.


Constructor & Destructor Documentation

GG::Timer::Timer ( unsigned int  interval,
unsigned int  start_time = 0 
) [explicit]

Basic ctor. Takes an interval and a start time in ms; if the start time is ommitted, the start time will be immediate.

GG::Timer::~Timer (  ) 

Dtor.


Member Function Documentation

unsigned int GG::Timer::Interval (  )  const

Returns the interval in ms between firings of the timer.

bool GG::Timer::Running (  )  const

Returns true iff the timer is operating. When false, this indicates that no firings will occur until Start() is called.

void GG::Timer::Reset ( unsigned int  start_time = 0  ) 

Resets the last-firing time of the timer to start_time (in ms), or the current time if start_time is ommitted.

void GG::Timer::SetInterval ( unsigned int  interval  ) 

Sets the interval in ms between firings of the timer.

void GG::Timer::Connect ( Wnd wnd  ) 

Connects this timer to wnd, meaning that wnd will be notified when the timer fires.

void GG::Timer::Disconnect ( Wnd wnd  ) 

Disconnects this timer from wnd.

void GG::Timer::Start (  ) 

Starts the timer firing; does not reset the timer.

void GG::Timer::Stop (  ) 

Stops the timer firing until Start() is called.

void GG::Timer::Update ( unsigned int  ticks  ) 

Signals listeners iff the timer is running and the last time it fired is is more than Interval() ms ago.


Member Data Documentation

The fired signal object for this Timer.

Definition at line 79 of file Timer.h.


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

Generated on Sat Mar 26 07:08:38 2011 for GG by  doxygen 1.5.9