SCENE C++ API  2.1.0
Public Member Functions | List of all members
LSSignal< Event > Class Template Reference

General signal interface which provides functionality to connect arbitrary function handlers to a specific signal. More...

#include <lssignal.h>

+ Inheritance diagram for LSSignal< Event >:

Public Member Functions

void connect (void(*handler)(Event))
 Adds a free function as a function handler for this signal. More...
 
template<class Trackable >
void connect (Trackable *trackable, void(Trackable::*handler)(Event))
 Adds a member function as a function handler for this signal. More...
 
void operator() (Event event, bool synchronize=false)
 Triggers the signals and calls the connected function handlers. More...
 

Detailed Description

template<class Event>
class SCENE_API::LSSignal< Event >

General signal interface which provides functionality to connect arbitrary function handlers to a specific signal.

The function handler has to match the function signature of the signal and can either be a free function or a member function of a LSTrackable derived class.

Version
SCENE API Version 2.0.0.

Member Function Documentation

◆ connect() [1/2]

void connect ( void(*)(Event)  handler)
inline

Adds a free function as a function handler for this signal.

The function needs to have a matching signature with a void return value and an event of the specified type as a single argument.

Parameters
handlerA function pointer to the free function which should be added as a function handler.
Version
SCENE API Version 2.0.0.

◆ connect() [2/2]

void connect ( Trackable *  trackable,
void(Trackable::*)(Event)  handler 
)
inline

Adds a member function as a function handler for this signal.

The function needs to be a member of an LSTrackable derived class and needs to have a matching signature with a void return value and an event of the specified type as a single argument.

Parameters
trackableThe trackable instance whose member function should be called when the signal is triggered.
handlerA function pointer to the free function which should be added as a function handler.
Version
SCENE API Version 2.0.0.

◆ operator()()

void operator() ( Event  event,
bool  synchronize = false 
)

Triggers the signals and calls the connected function handlers.

Parameters
eventThe event which is passed to the connected function handlers.
synchronizeWhether the call should wait until all function handler have been called.
Version
SCENE API Version 2.0.0.