properties-cpp 0.0.3
A very simple convenience library for handling properties and signals in C++11.
core::Signal< void > Class Reference

A signal class that observers can subscribe to, template specialization for signals without arguments. More...

#include <signal.h>

+ Collaboration diagram for core::Signal< void >:

Public Types

typedef std::function< void()> Slot
 Slot is the function type that observers have to provide to connect to this signal.
 
typedef std::function< void(Arguments...)> Slot
 Slot is the function type that observers have to provide to connect to this signal.
 

Public Member Functions

 Signal () noexcept(true)
 Signal constructs a new instance. Never throws.
 
 ~Signal ()
 
 Signal (const Signal &)=delete
 
Signaloperator= (const Signal &)=delete
 
bool operator== (const Signal &) const =delete
 
Connection connect (const Slot &slot) const
 Connects the provided slot to this signal instance.
 
void operator() ()
 operator () emits the signal.
 
 Signal () noexcept(true)
 Signal constructs a new instance. Never throws.
 
 Signal (const Signal &)=delete
 
 ~Signal ()
 
Signaloperator= (const Signal &)=delete
 
bool operator== (const Signal &) const=delete
 
Connection connect (const Slot &slot) const
 Connects the provided slot to this signal instance.
 
void operator() (Arguments... args)
 operator () emits the signal with the provided parameters.
 

Detailed Description

A signal class that observers can subscribe to, template specialization for signals without arguments.

Definition at line 170 of file signal.h.

Member Typedef Documentation

◆ Slot [1/2]

typedef std::function<void(Arguments...)> core::Signal< Arguments >::Slot

Slot is the function type that observers have to provide to connect to this signal.

Definition at line 42 of file signal.h.

◆ Slot [2/2]

typedef std::function<void()> core::Signal< void >::Slot

Slot is the function type that observers have to provide to connect to this signal.

Definition at line 176 of file signal.h.

Constructor & Destructor Documentation

◆ Signal() [1/4]

core::Signal< void >::Signal ( )
inlinenoexcept

Signal constructs a new instance. Never throws.

Definition at line 195 of file signal.h.

Referenced by operator=(), operator==(), and Signal().

◆ ~Signal() [1/2]

core::Signal< void >::~Signal ( )
inline

Definition at line 199 of file signal.h.

◆ Signal() [2/4]

core::Signal< void >::Signal ( const Signal< void > & )
delete

References Signal().

+ Here is the call graph for this function:

◆ Signal() [3/4]

core::Signal< Arguments >::Signal ( )
inlinenoexcept

Signal constructs a new instance. Never throws.

Definition at line 61 of file signal.h.

◆ Signal() [4/4]

core::Signal< Arguments >::Signal ( const Signal< void > & )
delete

◆ ~Signal() [2/2]

core::Signal< Arguments >::~Signal ( )
inline

Definition at line 65 of file signal.h.

Member Function Documentation

◆ connect() [1/2]

Connection core::Signal< Arguments >::connect ( const Slot & slot) const
inline

Connects the provided slot to this signal instance.

Calling this method is thread-safe and synchronized with any other connect, signal emission or disconnect calls.

Parameters
slotThe function to be called when the signal is emitted.
Returns
A connection object corresponding to the signal-slot connection.

Definition at line 86 of file signal.h.

◆ connect() [2/2]

Connection core::Signal< void >::connect ( const Slot & slot) const
inline

Connects the provided slot to this signal instance.

Calling this method is thread-safe and synchronized with any other connect, signal emission or disconnect calls.

Parameters
slotThe function to be called when the signal is emitted.
Returns
A connection object corresponding to the signal-slot connection.

Definition at line 220 of file signal.h.

◆ operator()() [1/2]

void core::Signal< void >::operator() ( )
inline

operator () emits the signal.

Please note that signal emissions might not be delivered immediately to registered slots, depending on whether the respective connection is dispatched via a queueing dispatcher.

Definition at line 263 of file signal.h.

◆ operator()() [2/2]

void core::Signal< Arguments >::operator() ( Arguments... args)
inline

operator () emits the signal with the provided parameters.

Please note that signal emissions might not be delivered immediately to registered slots, depending on whether the respective connection is dispatched via a queueing dispatcher. For that reason, the lifetime of the arguments has to exceed the scope of the call to this operator and its surrounding scope.

Parameters
argsThe arguments to be passed on to registered slots.

Definition at line 132 of file signal.h.

◆ operator=() [1/2]

Signal & core::Signal< Arguments >::operator= ( const Signal< void > & )
delete

◆ operator=() [2/2]

Signal & core::Signal< void >::operator= ( const Signal< void > & )
delete

References Signal().

+ Here is the call graph for this function:

◆ operator==() [1/2]

bool core::Signal< void >::operator== ( const Signal< void > & ) const
delete

References Signal().

+ Here is the call graph for this function:

◆ operator==() [2/2]

bool core::Signal< Arguments >::operator== ( const Signal< void > & ) const
delete

The documentation for this class was generated from the following file: