Source: lycad_chargen/eventgenerator.h
|
|
|
|
/***************************************************************************
eventgenerator.h - description
-------------------
begin : Tue Nov 13 2001
copyright : (C) 2001 by Sheldon Lee Wen
email : tormak@home.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef EVENTGENERATOR_H
#define EVENTGENERATOR_H
#include "event.h"
#include "eventlistener.h"
#include "staticdata.h"
#include /* STL vector class */
//class eventListener;
//class event;
/**
event_generator - This class should not be instantiated.
Base class for all event generators. A new class should be derived for
every event type, the class has to define a fire****Event(event *evt)
function for the intended event type. I.e. an EVENT_WEATHER event generator
would need to supply a fireWeatherEvent(event evt) function that will
cycle through the listeners and call the corresponding handleWeatherEvent()
functions. All this just to allow objects to generate/handle different
types of events without huge case statements.
The fire***Event() method should also set the message source before sending
it off
*@author Rob Boyd email: rboyd@telusplanet.net
*/
/*
class event_generator {
protected:
EVENT_TYPE type; // for keeping track of the type of events being generated
// NEEDs in derived classes
// vector ****Listeners;
public:
event_generator() { type = EVENT_UNDEFINED; }
virtual ~event_generator() {};
// public methods
EVENT_TYPE getGeneratorType() { return type; }
// NEED to be declared in derived classes
// void add****Listener(event_listener *l);
// void remove****Listener(event_listener *l);
// void fire****Event(event evt);
private:
// int find****Listener(event_listener *l);
};
*/
/*
class eventGenerator {
public:
eventGenerator() { type = EVENT_UNDEFINED; }
virtual ~eventGenerator() {};
EVENT_TYPE getGeneratorType() { return type; }
// NEED to be declared in derived classes
virtual void addEventListener(eventListener *l) =0;
virtual void removeEventListener(eventListener *l) =0;
virtual void fireEvent(event *evt) =0;
protected:
EVENT_TYPE type; // for keeping track of the type of events being generated
vector eventListeners;
private:
virtual int findEventListener(eventListener *l);
};
*/
#endif
Generated by: sheldonl on cr595811-a on Fri Nov 30 10:24:34 2001, using kdoc 2.0a53. |