Adonthell  0.4
time_event_handler Class Reference

This class keeps track of time events, i.e. More...

#include <time_event_handler.h>

Inheritance diagram for time_event_handler:
Collaboration diagram for time_event_handler:

Public Member Functions

void register_event (event *evnt)
 Register a time event with the event handler. More...
 
void remove_event (event *evnt)
 Removes the given event from the event handler. More...
 
void raise_event (const event *evnt)
 Raise one or more events in case the given time matches their "alarm" time. More...
 
- Public Member Functions inherited from event_handler_base
virtual ~event_handler_base ()
 Destructor. More...
 

Detailed Description

This class keeps track of time events, i.e.

events that are raised at a certain point in (game) time. All registered events are sorted by the time they need to be raised, so that only one comparison decides upon whether an event is to be raised.

Definition at line 36 of file time_event_handler.h.

Member Function Documentation

void time_event_handler::register_event ( event evnt)
virtual

Register a time event with the event handler.

It is inserted into the vector of registered events depending on its "alarm" time. The event needs to be removed before it can be safely deleted.

Parameters
evntPointer to the event to be registered.

Implements event_handler_base.

Definition at line 69 of file time_event_handler.cc.

void time_event_handler::remove_event ( event evnt)
virtual

Removes the given event from the event handler.

Once it is no longer needed, it can be freed.

Parameters
evntPointer to the event to be removed.

Implements event_handler_base.

Definition at line 57 of file time_event_handler.cc.

void time_event_handler::raise_event ( const event evnt)
virtual

Raise one or more events in case the given time matches their "alarm" time.

When they need to be repeated, they are re-inserted into the event-vector.

Parameters
evntAn event structure with the current game time in minutes.

Implements event_handler_base.

Definition at line 30 of file time_event_handler.cc.


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