Simplified XF 1.1.0

event.h
1#ifndef XF_EVENT_H
2#define XF_EVENT_H
3
4 namespace interface {
5 class XFBehavior;
6}
7
22 class XFEvent
23{
24 public:
28 typedef enum
29 {
30 Unknown = 0,
31 Initial = 1,
32 DefaultTransition = 2,
33 Event = 3,
34 Timeout = 4
35 } XFEventType;
36
37public :
43 XFEvent(XFEventType eventType, int id = 0) : eventType_(eventType), id_(id), pBehavior_(nullptr) {}
44 virtual ~XFEvent() {}
45
50 inline XFEventType getEventType() const { return eventType_; }
51
56 inline interface::XFBehavior * getBehavior() const { return pBehavior_; }
57
61 inline void setBehavior(interface::XFBehavior * pBehavior) { pBehavior_ = pBehavior; }
62
63 inline int getId() const { return id_; }
64
65 virtual bool deleteAfterConsume() const { return false; }
66
67 protected:
68 const XFEventType eventType_;
69 int id_;
70
71 interface::XFBehavior * pBehavior_;
72};
73 // end of xf_core group
75#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