- Base class for receiving and processing events output by an engine
#include <ECS/EventReceiver.hh>
class ECS_EventReceiver
{
public:
_ECSAIO_PRIVAPI ECS_EventReceiver();
_ECSAIO_PRIVAPI ECS_EventReceiver(const ECS_EventFilter& filter);
_ECSAIO_PRIVAPI virtual ~ECS_EventReceiver();
_ECSAIO_PRIVAPI virtual ostream& print(ostream& os) const;
_ECSAIO_PRIVAPI int32 connectToEngine(int32 instanceId);
_ECSAIO_PRIVAPI int32 disconnectFromEngine(int32 instanceId);
_ECSAIO_PRIVAPI ECS_EventFilter getFilter() const;
_ECSAIO_PRIVAPI int32 setFilter(const ECS_EventFilter& filter);
_ECSAIO_PRIVAPI int32 clearFilter();
_ECSAIO_PRIVAPI virtual int32 handleEvent
(
const ECS_Event& event,
const char* streamName
) = 0;
};
Abstract Base
ECS Application Developers
This class provides the interface to which all classes that register to receive events from an engine must conform.
It also provides some private methods used for management of the interface.
Application developers are expected to create a subclass of this class which overrides the method handleEvent() to provide the behavior that their application requires.
The events which are received by an instance of this class (or any subclass) can be constrained by applying a filter (see setFilter()).
It is recommended that the filter be set prior to adding the EventReceiver to the engine, otherwise unwanted events could be received if any events are output by the engine before the filter is set.
The filter will apply to the output of all engines with which the instance is registered. If multiple filters are required then separate instances must be used.
ECS_EventFilter filter1("mdl", "syntax1");
ECS_EventFilter filter2("mdl", "syntax2");
ECS_EventReceiver rec1;
ECS_EventReceiver rec2;
rec1.setFilter(filter1);
rec1.setFilter(filter2);
ECS_Engine engine(1);
engine.addEventReceiver(rec1);
engine.addEventReceiver(rec2);
ECS::mainloop();
rec1will receive events with event syntax "syntax1" and rec2 will receive events with "syntax2".
_ECSAIO_PRIVAPI ECS_EventReceiver();
_ECSAIO_PRIVAPI ECS_EventReceiver(const ECS_EventFilter& filter);
_ECSAIO_PRIVAPI virtual ~ECS_EventReceiver();
_ECSAIO_PRIVAPI virtual ostream& print(ostream& os) const;
os.
_ECSAIO_PRIVAPI int32 connectToEngine(int32 instanceId);
_ECSAIO_PRIVAPI int32 disconnectFromEngine(int32 instanceId);
_ECSAIO_PRIVAPI ECS_EventFilter getFilter() const;
_ECSAIO_PRIVAPI int32 setFilter(const ECS_EventFilter& filter);
The filter applies to all engines from which this instance of ECS_EventReceiver receives events.
_ECSAIO_PRIVAPI int32 clearFilter();
_ECSAIO_PRIVAPI virtual int32 handleEvent
(
const ECS_Event& event,
const char* streamName
) = 0;
None
ECS_EventFilter
ECS
1.5
1998/02/25
Hewlett-Packard Company
Copyright (c) 1997 Hewlett-Packard Company. All Rights Reserved.