EventDispatcher

class HPS::EventDispatcher : public HPS::Object

The EventDispatcher class is used for injecting any events and dealing with event handlers which handle those events.

Public Functions

bool Equals(EventDispatcher const &in_that) const

Check if the source EventDispatcher is equivalent to this object.

Parameters

in_that – The source EventDispatcher to compare to this object.

Returns

true if the objects are equivalent, false otherwise.

EventDispatcher()

The default constructor creates an uninitialized EventDispatcher object which cannot be subscribed to.

See

Database::CreateEventDispatcher()

EventDispatcher(EventDispatcher &&in_that)

The move constructor creates a EventDispatcher by transferring the underlying impl of the rvalue reference to this EventDispatcher thereby avoiding a copy and allocation.

Parameters

in_that – An rvalue reference to a EventDispatcher to take the impl from.

EventDispatcher(EventDispatcher const &in_that)

The copy constructor creates an EventDispatcher object that points to the same underlying impl as the source EventDispatcher.

Parameters

in_that – The source EventHandler to point to.

bool InjectEvent(Event const &in_event) const

Inject the specified event and propagate it to all subscribed handlers in the order of subscription.

Parameters

in_eventEvent to inject and propagate.

Returns

true if the event injection was successful, false otherwise.

EventNotifier InjectEventWithNotifier(Event const &in_event) const

Inject the specified event and propagate it to all subscribed handlers in the order of subscription and return an EventNotifier associated with the injected event.

Parameters

in_eventEvent to inject and propagate.

Returns

An event notifier associated with the injected event.

bool IsShutdown() const

Query whether the asynchronous shutdown has completed.

Returns

true if the event dispatcher has shutdown, false otherwise.

inline virtual HPS::Type ObjectType() const

This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).

Returns

The declared type of the object in question, which may differ from the true, underlying type.

bool operator!=(EventDispatcher const &in_that) const

Check if the source EventDispatcher is not equivalent to this object.

Parameters

in_that – The source EventDispatcher to compare to this object.

Returns

true if the objects are not equivalent, false otherwise.

EventDispatcher &operator=(EventDispatcher &&in_that)

The move assignment operator transfers the underlying impl of the rvalue reference to this EventDispatcher thereby avoiding a copy.

Parameters

in_that – An rvalue reference to an EventDispatcher to take the impl from.

Returns

A reference to this EventDispatcher.

EventDispatcher &operator=(EventDispatcher const &in_that)

Associate this EventDispatcher with the same underlying impl as the source EventDispatcher.

Parameters

in_that – The source EventDispatcher for the assignment.

Returns

A reference to this EventDispatcher.

bool operator==(EventDispatcher const &in_that) const

Check if the source EventDispatcher is equivalent to this object.

Parameters

in_that – The source EventDispatcher to compare to this object.

Returns

true if the objects are equivalent, false otherwise.

void SetName(char const *in_name) const

Sets the EventDispatcher’s name

Parameters

in_name – Name to set.

void ShowName(UTF8 &out_name) const

Shows the EventDispatcher’s name

Parameters

out_name – Current name of this EventDispatcher.

void Shutdown() const

Shutdown this EventDispatcher asynchronously. Any pending events injected into this EventDispatcher will be processed prior to shutdown, but no new events can be injected.

bool Subscribe(EventHandler const &in_handler, intptr_t in_type) const

Add the specified event handler to the list of subscribers for events of the specified type on this EventDispatcher.

Parameters
  • in_handlerEvent handler to add to the subscriber list for events of the given type.

  • in_type – Type of event to add the handler for.

Returns

true if the subscription was successful, false otherwise.

bool UnSubscribe(EventHandler const &in_handler) const

Remove the specified event handler from the list of subscribers for events of the specified type on this EventDispatcher.

Parameters
  • in_handlerEvent handler to remove from the subscriber list for events of the given type.

  • in_type – Type of event to remove the handler for.

Returns

true if the unsubscription was successful, false otherwise.

bool UnSubscribe(EventHandler const &in_handler, intptr_t in_type) const

Remove the specified event handler from the list of subscribers for events of the specified type on this EventDispatcher.

Parameters
  • in_handlerEvent handler to remove from the subscriber list for events of the given type.

  • in_type – Type of event to remove the handler for.

Returns

true if the unsubscription was successful, false otherwise.

bool UnSubscribe(intptr_t in_type) const

Remove the specified event handler from the list of subscribers for events of the specified type on this EventDispatcher.

Parameters

in_type – Type of event to remove the handler for.

Returns

true if the unsubscription was successful, false otherwise.

virtual ~EventDispatcher()

Public Static Attributes

static const HPS::Type staticType = HPS::Type::EventDispatcher