Simplified XF 1.1.0

Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
interface::XFDispatcher Class Referenceabstract

Interface for the XF dispatcher providing the event processing loop. More...

`#include <dispatcher.h>`

Inheritance diagram for interface::XFDispatcher:
Collaboration diagram for interface::XFDispatcher:

## Public Member Functions
virtual void | pushEvent (XFEvent *pEvent)=0
| Adds event to the events queue. More...
virtual void | scheduleTimeout (int timeoutId, int interval, interface::XFBehavior *pBehavior)=0
| Adds a new timeout to be handled. More...
virtual void | unscheduleTimeout (int timeoutId, interface::XFBehavior *pBehavior)=0
| Removes all timeouts corresponding the given parameters. More...

## Static Public Member Functions
static XFDispatcher * | getInstance ()
| Returns a pointer to the single instance of XFDispatcher.

## Protected Member Functions
| XFDispatcher ()=default
virtual int | execute (const void *param=nullptr)=0
| Main loop of the dispatcher. Implements event loop processing. More...
virtual void | executeOnce ()=0
| Executes once the dispatcher. More...
virtual void | dispatchEvent (const XFEvent *pEvent) const =0
| Dispatches the event to the corresponding behavioral part. More...

## Friends
class | ::XF
class | ::DispatcherThread

## Detailed Description

Interface for the XF dispatcher providing the event processing loop.

Depending on the implementation the dispatcher is executed by an internal thread. It is up to the port implementation how the class behaves.

The dispatcher should at least provide a queue to hold events and an algorithm (typically in execute()) that dispatches the queued events to the associated behavior (eq. state machine, activity).

There may exist multiple dispatchers. Each behavior needs to be bound to a dispatcher. One dispatcher may serve different behaviors.

## Constructor & Destructor Documentation

## ◆ XFDispatcher()

interface::XFDispatcher::XFDispatcher | ( |  | ) |
| protected default

Constructor is protected because only method createInstance() should be called to create Dispatcher instances

## Member Function Documentation

## ◆ dispatchEvent()

virtual void interface::XFDispatcher::dispatchEvent | ( | const XFEvent * | pEvent | ) | const
| protected pure virtual

Dispatches the event to the corresponding behavioral part.

For example the state machine which should process the event.

Parameters

  pEvent | The event to dispatch

Implemented in XFDispatcher.

## ◆ execute()

virtual int interface::XFDispatcher::execute | ( | const void * | param = `nullptr` | ) |
| protected pure virtual

Main loop of the dispatcher. Implements event loop processing.

Implemented in XFDispatcher.

## ◆ executeOnce()

virtual void interface::XFDispatcher::executeOnce | ( |  | ) |
| protected pure virtual

Executes once the dispatcher.

Usually, this method must not be called explicitly. The standard way to call the dispatcher is to call execute().

This method can be called by the Thread (or main function) if it must perform concurrent (non-XF related) tasks in addition.

When using this method start() must not be called.

Implemented in XFDispatcher.

## ◆ pushEvent()

virtual void interface::XFDispatcher::pushEvent | ( | XFEvent * | pEvent | ) |
| pure virtual

Adds event to the events queue.

Implemented in XFDispatcher.

## ◆ scheduleTimeout()

virtual void interface::XFDispatcher::scheduleTimeout | ( | int | timeoutId,
|  | int | interval,
|  | interface::XFBehavior * | pBehavior
| ) |  |
| pure virtual

Adds a new timeout to be handled.

The dispatcher will forward the timeout information to the timeout manager which is responsible to handle all timeouts.

Implemented in XFDispatcher.

## ◆ unscheduleTimeout()

virtual void interface::XFDispatcher::unscheduleTimeout | ( | int | timeoutId,
|  | interface::XFBehavior * | pBehavior
| ) |  |
| pure virtual

Removes all timeouts corresponding the given parameters.

Implemented in XFDispatcher.

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

- C:/Users/thomas.sterren/Desktop/PTR_XF_Release/03-release/work/src/simplified/xf/include/xf/interface/dispatcher.h
- C:/Users/thomas.sterren/Desktop/PTR_XF_Release/03-release/work/src/simplified/xf/port/common/dispatcher.cpp