$darkmode
cloe::Callback Class Referenceabstract

#include <trigger.hpp>

Inheritance diagram for cloe::Callback:

Public Member Functions

void set_executer (CallbackExecuter exe)
 
virtual void emplace (TriggerPtr &&t, const Sync &s)=0
 
virtual void to_json (fable::Json &j) const =0
 

Protected Member Functions

void execute (TriggerPtr &&t, const Sync &s)
 

Friends

void to_json (fable::Json &j, const Callback &c)
 

Detailed Description

Callback provides the interface with which the global trigger manager, which maintains a list of all available event and action factories, can insert and execute triggers.

A Callback subtype is created for each event type, and is passed to the trigger manager when the event factory is registered. This allows the event owner, which knows exactly when it should trigger all events, to pass activated triggers to the event manager. This is done through the execute(TriggerPtr&&, const Sync&) method.

It is strongly recommended to use the DirectCallback template class instead of rolling your own Callback class. If you do roll your own, ensure that you do not execute triggers directly; rather use the provided CallbackExecuter.

See also
cloe/registrar.hpp

Member Function Documentation

◆ emplace()

virtual void cloe::Callback::emplace ( TriggerPtr &&  t,
const Sync s 
)
pure virtual

Place a trigger within the callback for storage.

Implemented in cloe::AliasCallback, cloe::DirectCallback< E, Ctx >, engine::events::TimeCallback, and engine::events::NextCallback.

◆ execute()

void cloe::Callback::execute ( TriggerPtr &&  t,
const Sync s 
)
protected

Execute a trigger in the given sync context by passing it to the executer.

◆ set_executer()

void cloe::Callback::set_executer ( CallbackExecuter  exe)
inline

Set the trigger executer function.

◆ to_json()

virtual void cloe::Callback::to_json ( fable::Json j) const
pure virtual

Return JSON representation of all contained triggers.

Implemented in cloe::DirectCallback< E, Ctx >, and cloe::AliasCallback.

Here is the call graph for this function:
Here is the caller graph for this function:

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