#include <OTC/dispatch/event.hh> class OTC_Event {
public:
inline void* operator new(size_t theSize);
virtual void* type() const = 0;
void deliver(OTC_EVAgent* theAgent);
void deliver(int theAgentId);
void queue(int theAgentId);
virtual OTC_Event* clone();
void destroy();
virtual void dump(ostream& outs) const = 0;
friend ostream& operator<<( ostream& outs, OTC_Event const& theEvent );
protected:
virtual void cancelSource(int theAgentId);
inline void operator delete(void* theMem, size_t theSize);
inline OTC_Event();
virtual ~OTC_Event();
};
OTC_Event
is the base class for any event objects, which are
to be delivered to an agent.
Space for derived classes will be allocated from OTC_CommonPool
.
virtual void* type() const = 0;
void*
which uniquely
identifies the event type. Normally,
a pointer to a static member variable
of a derived class would be used as the
return value.
void deliver(OTC_EVAgent* theAgent);
theAgent
immediately. No attempt should be made to
use the event object after calling this
function, as the agent probably will
have destroyed the event object.
void deliver(int theAgentId);
theAgentId
immediately. No attempt
should be made to use the event object
after calling this function, as the agent
probably will have destroyed the event
object.
void queue(int theAgentId);
theAgentId
.
virtual OTC_Event* clone();
void destroy();
virtual void dump(ostream& outs) const = 0;
outs
a representation of the
event for debugging purposes. This
function will be called to dump out
information about an event if it has to be
discarded.
friend ostream& operator<<(ostream& outs, OTC_Event const& theEvent);
theEvent
onto the stream outs
.
virtual void cancelSource(int theAgentId);
theAgentId
, when an event
is being discarded because the agent does
not exist. A derived event should override
this function to cancel the subscription
which caused the event to occur so that it
will not keep reoccuring.
OTC_CommonPool
, OTC_EVAgent
, OTC_Dispatcher