event.h
#ifndef XF_EVENT_H
#define XF_EVENT_H
namespace interface {
class XFBehavior;
}
class XFEvent
{
public:
typedef enum
{
Unknown = 0,
Initial = 1,
DefaultTransition = 2,
Event = 3,
Timeout = 4
} XFEventType;
public :
XFEvent(XFEventType eventType, int id = 0) : eventType_(eventType), id_(id), pBehavior_(nullptr) {}
virtual ~XFEvent() {}
inline XFEventType getEventType() const { return eventType_; }
inline interface::XFBehavior * getBehavior() const { return pBehavior_; }
inline void setBehavior(interface::XFBehavior * pBehavior) { pBehavior_ = pBehavior; }
inline int getId() const { return id_; }
virtual bool deleteAfterConsume() const { return false; }
protected:
const XFEventType eventType_;
int id_;
interface::XFBehavior * pBehavior_;
};
// end of xf_core group
#endif // XF_EVENT_H
XFBehavior
Base class for state machines, activities, process and data flows.
Definition: behavior.h:29
XFEvent
Base class for all types of events and timeouts.
Definition: event.h:23
XFEvent::pBehavior_
interface::XFBehavior * pBehavior_
Pointer to behavioral class (ex. state-machine) processing the event.
Definition: event.h:71
XFEvent::getId
int getId() const
Returns id_ identifying the event in the behaviors context.
Definition: event.h:63
XFEvent::getBehavior
interface::XFBehavior * getBehavior() const
Returns pointer to behavioral class.
Definition: event.h:56
XFEvent::eventType_
const XFEventType eventType_
Holds the type of the event.
Definition: event.h:68
XFEvent::~XFEvent
virtual ~XFEvent()
Class destructor.
Definition: event.h:44
XFEvent::deleteAfterConsume
virtual bool deleteAfterConsume() const
Tells the dispatcher if the event must be deleted or not.
Definition: event.h:65
XFEvent::XFEventType
XFEventType
Definition: event.h:29
XFEvent::Timeout
@ Timeout
Defines a timeout event.
Definition: event.h:34
XFEvent::DefaultTransition
@ DefaultTransition
Event generated by the state machine to define a default transition.
Definition: event.h:32
XFEvent::Event
@ Event
Custom event.
Definition: event.h:33
XFEvent::Initial
@ Initial
Initial pseudostate.
Definition: event.h:31
XFEvent::Unknown
@ Unknown
Unknown state (not initialized).
Definition: event.h:30
XFEvent::setBehavior
void setBehavior(interface::XFBehavior *pBehavior)
Sets pointer to behavioral class (see pBehavior_). Sets the behavior in which the event should be exe...
Definition: event.h:61
XFEvent::getEventType
XFEventType getEventType() const
Returns the type of the event.
Definition: event.h:50
XFEvent::id_
int id_
Event id to identify event in state-machine.
Definition: event.h:69
XFEvent::XFEvent
XFEvent(XFEventType eventType, int id=0)
Standard constructor.
Definition: event.h:43
interface::XFBehavior
Interface to receive and process events.
Definition: behavior.h:24