Dillo v3.1.1-91-g6d5b3ee3
Loading...
Searching...
No Matches
signal.hh
Go to the documentation of this file.
1#ifndef __LOUT_SIGNALS_HH__
2#define __LOUT_SIGNALS_HH__
3
4#include "object.hh"
5#include "container.hh"
6
7namespace lout {
8
179namespace signal {
180
181class Receiver;
182
213{
214 friend class Receiver;
215
216private:
217 container::typed::List <Receiver> *receivers;
218
219 void unconnect (Receiver *receiver);
220
221protected:
222 void emitVoid (int signalNo, int argc, Object **argv);
223 bool emitBool (int signalNo, int argc, Object **argv);
224 void connect(Receiver *receiver);
225
235 virtual bool emitToReceiver (Receiver *receiver, int signalNo,
236 int argc, Object **argv) = 0;
237
238public:
239 Emitter();
240 ~Emitter();
241
243};
244
254{
255 friend class Emitter;
256
257private:
259
260 void connectTo(Emitter *emitter);
261 void unconnectFrom(Emitter *emitter);
262
263public:
264 Receiver();
265 ~Receiver();
266
268};
269
275{
276public:
278 {
279 public:
280 virtual void deleted (ObservedObject *object) = 0;
281 };
282
283private:
285 {
286 protected:
287 bool emitToReceiver (signal::Receiver *receiver, int signalNo,
288 int argc, Object **argv);
289
290 public:
291 inline void connectDeletion (DeletionReceiver *receiver)
292 { connect (receiver); }
293
294 void emitDeletion (ObservedObject *obj);
295 };
296
298
299public:
300 virtual ~ObservedObject();
301
302 inline void connectDeletion (DeletionReceiver *receiver)
303 { deletionEmitter.connectDeletion (receiver); }
304};
305
306} // namespace signal
307
308} // namespace lout
309
310#endif // __LOUT_SIGNALS_HH__
Typed version of container::untyped::List.
Definition container.hh:485
A class for fast concatenation of a large number of strings.
Definition misc.hh:570
This is the base class for many other classes, which defines very common virtual methods.
Definition object.hh:25
The base class for signal emitters.
Definition signal.hh:213
void connect(Receiver *receiver)
Connect a receiver to the emitter.
Definition signal.cc:65
void intoStringBuffer(misc::StringBuffer *sb)
Store a textual representation of the object in a misc::StringBuffer.
Definition signal.cc:47
void unconnect(Receiver *receiver)
Definition signal.cc:54
bool emitBool(int signalNo, int argc, Object **argv)
Emit a boolean signal.
Definition signal.cc:91
void emitVoid(int signalNo, int argc, Object **argv)
Emit a void signal.
Definition signal.cc:77
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.
container::typed::List< Receiver > * receivers
Definition signal.hh:217
bool emitToReceiver(signal::Receiver *receiver, int signalNo, int argc, Object **argv)
A sub class must implement this for a call to a single receiver.
Definition signal.cc:147
void emitDeletion(ObservedObject *obj)
Definition signal.cc:157
void connectDeletion(DeletionReceiver *receiver)
Definition signal.hh:291
virtual void deleted(ObservedObject *object)=0
An observed object has a signal emitter, which tells the receivers, when the object is deleted.
Definition signal.hh:275
void connectDeletion(DeletionReceiver *receiver)
Definition signal.hh:302
DeletionEmitter deletionEmitter
Definition signal.hh:297
The base class for signal receiver base classes.
Definition signal.hh:254
void unconnectFrom(Emitter *emitter)
Definition signal.cc:138
void connectTo(Emitter *emitter)
Definition signal.cc:133
container::typed::List< Emitter > * emitters
Definition signal.hh:258
void intoStringBuffer(misc::StringBuffer *sb)
Store a textual representation of the object in a misc::StringBuffer.
Definition signal.cc:127