properties-cpp 0.0.1 A very simple convenience library for handling properties and signals in C++11.

Classes | Public Types | Public Member Functions | List of all members
core::Signal< Arguments > Class Template Reference

A signal class that observers can subscribe to. More...

`#include <signal.h>`

Collaboration diagram for core::Signal< Arguments >:

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

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

## Detailed Description

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

A signal class that observers can subscribe to.

Template Parameters

  Arguments | List of argument types passed on to observers when the signal is emitted.

Definition at line 36 of file signal.h.

## Member Typedef Documentation

## ◆ Slot

template<typename ... Arguments>

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.

## Constructor & Destructor Documentation

## ◆ Signal() [1/2]

template<typename ... Arguments>

core::Signal< Arguments >::Signal | ( |  | ) |
| inline noexcept

Signal constructs a new instance. Never throws.

Definition at line 61 of file signal.h.

## ◆ ~Signal()

template<typename ... Arguments>

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

Definition at line 65 of file signal.h.

## ◆ Signal() [2/2]

template<typename ... Arguments>

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

## Member Function Documentation

## ◆ connect()

template<typename ... Arguments>

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

  slot | The 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.

Referenced by TEST().

## ◆ operator()()

template<typename ... Arguments>

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

  args | The arguments to be passed on to registered slots.

Definition at line 132 of file signal.h.

## ◆ operator=()

template<typename ... Arguments>

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

## ◆ operator==()

template<typename ... Arguments>

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

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

- /usr/src/slapt-src/libraries/properties-cpp/properties-cpp-0.0.1+14.10.20140730/include/core/signal.h