Corrade::Interconnect namespace

Signal/slot connections.

This library allows you to interconnect objects.

This library is built if CORRADE_WITH_INTERCONNECT is enabled when building Corrade. To use this library with CMake, 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 PRIVATE Corrade::Interconnect)

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

Classes

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

Functions

template<class EmitterObject, class Emitter, class Functor, class ... Args>
auto connect(EmitterObject& emitter, Interconnect::Emitter::Signal(Emitter::*)(Args...) signal, Functor&& slot) -> Connection deprecated in Git master
Connect signal to function slot.
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 deprecated in Git master
Connect signal to member function slot.
auto disconnect(Emitter& emitter, const Connection& connection) -> bool deprecated in Git master
Disconnect a signal/slot connection.

Function documentation

template<class EmitterObject, class Emitter, class Functor, class ... Args>
Connection Corrade::Interconnect::connect(EmitterObject& emitter, Interconnect::Emitter::Signal(Emitter::*)(Args...) signal, Functor&& 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 can be either a non-member function, a lambda or any other function object. 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 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.

bool Corrade::Interconnect::disconnect(Emitter& emitter, const Connection& connection)

Disconnect a signal/slot connection.

Parameters
emitter Emitter
connection Connection handle returned by connect()

It's the user responsibility to ensure that connection corresponds to given emitter instance. See Emitter class documentation for more information about connections.