Listing 2: Definition of class Signal, the Callback Manager
class Signal { public: ~Signal () {} private: Signal () {} public: class Event {...}; template<class Subject, class Observer, class UserEvent> static void connect( Subject&, Observer&, void (Observer::*)(const UserEvent&, Subject*)); template<class Subject, class Observer, class UserEvent> static void connect( Subject&, Observer&, void (*)(const UserEvent&, Subject*, Observer*)); template<class Subject, class Observer, class UserEvent> static bool disconnect( Subject&, Observer&, void (Observer::*)(const UserEvent&, Subject*)); template<class Subject, class Observer, class UserEvent> static bool disconnect( Subject&, Observer&, void (*)(const UserEvent&, Subject*, Observer*)); template<class Subject, class UserEvent> static void emit(Subject&, const UserEvent&); private: struct Callee {}; typedef void (Callee::*MemberCallback) (const Event&, void*); typedef void (*LonelyCallback) (const Event&, void*, void*); class Parcel {...}; typedef list<Parcel> List; typedef map<const void*, List> Map; Map _map; void _emit (void*, const Event&); void _connect (const void*, const Parcel&); bool _disconnect (const void*, const Parcel&); static Signal& _signals (); }; End of Listing