semf
semf::Signal< Arguments > Class Template Reference

Signal for lightweight signal/slot implementation. One signal can be connected to multiple slots and one slot can be connected to multiple signal. Depending on the type of callback function you may want to use you need to connect using different implementations of SlotBase. More...

#include <signal.h>

Collaboration diagram for semf::Signal< Arguments >:
Collaboration graph

Public Member Functions

void clear ()
 Disconnect all functions or methods. More...
 
void connect (SlotBase< Arguments... > &slot)
 Connect a method to the signal. More...
 
void disconnect (SlotBase< Arguments... > &slot)
 Disonnect a method from the signal. More...
 
void emitSignal (Arguments... arguments) const
 Call the connected methods or functions. More...
 
void operator() (Arguments... arguments) const
 Call the connected methods or functions. More...
 
bool empty () const
 Checks if the Signal is connected to any slot. More...
 

Detailed Description

template<typename... Arguments>
class semf::Signal< Arguments >

Signal for lightweight signal/slot implementation. One signal can be connected to multiple slots and one slot can be connected to multiple signal. Depending on the type of callback function you may want to use you need to connect using different implementations of SlotBase.

Note
  • Its easy possible to make 1:n and n:1 connections.
  • m:n connections are possible, with the following limitation: A slot can no longer be connected to a signal if it has been connected to a signal that was previously connected to another slot.
Template Parameters
ArgumentsThe parameter types for pass parameter over the signal to a function or method.

Definition at line 40 of file signal.h.

Member Function Documentation

◆ clear()

template<typename... Arguments>
void semf::Signal< Arguments >::clear

Disconnect all functions or methods.

Definition at line 81 of file signal.h.

Here is the caller graph for this function:

◆ connect()

template<typename... Arguments>
void semf::Signal< Arguments >::connect ( SlotBase< Arguments... > &  slot)

Connect a method to the signal.

Parameters
slotThe slot which should connect.

Definition at line 94 of file signal.h.

Here is the caller graph for this function:

◆ disconnect()

template<typename... Arguments>
void semf::Signal< Arguments >::disconnect ( SlotBase< Arguments... > &  slot)

Disonnect a method from the signal.

Parameters
slotThe slot which should disconnect.

Definition at line 107 of file signal.h.

◆ emitSignal()

template<typename... Arguments>
void semf::Signal< Arguments >::emitSignal ( Arguments...  arguments) const

Call the connected methods or functions.

Parameters
argumentsThe arguments which should pass to the methods or functions.

Definition at line 122 of file signal.h.

◆ empty()

template<typename... Arguments>
bool semf::Signal< Arguments >::empty

Checks if the Signal is connected to any slot.

Returns
true if no connection exists, false otherwise.

Definition at line 144 of file signal.h.

◆ operator()()

template<typename... Arguments>
void semf::Signal< Arguments >::operator() ( Arguments...  arguments) const

Call the connected methods or functions.

Parameters
argumentsThe arguments which should pass to the methods or functions.

Definition at line 133 of file signal.h.