semf
semf::Slot< T, Arguments > Class Template Reference

Slot for lightweight signal/slot implementation. This ConstSlot is for connecting a signal to a member function. When the signal is emitted, the given member function is invoked. More...

#include <slot.h>

Inheritance diagram for semf::Slot< T, Arguments >:
Inheritance graph
Collaboration diagram for semf::Slot< T, Arguments >:
Collaboration graph

Public Types

typedef void(* Function) (T &, Arguments &&...)
 

Public Member Functions

 Slot (T &object, Function function)
 Constructor. More...
 
virtual ~Slot ()=default
 
void setObject (T &object)
 Set the reference to the context. More...
 
T & object () const
 Get the reference to the context. More...
 
void setFunction (Function function)
 setFunction Set the method which should called. More...
 
Function function () const
 Get the method which should called. More...
 
- Public Member Functions inherited from semf::SlotBase< Arguments... >
virtual ~SlotBase ()=default
 

Protected Member Functions

void call (Arguments &&... arguments)
 The invocation of the callback. More...
 
virtual void call (Arguments &&... arguments)=0
 The invocation of the callback. More...
 

Detailed Description

template<typename T, typename... Arguments>
class semf::Slot< T, Arguments >

Slot for lightweight signal/slot implementation. This ConstSlot is for connecting a signal to a member function. When the signal is emitted, the given member function is invoked.

Parameters
TType of the class object
ArgumentsThe parameter types for pass parameter over the signal to a method.

Definition at line 42 of file slot.h.

Member Typedef Documentation

◆ Function

template<typename T , typename... Arguments>
typedef void(* semf::Slot< T, Arguments >::Function) (T &, Arguments &&...)

typedef for the function pointer.

Definition at line 46 of file slot.h.

Constructor & Destructor Documentation

◆ Slot()

template<typename T , typename... Arguments>
semf::Slot< T, Arguments >::Slot ( T &  object,
Function  function 
)
inline

Constructor.

Parameters
objectThe class object.
functionThe method which should called.

Definition at line 52 of file slot.h.

◆ ~Slot()

template<typename T , typename... Arguments>
virtual semf::Slot< T, Arguments >::~Slot ( )
virtualdefault

Member Function Documentation

◆ call()

template<typename T , typename... Arguments>
void semf::Slot< T, Arguments >::call ( Arguments &&...  arguments)
protectedvirtual

The invocation of the callback.

Parameters
argumentsArguments for the callback.

Implements semf::SlotBase< Arguments... >.

Definition at line 114 of file slot.h.

◆ function()

template<typename T , typename... Arguments>
Slot< T, Arguments... >::Function semf::Slot< T, Arguments >::function

Get the method which should called.

Returns
Pointer to the callback method.

Definition at line 108 of file slot.h.

◆ object()

template<typename T , typename... Arguments>
T & semf::Slot< T, Arguments >::object

Get the reference to the context.

Returns
Reference to the class object

Definition at line 96 of file slot.h.

◆ setFunction()

template<typename T , typename... Arguments>
void semf::Slot< T, Arguments >::setFunction ( Function  function)

setFunction Set the method which should called.

Parameters
functionPointer to the callback method

Definition at line 102 of file slot.h.

◆ setObject()

template<typename T , typename... Arguments>
void semf::Slot< T, Arguments >::setObject ( T &  object)

Set the reference to the context.

Parameters
objectThe class object.

Definition at line 90 of file slot.h.