HPS::EventDispatcher Class Reference

#include <hps.h>

Inheritance diagram for HPS::EventDispatcher:
HPS::Object

Public Member Functions

bool Equals (EventDispatcher const &in_that) const
 
 EventDispatcher ()
 
 EventDispatcher (EventDispatcher const &in_that)
 
 EventDispatcher (EventDispatcher &&in_that)
 
bool InjectEvent (Event const &in_event) const
 
EventNotifier InjectEventWithNotifier (Event const &in_event) const
 
bool IsShutdown () const
 
HPS::Type ObjectType () const
 
bool operator!= (EventDispatcher const &in_that) const
 
EventDispatcheroperator= (EventDispatcher &&in_that)
 
EventDispatcheroperator= (EventDispatcher const &in_that)
 
bool operator== (EventDispatcher const &in_that) const
 
void SetName (char const *in_name) const
 
void ShowName (UTF8 &out_name) const
 
void Shutdown () const
 
bool Subscribe (EventHandler const &in_handler, intptr_t in_type) const
 
bool UnSubscribe (EventHandler const &in_handler, intptr_t in_type) const
 
bool UnSubscribe (EventHandler const &in_handler) const
 
bool UnSubscribe (intptr_t in_type) const
 
- Public Member Functions inherited from HPS::Object
virtual bool Empty () const
 
intptr_t GetClassID () const
 
intptr_t GetInstanceID () const
 
bool HasType (HPS::Type in_mask) const
 
 Object (Object const &that)
 
 Object (Object &&in_that)
 
Objectoperator= (Object const &other_object)
 
Objectoperator= (Object &&in_that)
 
virtual HPS::Type Type () const
 

Static Public Attributes

static const HPS::Type staticType = HPS::Type::EventDispatcher
 
- Static Public Attributes inherited from HPS::Object
static const HPS::Type staticType = HPS::Type::None
 

Additional Inherited Members

- Static Public Member Functions inherited from HPS::Object
template<typename T >
static intptr_t ClassID ()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ EventDispatcher() [1/3]

HPS::EventDispatcher::EventDispatcher ( )

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

See also
Database::CreateEventDispatcher()

◆ EventDispatcher() [2/3]

HPS::EventDispatcher::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_thatThe source EventHandler to point to.

◆ EventDispatcher() [3/3]

HPS::EventDispatcher::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_thatAn rvalue reference to a EventDispatcher to take the impl from.

Member Function Documentation

◆ Equals()

bool HPS::EventDispatcher::Equals ( EventDispatcher const &  in_that) const

Check if the source EventDispatcher is equivalent to this object.

Parameters
in_thatThe source EventDispatcher to compare to this object.
Returns
true if the objects are equivalent, false otherwise.

◆ InjectEvent()

bool HPS::EventDispatcher::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.

◆ InjectEventWithNotifier()

EventNotifier HPS::EventDispatcher::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.

◆ IsShutdown()

bool HPS::EventDispatcher::IsShutdown ( ) const

Query whether the asynchronous shutdown has completed.

Returns
true if the event dispatcher has shutdown, false otherwise.

◆ ObjectType()

HPS::Type HPS::EventDispatcher::ObjectType ( ) const
inlinevirtual

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.

Reimplemented from HPS::Object.

◆ operator!=()

bool HPS::EventDispatcher::operator!= ( EventDispatcher const &  in_that) const

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

Parameters
in_thatThe source EventDispatcher to compare to this object.
Returns
true if the objects are not equivalent, false otherwise.

◆ operator=() [1/2]

EventDispatcher& HPS::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_thatAn rvalue reference to an EventDispatcher to take the impl from.
Returns
A reference to this EventDispatcher.

◆ operator=() [2/2]

EventDispatcher& HPS::EventDispatcher::operator= ( EventDispatcher const &  in_that)

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

Parameters
in_thatThe source EventDispatcher for the assignment.
Returns
A reference to this EventDispatcher.

◆ operator==()

bool HPS::EventDispatcher::operator== ( EventDispatcher const &  in_that) const

Check if the source EventDispatcher is equivalent to this object.

Parameters
in_thatThe source EventDispatcher to compare to this object.
Returns
true if the objects are equivalent, false otherwise.

◆ SetName()

void HPS::EventDispatcher::SetName ( char const *  in_name) const

Sets the EventDispatcher's name

Parameters
in_nameName to set.

◆ ShowName()

void HPS::EventDispatcher::ShowName ( UTF8 out_name) const

Shows the EventDispatcher's name

Parameters
out_nameCurrent name of this EventDispatcher.

◆ Shutdown()

void HPS::EventDispatcher::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.

◆ Subscribe()

bool HPS::EventDispatcher::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_typeType of event to add the handler for.
Returns
true if the subscription was successful, false otherwise.

◆ UnSubscribe() [1/3]

bool HPS::EventDispatcher::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_typeType of event to remove the handler for.
Returns
true if the unsubscription was successful, false otherwise.

◆ UnSubscribe() [2/3]

bool HPS::EventDispatcher::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_typeType of event to remove the handler for.
Returns
true if the unsubscription was successful, false otherwise.

◆ UnSubscribe() [3/3]

bool HPS::EventDispatcher::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_typeType of event to remove the handler for.
Returns
true if the unsubscription was successful, false otherwise.

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