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