Cytopia  0.3
A city building simulation game
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Signal.hxx File Reference
#include <memory>
#include <functional>
#include <list>
#include <vector>
#include <algorithm>
+ Include dependency graph for Signal.hxx:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Signal::Lib::ProtoSignal< typename, typename >
 ProtoSignal is the template implementation for callback list. More...
 
struct  Signal::Lib::CollectorInvocation< typename, typename >
 CollectorInvocation invokes signal handlers differently depending on return type. More...
 
struct  Signal::Lib::CollectorLast< Result >
 CollectorLast returns the result of the last signal handler from a signal emission. More...
 
struct  Signal::Lib::CollectorDefault< Result >
 CollectorDefault implements the default signal handler collection behaviour. More...
 
struct  Signal::Lib::CollectorDefault< void >
 CollectorDefault specialisation for signals with void return type. More...
 
struct  Signal::Lib::CollectorInvocation< Collector, R(Args...)>
 CollectorInvocation specialisation for regular signals. More...
 
struct  Signal::Lib::CollectorInvocation< Collector, void(Args...)>
 CollectorInvocation specialisation for signals with void return type. More...
 
class  Signal::Lib::ProtoSignal< R(Args...), Collector >
 ProtoSignal template specialised for the callback signature and collector. More...
 
struct  Signal::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. More...
 

Namespaces

 Signal
 
 Signal::Lib
 

Functions

template<class instance , class Class , class R , class... Args>
std::function< R(Args...)> Signal::slot (instance &object, R(Class::*method)(Args...))
 This function creates a std::function by binding object to the member function pointer method. More...
 
template<class Class , class R , class... Args>
std::function< R(Args...)> Signal::slot (Class *object, R(Class::*method)(Args...))
 This function creates a std::function by binding object to the member function pointer method. More...