Simplified XF 1.1.0
Public Member Functions | Protected Attributes | Friends | List of all members
XFTimeout Class Reference

Used by the TimeoutManager to create and handle a timeout. More...

#include <timeout.h>

Inheritance diagram for XFTimeout:
Inheritance graph
Collaboration diagram for XFTimeout:
Collaboration graph

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.
 
- Public Member Functions inherited from XFEvent
 XFEvent (XFEventType eventType, int id=0)
 Standard constructor. More...
 
virtual ~XFEvent ()
 Class destructor.
 
XFEventType getEventType () const
 Returns the type of the event. More...
 
interface::XFBehaviorgetBehavior () 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!
 
- Protected Attributes inherited from XFEvent
const XFEventType eventType_
 Holds the type of the event.
 
int id_
 Event id to identify event in state-machine.
 
interface::XFBehaviorpBehavior_
 Pointer to behavioral class (ex. state-machine) processing the event.
 

Friends

class interface::XFTimeoutManager
 

Additional Inherited Members

- Public Types inherited from XFEvent
enum  XFEventType {
  Unknown = 0 , Initial = 1 , DefaultTransition = 2 , Event = 3 ,
  Timeout = 4
}
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ XFTimeout()

XFTimeout::XFTimeout ( int  id,
int  interval,
interface::XFBehavior pBehavior = nullptr 
)

Constructor of the class.

Parameters
idThe id given by the behavioral class to uniquely identifying the timeout
intervalThe interval in milliseconds the timeout expires
pBehaviorPointer to behavioral class to which the timeout belongs

Member Function Documentation

◆ deleteAfterConsume()

bool XFTimeout::deleteAfterConsume ( ) const
overridevirtual

Tells the dispatcher if the event must be deleted or not.

Reimplemented from XFEvent.

◆ operator==()

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.


The documentation for this class was generated from the following file: