Rapicorn - Experimental UI Toolkit - Source Code  13.07.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Classes | Public Member Functions
Rapicorn::Aida::Signal< SignalSignature, Collector > Class Template Reference

Signal is a template type providing an interface for arbitrary callback lists. More...

#include <aidasignal.hh>

Inherits ProtoSignal< SignalSignature, Collector >.

List of all members.

Classes

class  Connector

Public Member Functions

 Signal (const CbFunction &method=CbFunction())
 Signal constructor, supports a default callback as argument.
Connector operator() ()
 Retrieve a connector object with operator+= and operator-= to connect and disconnect signal handlers.

Detailed Description

template<typename SignalSignature, class Collector = Lib::CollectorDefault<typename std::function<SignalSignature>::result_type>>
class Rapicorn::Aida::Signal< SignalSignature, Collector >

Signal is a template type providing an interface for arbitrary callback lists.

A signal type needs to be declared with the function signature of its callbacks, and optionally a return result collector class type. Signal callbacks can be added with operator+= to a signal and removed with operator-=, using a callback connection ID return by operator+= as argument. The callbacks of a signal are invoked with the emit() method and arguments according to the signature. The result returned by emit() depends on the signal collector class. By default, the result of the last callback is returned from emit(). Collectors can be implemented to accumulate callback results or to halt a running emissions in correspondance to callback results. The signal implementation is safe against recursion, so callbacks may be removed and added during a signal emission and recursive emit() calls are also safe. The overhead of an unused signal is intentionally kept very low, around the size of a single pointer. Note that the Signal template types is non-copyable.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines