Class HsmEventDispatcherGLib

Public Member Functions

 
virtual boolstart ()
 Create a new IO channel and start events dispatching.
 
virtual voidstop ()
 Stop dispatching events.
 
virtual voidemitEvent (const HandlerID_t handlerID)
 See IHsmEventDispatcher::emitEvent()
 
static std::shared_ptr<HsmEventDispatcherGLib>create (const size_t eventsCacheSize = (10))
 Create dispatcher instance.
 
static std::shared_ptr<HsmEventDispatcherGLib>create (GMainContext *context, const size_t eventsCacheSize = (10))
 Create dispatcher instance.
 

Inheritance Relationships

Base Type

Class Documentation

class HsmEventDispatcherGLib : public hsmcpp::HsmEventDispatcherBase

HsmEventDispatcherGLib provides dispatcher implementation based on glib library.

Events queue is implemented by using glib IO channel. See HsmEventDispatcherGlib for details.

Public Functions


virtual bool start() override

Create a new IO channel and start events dispatching.

See IHsmEventDispatcher::start() for details.

Not Thread Safe

Thread safety is not required by HierarchicalStateMachine::initialize() which uses this API.


virtual void stop() override

Stop dispatching events.

Future calls to dispatchEvents() will have no effect.

Remark

Operation is performed asynchronously. It does not interrupt currently handled event, but will cancel all other pending events.

Not Thread Safe

TODO: Current timers implementation is not thread-safe


virtual void emitEvent(const HandlerID_t handlerID) override

See IHsmEventDispatcher::emitEvent()

Concurrency

thread-safe

Public Static Functions


static std::shared_ptr<HsmEventDispatcherGLib> create(const size_t eventsCacheSize = (10))

Create dispatcher instance.

Not Thread Safe

Must be called inside the main GLib MainContext. The Dispatcher object must be deleted in the main GLib context.

Parameters

eventsCacheSize – size of the queue preallocated for delayed events

Returns

New dispatcher instance.


static std::shared_ptr<HsmEventDispatcherGLib> create(GMainContext *context, const size_t eventsCacheSize = (10))

Create dispatcher instance.

Not Thread Safe

Must be called inside the same GLib context provided in a context. The Dispatcher object must be deleted in the same GLib context as a context .

Parameters
  • context – custom GLib context to use for dispatcher.

  • eventsCacheSize – size of the queue preallocated for delayed events

Returns

New dispatcher instance.