Signals and Delegates

Detailed Description

Callback mechanisms for event handling have become ubiqitous in todays application frameworks. Older examples are the use of function pointers as callbacks or the message maps found in the MFC toolkit. More modern approaches include the .NET delegates and so-called signal-slot techniques. When signals and slots are used, objects can communicate with each other by connecting a signal of one object to the slot of another object. In most cases connection management features are built-in so that an object closes all it connections automatically when it gets destroyed. Once the connection has been established, all connected slots are called when a signal is send. Connecting signals to slots is type-safe i.e. a signal can only be connected to a slot that matches the signal's signature. At the same time it allows a great deal of flexibility (loose coupling), since the caller has no intimite knowledge of the callee. A simple but real example might look like this:

int main()
{
timer.setActive( app.loop() );
timer.start(1000);
timer.timeout() += Pt::slot(app, &Pt::System::Application::exit);
return app.run();
}

This program will simply exit, when the timer expires after 1000 ms. The application object is the callee and the member function Application::exit serves as a slot. The timer is the caller, which has a signal called timeout.

Classes

class  BasicSlot< R, ARGUMENTS >
 Base type for various "slot" types. More...
 
class  Callable< R, ARGUMENTS >
 An interface for all callable entities. More...
 
class  Connectable
 Connection Management for Signal and Slot Objects. More...
 
class  Connection
 Represents a connection between a Signal/Delegate and a slot. More...
 
class  ConstMethod< R, ClassT, ARGUMENTS >
 Adapter for const class methods. More...
 
class  ConstMethodSlot< R, ClassT, ARGUMENTS >
 Wraps ConstMethod objects so that they can act as Slots. More...
 
class  Delegate< R, ARGUMENTS >
 Delegates an action to a slot. More...
 
class  DelegateSlot< R, ARGUMENTS >
 Wraps Delegate objects so that they can act as Slots. More...
 
class  Function< R, ARGUMENTS >
 Wraps free functions into a generic callable for use with the signals/slots. More...
 
class  FunctionSlot< R, ARGUMENTS >
 Wraps Function objects so that they can act as slots. More...
 
class  Invokable< ARGUMENTS >
 Interface for invokable entities. More...
 
class  Method< R, ClassT, ARGUMENTS >
 Adapter for class methods. More...
 
class  MethodSlot< R, ClassT, ARGUMENTS >
 Wraps Method objects so that they can act as Slots. More...
 
class  Signal< ARGUMENTS >
 Multicast Signal to call multiple slots. More...
 
class  SignalSlot< ARGUMENTS >
 Wraps Signal objects so that they can act as Slots. More...
 
class  Slot
 Endpoint of a signal/slot connection. More...