Corrade::Interconnect namespace

Signal/slot connections.

Contents

This library allows you to interconnect objects. See Signals and slots for more information.

This library is built if WITH_INTERCONNECT is enabled when building Corrade. To use this library with CMake, you need to request the Interconnect component of the Corrade package and link to the Corrade::Interconnect target:

find_package(Corrade REQUIRED Interconnect)

# ...
target_link_libraries(your-app Corrade::Interconnect)

See also Downloading and building Corrade and Using Corrade with CMake for more information.

Classes

class Connection
Connection.
class Emitter
Emitter object.
class Receiver
Receiver object.
template<std::size_t states, std::size_t inputs, class State, class Input>
class StateMachine
State machine.
template<class State, class Input>
class StateTransition
Transition between states.

Functions

template<class EmitterObject, class Emitter, class... Args>
auto connect(EmitterObject& emitter, Interconnect::Emitter::Signal(Emitter::*)(Args...) signal, void(*)(Args...) slot) -> Connection
Connect signal to function slot.
template<class EmitterObject, class Emitter, class Lambda, class... Args>
auto connect(EmitterObject& emitter, Interconnect::Emitter::Signal(Emitter::*)(Args...) signal, Lambda slot) -> Connection
template<class EmitterObject, class Emitter, class Receiver, class ReceiverObject, class... Args>
auto connect(EmitterObject& emitter, Interconnect::Emitter::Signal(Emitter::*)(Args...) signal, ReceiverObject& receiver, void(Receiver::*)(Args...) slot) -> Connection
Connect signal to member function slot.

Function documentation

template<class EmitterObject, class Emitter, class... Args>
Connection Corrade::Interconnect::connect(EmitterObject& emitter, Interconnect::Emitter::Signal(Emitter::*)(Args...) signal, void(*)(Args...) slot)

Connect signal to function slot.

Parameters
emitter Emitter
signal Signal
slot Slot

Connects given signal to compatible slot. emitter must be subclass of Emitter, signal must be implemented signal and slot must be non-member function or non-capturing lambda with void as return type. The argument count and types must be exactly the same.

See Emitter class documentation for more information about connections.

template<class EmitterObject, class Emitter, class Lambda, class... Args>
Connection Corrade::Interconnect::connect(EmitterObject& emitter, Interconnect::Emitter::Signal(Emitter::*)(Args...) signal, Lambda slot)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<class EmitterObject, class Emitter, class Receiver, class ReceiverObject, class... Args>
Connection Corrade::Interconnect::connect(EmitterObject& emitter, Interconnect::Emitter::Signal(Emitter::*)(Args...) signal, ReceiverObject& receiver, void(Receiver::*)(Args...) slot)

Connect signal to member function slot.

Parameters
emitter Emitter
signal Signal
receiver Receiver
slot Slot

Connects given signal to compatible slot in receiver object. emitter must be subclass of Emitter, signal must be implemented signal, receiver must be subclass of Receiver and slot must be non-constant member function with void as return type. The argument count and types must be exactly the same.

See Emitter class documentation for more information about connections.