Simplified XF 1.1.0
|
Used by the TimeoutManager to create and handle a timeout. More...
#include <timeout.h>
Public Member Functions | |
XFTimeout (int id, int interval, interface::XFBehavior *pBehavior=nullptr) | |
bool | operator== (const XFTimeout &timeout) const |
bool | deleteAfterConsume () const override |
Tells the dispatcher if the event must be deleted or not. More... | |
int | getInterval () const |
Returns the timeout interval in milliseconds. | |
void | setRelTicks (int relTicks) |
Sets remaining ticks. | |
int | getRelTicks () const |
Returns remaining ticks. | |
void | substractFromRelTicks (int ticksToSubstract) |
Substracts ticksToSubstract from remaining ticks. | |
void | addToRelTicks (int ticksToAdd) |
Adds ticksToAdd to remaining ticks. | |
![]() | |
XFEvent (XFEventType eventType, int id=0) | |
Standard constructor. More... | |
virtual | ~XFEvent () |
Class destructor. | |
XFEventType | getEventType () const |
Returns the type of the event. More... | |
interface::XFBehavior * | getBehavior () const |
Returns pointer to behavioral class. More... | |
void | setBehavior (interface::XFBehavior *pBehavior) |
Sets pointer to behavioral class (see pBehavior_). Sets the behavior in which the event should be executed. | |
int | getId () const |
Returns id_ identifying the event in the behaviors context. | |
Protected Attributes | |
const int | interval_ |
Timeout interval in milliseconds. | |
int | relTicks_ |
Used by the TimeoutManager to calculate remaining time (in milliseconds). Can get negative! | |
![]() | |
const XFEventType | eventType_ |
Holds the type of the event. | |
int | id_ |
Event id to identify event in state-machine. | |
interface::XFBehavior * | pBehavior_ |
Pointer to behavioral class (ex. state-machine) processing the event. | |
Friends | |
class | interface::XFTimeoutManager |
Additional Inherited Members | |
![]() | |
enum | XFEventType { Unknown = 0 , Initial = 1 , DefaultTransition = 2 , Event = 3 , Timeout = 4 } |
Used by the TimeoutManager to create and handle a timeout.
Timeouts are created automatically by the TimeoutManager when scheduling a timeout. After expiration they are queued to the event queue and afterwards dispatched to the corresonding behavior.
A timeout can be identified by checking against Timeout using the getEventType()
method.
XFTimeout is inheriting from XFEvent, so every timeout is also an event.
XFTimeout::XFTimeout | ( | int | id, |
int | interval, | ||
interface::XFBehavior * | pBehavior = nullptr |
||
) |
Constructor of the class.
id | The id given by the behavioral class to uniquely identifying the timeout |
interval | The interval in milliseconds the timeout expires |
pBehavior | Pointer to behavioral class to which the timeout belongs |
|
overridevirtual |
Tells the dispatcher if the event must be deleted or not.
Reimplemented from XFEvent.
bool XFTimeout::operator== | ( | const XFTimeout & | timeout | ) | const |
Operator checks if pBehavior_ and id_ are equal and returns true if so. All other attributes get no attention.