libosmscout  0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
osmscout::Signal< Args > Class Template Reference

Signal and Slot is tool for connecting source of events and its consumers. More...

#include <Signal.h>

Public Member Functions

void Connect (Slot< Args... > &slot)
 Connect Signal to given Slot. More...
 
void Disconnect ()
 Disconnect from all slots. More...
 
void Disconnect (Slot< Args... > &slot)
 Disconnect from specific slot. More...
 
void Emit (const Args &... args) const
 Emit signal. More...
 
Signaloperator= (const Signal &)=delete
 
Signaloperator= (Signal &&)=delete
 
 Signal ()=default
 
 Signal (const Signal &)=delete
 
 Signal (Signal &&)=delete
 
virtual ~Signal ()
 

Friends

class Slot< Args... >
 

Detailed Description

template<typename... Args>
class osmscout::Signal< Args >

Signal and Slot is tool for connecting source of events and its consumers.

It is similar to Qt's signal, but it lacks some advanced functionality, like asynchronous connection. Slot callback is called in thread context of the signal. Locking or asynchronicity have to be solved differently.

Signal and Slot are thread safe. Their live cycle may be independent.

Template Parameters
Args

Constructor & Destructor Documentation

◆ Signal() [1/3]

template<typename... Args>
osmscout::Signal< Args >::Signal ( )
default

◆ Signal() [2/3]

template<typename... Args>
osmscout::Signal< Args >::Signal ( const Signal< Args > &  )
delete

◆ Signal() [3/3]

template<typename... Args>
osmscout::Signal< Args >::Signal ( Signal< Args > &&  )
delete

◆ ~Signal()

template<typename... Args>
osmscout::Signal< Args >::~Signal
virtual

Member Function Documentation

◆ Connect()

template<typename... Args>
void osmscout::Signal< Args >::Connect ( Slot< Args... > &  slot)

Connect Signal to given Slot.

Parameters
slot

◆ Disconnect() [1/2]

template<typename... Args>
void osmscout::Signal< Args >::Disconnect

Disconnect from all slots.

◆ Disconnect() [2/2]

template<typename... Args>
void osmscout::Signal< Args >::Disconnect ( Slot< Args... > &  slot)

Disconnect from specific slot.

When there is no connection with given slot, Method is no-op.

Parameters
slot

◆ Emit()

template<typename... Args>
void osmscout::Signal< Args >::Emit ( const Args &...  args) const

Emit signal.

All connected slots are called.

Parameters
args

◆ operator=() [1/2]

template<typename... Args>
Signal& osmscout::Signal< Args >::operator= ( const Signal< Args > &  )
delete

◆ operator=() [2/2]

template<typename... Args>
Signal& osmscout::Signal< Args >::operator= ( Signal< Args > &&  )
delete

Friends And Related Function Documentation

◆ Slot< Args... >

template<typename... Args>
friend class Slot< Args... >
friend

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