Dillo v3.1.1-119-g140d9ebd
|
The base class for signal emitters. More...
#include <signal.hh>
Public Member Functions | |
Emitter () | |
~Emitter () | |
void | intoStringBuffer (misc::StringBuffer *sb) |
Store a textual representation of the object in a misc::StringBuffer. | |
Public Member Functions inherited from lout::object::Object | |
virtual | ~Object () |
The destructor is defined as virtual (but not abstract), so that destruction of Object's works properly. | |
virtual bool | equals (Object *other) |
Returns, whether two objects are equal. | |
virtual int | hashValue () |
Return a hash value for the object. | |
virtual Object * | clone () |
Return an exact copy of the object. | |
const char * | toString () |
Use object::Object::intoStringBuffer to return a textual representation of the object. | |
virtual size_t | sizeOf () |
Return the number of bytes, this object totally uses. | |
Protected Member Functions | |
void | emitVoid (int signalNo, int argc, Object **argv) |
Emit a void signal. | |
bool | emitBool (int signalNo, int argc, Object **argv) |
Emit a boolean signal. | |
void | connect (Receiver *receiver) |
Connect a receiver to the emitter. | |
virtual bool | emitToReceiver (Receiver *receiver, int signalNo, int argc, Object **argv)=0 |
A sub class must implement this for a call to a single receiver. | |
Private Member Functions | |
void | unconnect (Receiver *receiver) |
Private Attributes | |
container::typed::List< Receiver > * | receivers |
Friends | |
class | Receiver |
The base class for signal emitters.
If defining a signal group, a sub class of this class must be defined, with
There are two representations of signals:
In the unfolded representation, the signal itself is represented by the method itself (in the emitter or the receiver), and the arguments are represented as normal C++ types.
lout::signal::Emitter::~Emitter | ( | ) |
Definition at line 38 of file signal.cc.
References receivers, and lout::signal::Receiver::unconnectFrom().
|
protected |
Connect a receiver to the emitter.
This is protected, a sub class should define a wrapper, with the respective receiver as an argument, to gain type safety.
Definition at line 65 of file signal.cc.
References lout::signal::Receiver::connectTo(), and receivers.
Referenced by dw::core::ui::Resource::ActivateEmitter::connectActivate(), dw::core::ui::Resource::ClickedEmitter::connectClicked(), lout::signal::ObservedObject::DeletionEmitter::connectDeletion(), dw::core::Layout::Emitter::connectLayout(), and dw::core::Layout::LinkEmitter::connectLink().
|
protected |
Emit a boolean signal.
This method should be called by a wrapper, which folds the signal, delegates the emission to here, and returns the same boolean value.
Definition at line 91 of file signal.cc.
References emitToReceiver(), and receivers.
|
protectedpure virtual |
A sub class must implement this for a call to a single receiver.
This methods gets the signal in a folded representation, it has to unfold it, and pass it to a single receiver. For boolean signals, the return value of the receiver must be returned, for void signals, the return value is discarded.
Implemented in dw::core::Layout::LinkEmitter, dw::core::Layout::Emitter, dw::core::ui::Resource::ActivateEmitter, dw::core::ui::Resource::ClickedEmitter, and lout::signal::ObservedObject::DeletionEmitter.
Referenced by emitBool(), and emitVoid().
|
protected |
Emit a void signal.
This method should be called by a wrapper (return value void), which folds the signal, and delegates the emission to here.
Definition at line 77 of file signal.cc.
References emitToReceiver(), and receivers.
|
virtual |
Store a textual representation of the object in a misc::StringBuffer.
This is used by object::Object::toString.
Reimplemented from lout::object::Object.
Definition at line 47 of file signal.cc.
References lout::misc::StringBuffer::append(), and receivers.
|
private |
Definition at line 54 of file signal.cc.
References receivers.
Referenced by lout::signal::Receiver::~Receiver().
|
private |
Definition at line 217 of file signal.hh.
Referenced by connect(), emitBool(), Emitter(), emitVoid(), intoStringBuffer(), unconnect(), and ~Emitter().