XFDispatcher Class Reference
XF Common Port Classes

Dispatcher used in an IDF (no underlying OS). More...

`#include <dispatcher.h>`

Inheritance diagram for XFDispatcher:
Collaboration diagram for XFDispatcher:

## Public Member Functions

void | pushEvent (XFEvent *pEvent) override
| Adds event to the events queue. More...
void | scheduleTimeout (int timeoutId, int interval, interface::XFBehavior *pBehavior) override
| Adds a new timeout to be handled. More...
void | unscheduleTimeout (int timeoutId, interface::XFBehavior *pBehavior) override
| Removes all timeouts corresponding the given parameters. More...
void | executeOnce () override
| Executes once the dispatcher. More...
int | execute (const void *param=nullptr) override
| Main loop of the dispatcher. Implements event loop processing. More...

## Protected Member Functions

void | dispatchEvent (const XFEvent *pEvent) const override
| Dispatches the event to the corresponding behavioral part. More...
Protected Member Functions inherited from interface::XFDispatcher
| XFDispatcher ()=default

## Protected Attributes

XFEventQueue | events_
| Queue holding events waiting to get dispatched.
interface::XFMutex * | pMutex_
| Mutex to protect event queue.

## Friends

class | interface::XFDispatcher

## Additional Inherited Members

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

## Detailed Description

Dispatcher used in an IDF (no underlying OS).

The dispatcher can be used when an IDF on a bare-metal embedded system is needed.

Only one instance of XFDispatcher is allowed (singleton pattern). It is the interface::XFDispatcher class providing the single instance of the XFDispatcher class (see interface::XFDispatcher::getInstance()).

## Constructor & Destructor Documentation

## ~XFDispatcher()

virtual XFDispatcher::~XFDispatcher | ( |  | ) |

virtual

Reimplemented from interface::XFDispatcher.

## Member Function Documentation

## dispatchEvent()

void XFDispatcher::dispatchEvent | ( | const XFEvent * | pEvent | ) | const

overrideprotectedvirtual

Dispatches the event to the corresponding behavioral part.

For example the state machine which should process the event.

Parameters

  pEvent | The event to dispatch

Implements interface::XFDispatcher.

## execute()

int XFDispatcher::execute | ( | const void * | param = `nullptr` | ) |

overridevirtual

Main loop of the dispatcher. Implements event loop processing.

Implements interface::XFDispatcher.

## executeOnce()

void XFDispatcher::executeOnce | ( |  | ) |

overridevirtual

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.

Implements interface::XFDispatcher.

## pushEvent()

void XFDispatcher::pushEvent | ( | XFEvent * | pEvent | ) |

overridevirtual

Adds event to the events queue.

Implements interface::XFDispatcher.

## scheduleTimeout()

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

overridevirtual

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.

Implements interface::XFDispatcher.

## unscheduleTimeout()

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

overridevirtual

Removes all timeouts corresponding the given parameters.

Implements interface::XFDispatcher.

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

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