Conscience Core
Public Member Functions | Static Public Member Functions | List of all members
conscience_core::core_objects::events::CscCoreEvents Class Reference

#include <CscCoreEvents.h>

Public Member Functions

void publish (const CscCoreEvent *event)
 
template<class TObject , class TEvent >
void registerHandler (const string &handlerId, TObject *handlerObject, void(TObject::*handlerMethod)(const TEvent *event, bool &unregisterAfter), bool deleteObjectOnDestruct=false)
 
template<class TEvent >
void registerHandler (const string &handlerId, HandleEventFunction< TEvent > call)
 
template<class TEvent >
void unregister (const string &handlerId)
 

Static Public Member Functions

static CscCoreEventsgetInstance ()
 

Detailed Description

Central class for Conscience Core events management (publish / listen)

Member Function Documentation

◆ getInstance()

CscCoreEvents * conscience_core::core_objects::events::CscCoreEvents::getInstance ( )
static

◆ publish()

void conscience_core::core_objects::events::CscCoreEvents::publish ( const CscCoreEvent event)

Publish a Conscience Core event - Handlers will be notified if any matches this event Note : event pointer will be deleted after handlers call

◆ registerHandler() [1/2]

template<class TEvent >
void conscience_core::core_objects::events::CscCoreEvents::registerHandler ( const string &  handlerId,
HandleEventFunction< TEvent >  call 
)
inline

Adds a listener for given event of type TEvent in the form of a member's method.

Parameters
handlerIdgiven a unique ID for this handle
calllambda function to be called when event of type TEvent has been published

◆ registerHandler() [2/2]

template<class TObject , class TEvent >
void conscience_core::core_objects::events::CscCoreEvents::registerHandler ( const string &  handlerId,
TObject *  handlerObject,
void(TObject::*)(const TEvent *event, bool &unregisterAfter)  handlerMethod,
bool  deleteObjectOnDestruct = false 
)
inline

Adds a listener for given event of type TEvent in the form of a member's method.

Parameters
handlerIdgiven a unique ID for this handle
handlerObjectmethod will be called on this instance
handlerMethodmethod to be called on handlerObject when event of type TEvent has been published
deleteObjectOnDestructdelete given handlerObject when unregister is called

◆ unregister()

template<class TEvent >
void conscience_core::core_objects::events::CscCoreEvents::unregister ( const string &  handlerId)
inline

Unregisters event handler of ID handlerId for event type TEvent


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