2008年4月13日星期日

sigslot in libjingle

The libjingle depends on the sigslot very much. From the Pattern's view, the signal-slot follows the Observer pattern.
To use the sigslot, there are 3 steps.
1) Define a Sender. The sender has a signal.
2) Of course, there's a Receiver which extends from the sigslot::slot. The receiver is the slot.
3) Somewhere, there must be a method that will connect the Sender's signal to the Receiver's slot(s) by calling the signal's connect method.
SignalA maybe is defined like this: sigslot::signal2 SignalA;
aReceiver is an object whose class inherits from sigslot::has_slots<>
aFunctionPointer is the processor of a signal. In this case, this processor method need two parameters.
Connect the signalA with the receiver's function just like this:
SignalA.connect(aReceiver , aFunctionPointer);

Reviewed these C++ keywords/concept today.
extern explicit "const member function"