Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PG_TimerObject Class Reference

A class to handle periodical timers. More...

#include <pgtimerobject.h>

Inheritance diagram for PG_TimerObject:

Inheritance graph
[legend]
List of all members.

Public Types

typedef unsigned long ID

Public Member Functions

 PG_TimerObject ()
 Constructor of the PG_TimerObject class.
virtual ~PG_TimerObject ()
PG_TimerObject::ID AddTimer (Uint32 interval)
 Add a timer to the object.
bool RemoveTimer (PG_TimerObject::ID id)
 Remove a timer.
int SetTimer (Uint32 interval)
void StopTimer ()
virtual Uint32 eventTimer (PG_TimerObject::ID id, Uint32 interval)
 timer event handler
virtual Uint32 eventTimer (Uint32 interval)

Public Attributes

SignalTimer sigTimer

Classes

class  SignalTimer
 Signal type declaration. More...

Detailed Description

A class to handle periodical timers.

Author:
Alexander Pipelka
This class encapsulates the SDL_AddTimer, SDL_RemoveTimer functions.

Definition at line 49 of file pgtimerobject.h.


Member Typedef Documentation

typedef unsigned long PG_TimerObject::ID
 

Definition at line 53 of file pgtimerobject.h.


Constructor & Destructor Documentation

PG_TimerObject::PG_TimerObject  ) 
 

Constructor of the PG_TimerObject class.

The constructor also calls SDL_InitSubSystem(SDL_Timer) to enable the SDL timer subsystem.

Definition at line 8 of file pgtimerobject.cpp.

PG_TimerObject::~PG_TimerObject  )  [virtual]
 

Definition at line 17 of file pgtimerobject.cpp.

References RemoveTimer(), and StopTimer().


Member Function Documentation

PG_TimerObject::ID PG_TimerObject::AddTimer Uint32  interval  ) 
 

Add a timer to the object.

Parameters:
interval timer intervall in ms
Returns:
id of the timer
You can add any number of timers to an object. After the timer-interval the virtual function eventTimer(PG_TimerObject::ID id, Uint32 interval) will be called

Definition at line 39 of file pgtimerobject.cpp.

Uint32 PG_TimerObject::eventTimer Uint32  interval  )  [virtual]
 

Definition at line 71 of file pgtimerobject.cpp.

Uint32 PG_TimerObject::eventTimer PG_TimerObject::ID  id,
Uint32  interval
[virtual]
 

timer event handler

Parameters:
id id of the elapsed timer
interval timer interval
Returns:
should return the interval of the next timer event

Definition at line 67 of file pgtimerobject.cpp.

bool PG_TimerObject::RemoveTimer PG_TimerObject::ID  id  ) 
 

Remove a timer.

Parameters:
id id of the timer to remove

Definition at line 56 of file pgtimerobject.cpp.

Referenced by ~PG_TimerObject().

int PG_TimerObject::SetTimer Uint32  interval  ) 
 

Definition at line 104 of file pgtimerobject.cpp.

References StopTimer().

void PG_TimerObject::StopTimer  ) 
 

Definition at line 114 of file pgtimerobject.cpp.

Referenced by SetTimer(), and ~PG_TimerObject().


Member Data Documentation

SignalTimer PG_TimerObject::sigTimer
 

Definition at line 105 of file pgtimerobject.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:19:39 2008 for Advanced Strategic Command by  doxygen 1.4.2