4
A Signal can be connected to multiple targets. The return
5
value of the target(s) is/are ignored.
7
template <class A1 = Void, class A2 = Void, class A3 = Void, class A4 = Void, class A5 = Void, class A6 = Void, class A7 = Void, class A8 = Void, class A9 = Void, class A10 = Void>
8
class Signal : public SignalBase {
10
typedef Invokable<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10> _Invokable;
17
/** Deeply copies rhs. */
18
Signal(const Signal& rhs)
20
Signal::operator=(rhs);
24
Connects slot to this signal, such that firing this signal
28
Connection connect(const BasicSlot<R, A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>& slot)
30
return Connection(*this, slot.clone() );
34
Invokes all slots connected to this signal, in an undefined
35
order. Their return values are ignored. Calling of connected slots will
36
be interrupted if a slot deletes this Signal object or throws an exception.
38
inline void send(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) const
40
// The sentry will set the Signal to the sending state and
41
// reset it to not-sending upon destruction. In the sending
42
// state, removing connection will leave invalid connections
43
// in the connection list to keep the iterator valid, but mark
44
// the Signal dirty. If the Signal is dirty, all invalid
45
// connections will be removed by the Sentry when it destructs..
46
SignalBase::Sentry sentry(this);
48
std::list<Connection>::const_iterator it = Connectable::connections().begin();
49
std::list<Connection>::const_iterator end = Connectable::connections().end();
51
for(; it != end; ++it)
53
if( false == it->valid() || &( it->sender() ) != this )
56
// The following scenarios must be considered when the
58
// - The slot might get deleted and thus disconnected from
60
// - The slot might delete this signal and we must end
61
// calling any slots immediately
62
// - A new Connection might get added to this Signal in
64
const _Invokable* invokable = static_cast<const _Invokable*>( it->slot().callable() );
65
invokable->invoke(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10);
67
// if this signal gets deleted by the slot, the Sentry
68
// will be detached. In this case we bail out immediately
74
/** Same as send(...). */
75
inline void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) const
76
{ this->send(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10); }
80
// BEGIN_SignalSlot 10
82
SignalSlot is a "slot wrapper" for Signal objects. That is, it
83
effectively converts a Signal object into a Slot object, so that it
84
can be used as the target of another Signal. This allows chaining of
87
template <class A1 = Void, class A2 = Void, class A3 = Void, class A4 = Void, class A5 = Void, class A6 = Void, class A7 = Void, class A8 = Void, class A9 = Void, class A10 = Void>
88
class SignalSlot : public BasicSlot<void,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>
92
SignalSlot(Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>& signal)
93
: _method( signal, &Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>::send )
96
/** Creates a clone of this object and returns it. Caller owns
97
the returned object. */
98
BasicSlot<void,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>* clone() const
99
{ return new SignalSlot(*this); }
101
/** Returns a pointer to this object's internal Callable object. */
102
virtual const void* callable() const
108
virtual bool opened(const Connection& c)
110
Connectable& connectable = _method.object();
111
return connectable.opened(c);
115
virtual void closed(const Connection& c)
117
Connectable& connectable = _method.object();
118
connectable.closed(c);
122
mutable ConstMethod<void, Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10 > _method;
125
/** Creates a SignalSlot object from an equivalent Signal. */
126
template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10>
127
SignalSlot<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10> slot( Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10> & signal )
128
{ return SignalSlot<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>( signal ); }
131
/** Connects the given signal and slot objects and returns that Connection
132
object (which can normally be ignored). */
133
template <typename R,class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10>
134
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>& signal, const BasicSlot<R,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>& slot)
136
return Connection(signal, slot.clone() );
140
//! Connects a Signal to a function.
141
template <typename R,class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10>
142
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>& signal, R(*func)(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10))
144
return connect( signal, slot(func) );
147
//! Connects a Signal to a member function.
148
template <typename R, class BaseT, class ClassT,class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10>
149
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>& signal, BaseT& object, R(ClassT::*memFunc)(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10))
151
return connect( signal, slot(object, memFunc) );
154
//! Connects a Signal to a const member function.
155
template <typename R, class ClassT,class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10>
156
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>& signal, ClassT& object, R(ClassT::*memFunc)(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) const)
158
return connect( signal, slot(object, memFunc) );
161
/** Connects a Signal to another Signal. */
162
template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10>
163
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>& sender, Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10>& receiver)
165
return connect( sender, slot(receiver) );
170
template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
171
class Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9,Void> : public SignalBase {
173
typedef Invokable<A1,A2,A3,A4,A5,A6,A7,A8,A9,Void> _Invokable;
180
/** Deeply copies rhs. */
181
Signal(const Signal& rhs)
183
Signal::operator=(rhs);
187
Connects slot to this signal, such that firing this signal
190
template <typename R>
191
Connection connect(const BasicSlot<R, A1,A2,A3,A4,A5,A6,A7,A8,A9,Void>& slot)
193
return Connection(*this, slot.clone() );
197
Invokes all slots connected to this signal, in an undefined
198
order. Their return values are ignored. Calling of connected slots will
199
be interrupted if a slot deletes this Signal object or throws an exception.
201
inline void send(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) const
203
// The sentry will set the Signal to the sending state and
204
// reset it to not-sending upon destruction. In the sending
205
// state, removing connection will leave invalid connections
206
// in the connection list to keep the iterator valid, but mark
207
// the Signal dirty. If the Signal is dirty, all invalid
208
// connections will be removed by the Sentry when it destructs..
209
SignalBase::Sentry sentry(this);
211
std::list<Connection>::const_iterator it = Connectable::connections().begin();
212
std::list<Connection>::const_iterator end = Connectable::connections().end();
214
for(; it != end; ++it)
216
if( false == it->valid() || &( it->sender() ) != this )
219
// The following scenarios must be considered when the
221
// - The slot might get deleted and thus disconnected from
223
// - The slot might delete this signal and we must end
224
// calling any slots immediately
225
// - A new Connection might get added to this Signal in
227
const _Invokable* invokable = static_cast<const _Invokable*>( it->slot().callable() );
228
invokable->invoke(a1,a2,a3,a4,a5,a6,a7,a8,a9);
230
// if this signal gets deleted by the slot, the Sentry
231
// will be detached. In this case we bail out immediately
237
/** Same as send(...). */
238
inline void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) const
239
{ this->send(a1,a2,a3,a4,a5,a6,a7,a8,a9); }
243
// BEGIN_SignalSlot 9
245
//! Connects a Signal to a function.
246
template <typename R,class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
247
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9>& signal, R(*func)(A1,A2,A3,A4,A5,A6,A7,A8,A9))
249
return connect( signal, slot(func) );
252
//! Connects a Signal to a member function.
253
template <typename R, class BaseT, class ClassT,class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
254
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9>& signal, BaseT& object, R(ClassT::*memFunc)(A1,A2,A3,A4,A5,A6,A7,A8,A9))
256
return connect( signal, slot(object, memFunc) );
259
//! Connects a Signal to a const member function.
260
template <typename R, class ClassT,class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
261
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9>& signal, ClassT& object, R(ClassT::*memFunc)(A1,A2,A3,A4,A5,A6,A7,A8,A9) const)
263
return connect( signal, slot(object, memFunc) );
266
/** Connects a Signal to another Signal. */
267
template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
268
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9>& sender, Signal<A1,A2,A3,A4,A5,A6,A7,A8,A9>& receiver)
270
return connect( sender, slot(receiver) );
275
template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
276
class Signal<A1,A2,A3,A4,A5,A6,A7,A8,Void,Void> : public SignalBase {
278
typedef Invokable<A1,A2,A3,A4,A5,A6,A7,A8,Void,Void> _Invokable;
285
/** Deeply copies rhs. */
286
Signal(const Signal& rhs)
288
Signal::operator=(rhs);
292
Connects slot to this signal, such that firing this signal
295
template <typename R>
296
Connection connect(const BasicSlot<R, A1,A2,A3,A4,A5,A6,A7,A8,Void,Void>& slot)
298
return Connection(*this, slot.clone() );
302
Invokes all slots connected to this signal, in an undefined
303
order. Their return values are ignored. Calling of connected slots will
304
be interrupted if a slot deletes this Signal object or throws an exception.
306
inline void send(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
308
// The sentry will set the Signal to the sending state and
309
// reset it to not-sending upon destruction. In the sending
310
// state, removing connection will leave invalid connections
311
// in the connection list to keep the iterator valid, but mark
312
// the Signal dirty. If the Signal is dirty, all invalid
313
// connections will be removed by the Sentry when it destructs..
314
SignalBase::Sentry sentry(this);
316
std::list<Connection>::const_iterator it = Connectable::connections().begin();
317
std::list<Connection>::const_iterator end = Connectable::connections().end();
319
for(; it != end; ++it)
321
if( false == it->valid() || &( it->sender() ) != this )
324
// The following scenarios must be considered when the
326
// - The slot might get deleted and thus disconnected from
328
// - The slot might delete this signal and we must end
329
// calling any slots immediately
330
// - A new Connection might get added to this Signal in
332
const _Invokable* invokable = static_cast<const _Invokable*>( it->slot().callable() );
333
invokable->invoke(a1,a2,a3,a4,a5,a6,a7,a8);
335
// if this signal gets deleted by the slot, the Sentry
336
// will be detached. In this case we bail out immediately
342
/** Same as send(...). */
343
inline void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const
344
{ this->send(a1,a2,a3,a4,a5,a6,a7,a8); }
348
// BEGIN_SignalSlot 8
350
//! Connects a Signal to a function.
351
template <typename R,class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
352
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8>& signal, R(*func)(A1,A2,A3,A4,A5,A6,A7,A8))
354
return connect( signal, slot(func) );
357
//! Connects a Signal to a member function.
358
template <typename R, class BaseT, class ClassT,class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
359
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8>& signal, BaseT& object, R(ClassT::*memFunc)(A1,A2,A3,A4,A5,A6,A7,A8))
361
return connect( signal, slot(object, memFunc) );
364
//! Connects a Signal to a const member function.
365
template <typename R, class ClassT,class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
366
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8>& signal, ClassT& object, R(ClassT::*memFunc)(A1,A2,A3,A4,A5,A6,A7,A8) const)
368
return connect( signal, slot(object, memFunc) );
371
/** Connects a Signal to another Signal. */
372
template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
373
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7,A8>& sender, Signal<A1,A2,A3,A4,A5,A6,A7,A8>& receiver)
375
return connect( sender, slot(receiver) );
380
template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
381
class Signal<A1,A2,A3,A4,A5,A6,A7,Void,Void,Void> : public SignalBase {
383
typedef Invokable<A1,A2,A3,A4,A5,A6,A7,Void,Void,Void> _Invokable;
390
/** Deeply copies rhs. */
391
Signal(const Signal& rhs)
393
Signal::operator=(rhs);
397
Connects slot to this signal, such that firing this signal
400
template <typename R>
401
Connection connect(const BasicSlot<R, A1,A2,A3,A4,A5,A6,A7,Void,Void,Void>& slot)
403
return Connection(*this, slot.clone() );
407
Invokes all slots connected to this signal, in an undefined
408
order. Their return values are ignored. Calling of connected slots will
409
be interrupted if a slot deletes this Signal object or throws an exception.
411
inline void send(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
413
// The sentry will set the Signal to the sending state and
414
// reset it to not-sending upon destruction. In the sending
415
// state, removing connection will leave invalid connections
416
// in the connection list to keep the iterator valid, but mark
417
// the Signal dirty. If the Signal is dirty, all invalid
418
// connections will be removed by the Sentry when it destructs..
419
SignalBase::Sentry sentry(this);
421
std::list<Connection>::const_iterator it = Connectable::connections().begin();
422
std::list<Connection>::const_iterator end = Connectable::connections().end();
424
for(; it != end; ++it)
426
if( false == it->valid() || &( it->sender() ) != this )
429
// The following scenarios must be considered when the
431
// - The slot might get deleted and thus disconnected from
433
// - The slot might delete this signal and we must end
434
// calling any slots immediately
435
// - A new Connection might get added to this Signal in
437
const _Invokable* invokable = static_cast<const _Invokable*>( it->slot().callable() );
438
invokable->invoke(a1,a2,a3,a4,a5,a6,a7);
440
// if this signal gets deleted by the slot, the Sentry
441
// will be detached. In this case we bail out immediately
447
/** Same as send(...). */
448
inline void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
449
{ this->send(a1,a2,a3,a4,a5,a6,a7); }
453
// BEGIN_SignalSlot 7
455
//! Connects a Signal to a function.
456
template <typename R,class A1, class A2, class A3, class A4, class A5, class A6, class A7>
457
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7>& signal, R(*func)(A1,A2,A3,A4,A5,A6,A7))
459
return connect( signal, slot(func) );
462
//! Connects a Signal to a member function.
463
template <typename R, class BaseT, class ClassT,class A1, class A2, class A3, class A4, class A5, class A6, class A7>
464
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7>& signal, BaseT& object, R(ClassT::*memFunc)(A1,A2,A3,A4,A5,A6,A7))
466
return connect( signal, slot(object, memFunc) );
469
//! Connects a Signal to a const member function.
470
template <typename R, class ClassT,class A1, class A2, class A3, class A4, class A5, class A6, class A7>
471
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7>& signal, ClassT& object, R(ClassT::*memFunc)(A1,A2,A3,A4,A5,A6,A7) const)
473
return connect( signal, slot(object, memFunc) );
476
/** Connects a Signal to another Signal. */
477
template <class A1, class A2, class A3, class A4, class A5, class A6, class A7>
478
Connection connect(Signal<A1,A2,A3,A4,A5,A6,A7>& sender, Signal<A1,A2,A3,A4,A5,A6,A7>& receiver)
480
return connect( sender, slot(receiver) );
485
template <class A1, class A2, class A3, class A4, class A5, class A6>
486
class Signal<A1,A2,A3,A4,A5,A6,Void,Void,Void,Void> : public SignalBase {
488
typedef Invokable<A1,A2,A3,A4,A5,A6,Void,Void,Void,Void> _Invokable;
495
/** Deeply copies rhs. */
496
Signal(const Signal& rhs)
498
Signal::operator=(rhs);
502
Connects slot to this signal, such that firing this signal
505
template <typename R>
506
Connection connect(const BasicSlot<R, A1,A2,A3,A4,A5,A6,Void,Void,Void,Void>& slot)
508
return Connection(*this, slot.clone() );
512
Invokes all slots connected to this signal, in an undefined
513
order. Their return values are ignored. Calling of connected slots will
514
be interrupted if a slot deletes this Signal object or throws an exception.
516
inline void send(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
518
// The sentry will set the Signal to the sending state and
519
// reset it to not-sending upon destruction. In the sending
520
// state, removing connection will leave invalid connections
521
// in the connection list to keep the iterator valid, but mark
522
// the Signal dirty. If the Signal is dirty, all invalid
523
// connections will be removed by the Sentry when it destructs..
524
SignalBase::Sentry sentry(this);
526
std::list<Connection>::const_iterator it = Connectable::connections().begin();
527
std::list<Connection>::const_iterator end = Connectable::connections().end();
529
for(; it != end; ++it)
531
if( false == it->valid() || &( it->sender() ) != this )
534
// The following scenarios must be considered when the
536
// - The slot might get deleted and thus disconnected from
538
// - The slot might delete this signal and we must end
539
// calling any slots immediately
540
// - A new Connection might get added to this Signal in
542
const _Invokable* invokable = static_cast<const _Invokable*>( it->slot().callable() );
543
invokable->invoke(a1,a2,a3,a4,a5,a6);
545
// if this signal gets deleted by the slot, the Sentry
546
// will be detached. In this case we bail out immediately
552
/** Same as send(...). */
553
inline void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
554
{ this->send(a1,a2,a3,a4,a5,a6); }
558
// BEGIN_SignalSlot 6
560
//! Connects a Signal to a function.
561
template <typename R,class A1, class A2, class A3, class A4, class A5, class A6>
562
Connection connect(Signal<A1,A2,A3,A4,A5,A6>& signal, R(*func)(A1,A2,A3,A4,A5,A6))
564
return connect( signal, slot(func) );
567
//! Connects a Signal to a member function.
568
template <typename R, class BaseT, class ClassT,class A1, class A2, class A3, class A4, class A5, class A6>
569
Connection connect(Signal<A1,A2,A3,A4,A5,A6>& signal, BaseT& object, R(ClassT::*memFunc)(A1,A2,A3,A4,A5,A6))
571
return connect( signal, slot(object, memFunc) );
574
//! Connects a Signal to a const member function.
575
template <typename R, class ClassT,class A1, class A2, class A3, class A4, class A5, class A6>
576
Connection connect(Signal<A1,A2,A3,A4,A5,A6>& signal, ClassT& object, R(ClassT::*memFunc)(A1,A2,A3,A4,A5,A6) const)
578
return connect( signal, slot(object, memFunc) );
581
/** Connects a Signal to another Signal. */
582
template <class A1, class A2, class A3, class A4, class A5, class A6>
583
Connection connect(Signal<A1,A2,A3,A4,A5,A6>& sender, Signal<A1,A2,A3,A4,A5,A6>& receiver)
585
return connect( sender, slot(receiver) );
590
template <class A1, class A2, class A3, class A4, class A5>
591
class Signal<A1,A2,A3,A4,A5,Void,Void,Void,Void,Void> : public SignalBase {
593
typedef Invokable<A1,A2,A3,A4,A5,Void,Void,Void,Void,Void> _Invokable;
600
/** Deeply copies rhs. */
601
Signal(const Signal& rhs)
603
Signal::operator=(rhs);
607
Connects slot to this signal, such that firing this signal
610
template <typename R>
611
Connection connect(const BasicSlot<R, A1,A2,A3,A4,A5,Void,Void,Void,Void,Void>& slot)
613
return Connection(*this, slot.clone() );
617
Invokes all slots connected to this signal, in an undefined
618
order. Their return values are ignored. Calling of connected slots will
619
be interrupted if a slot deletes this Signal object or throws an exception.
621
inline void send(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
623
// The sentry will set the Signal to the sending state and
624
// reset it to not-sending upon destruction. In the sending
625
// state, removing connection will leave invalid connections
626
// in the connection list to keep the iterator valid, but mark
627
// the Signal dirty. If the Signal is dirty, all invalid
628
// connections will be removed by the Sentry when it destructs..
629
SignalBase::Sentry sentry(this);
631
std::list<Connection>::const_iterator it = Connectable::connections().begin();
632
std::list<Connection>::const_iterator end = Connectable::connections().end();
634
for(; it != end; ++it)
636
if( false == it->valid() || &( it->sender() ) != this )
639
// The following scenarios must be considered when the
641
// - The slot might get deleted and thus disconnected from
643
// - The slot might delete this signal and we must end
644
// calling any slots immediately
645
// - A new Connection might get added to this Signal in
647
const _Invokable* invokable = static_cast<const _Invokable*>( it->slot().callable() );
648
invokable->invoke(a1,a2,a3,a4,a5);
650
// if this signal gets deleted by the slot, the Sentry
651
// will be detached. In this case we bail out immediately
657
/** Same as send(...). */
658
inline void operator()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
659
{ this->send(a1,a2,a3,a4,a5); }
663
// BEGIN_SignalSlot 5
665
//! Connects a Signal to a function.
666
template <typename R,class A1, class A2, class A3, class A4, class A5>
667
Connection connect(Signal<A1,A2,A3,A4,A5>& signal, R(*func)(A1,A2,A3,A4,A5))
669
return connect( signal, slot(func) );
672
//! Connects a Signal to a member function.
673
template <typename R, class BaseT, class ClassT,class A1, class A2, class A3, class A4, class A5>
674
Connection connect(Signal<A1,A2,A3,A4,A5>& signal, BaseT& object, R(ClassT::*memFunc)(A1,A2,A3,A4,A5))
676
return connect( signal, slot(object, memFunc) );
679
//! Connects a Signal to a const member function.
680
template <typename R, class ClassT,class A1, class A2, class A3, class A4, class A5>
681
Connection connect(Signal<A1,A2,A3,A4,A5>& signal, ClassT& object, R(ClassT::*memFunc)(A1,A2,A3,A4,A5) const)
683
return connect( signal, slot(object, memFunc) );
686
/** Connects a Signal to another Signal. */
687
template <class A1, class A2, class A3, class A4, class A5>
688
Connection connect(Signal<A1,A2,A3,A4,A5>& sender, Signal<A1,A2,A3,A4,A5>& receiver)
690
return connect( sender, slot(receiver) );
695
template <class A1, class A2, class A3, class A4>
696
class Signal<A1,A2,A3,A4,Void,Void,Void,Void,Void,Void> : public SignalBase {
698
typedef Invokable<A1,A2,A3,A4,Void,Void,Void,Void,Void,Void> _Invokable;
705
/** Deeply copies rhs. */
706
Signal(const Signal& rhs)
708
Signal::operator=(rhs);
712
Connects slot to this signal, such that firing this signal
715
template <typename R>
716
Connection connect(const BasicSlot<R, A1,A2,A3,A4,Void,Void,Void,Void,Void,Void>& slot)
718
return Connection(*this, slot.clone() );
722
Invokes all slots connected to this signal, in an undefined
723
order. Their return values are ignored. Calling of connected slots will
724
be interrupted if a slot deletes this Signal object or throws an exception.
726
inline void send(A1 a1, A2 a2, A3 a3, A4 a4) const
728
// The sentry will set the Signal to the sending state and
729
// reset it to not-sending upon destruction. In the sending
730
// state, removing connection will leave invalid connections
731
// in the connection list to keep the iterator valid, but mark
732
// the Signal dirty. If the Signal is dirty, all invalid
733
// connections will be removed by the Sentry when it destructs..
734
SignalBase::Sentry sentry(this);
736
std::list<Connection>::const_iterator it = Connectable::connections().begin();
737
std::list<Connection>::const_iterator end = Connectable::connections().end();
739
for(; it != end; ++it)
741
if( false == it->valid() || &( it->sender() ) != this )
744
// The following scenarios must be considered when the
746
// - The slot might get deleted and thus disconnected from
748
// - The slot might delete this signal and we must end
749
// calling any slots immediately
750
// - A new Connection might get added to this Signal in
752
const _Invokable* invokable = static_cast<const _Invokable*>( it->slot().callable() );
753
invokable->invoke(a1,a2,a3,a4);
755
// if this signal gets deleted by the slot, the Sentry
756
// will be detached. In this case we bail out immediately
762
/** Same as send(...). */
763
inline void operator()(A1 a1, A2 a2, A3 a3, A4 a4) const
764
{ this->send(a1,a2,a3,a4); }
768
// BEGIN_SignalSlot 4
770
//! Connects a Signal to a function.
771
template <typename R,class A1, class A2, class A3, class A4>
772
Connection connect(Signal<A1,A2,A3,A4>& signal, R(*func)(A1,A2,A3,A4))
774
return connect( signal, slot(func) );
777
//! Connects a Signal to a member function.
778
template <typename R, class BaseT, class ClassT,class A1, class A2, class A3, class A4>
779
Connection connect(Signal<A1,A2,A3,A4>& signal, BaseT& object, R(ClassT::*memFunc)(A1,A2,A3,A4))
781
return connect( signal, slot(object, memFunc) );
784
//! Connects a Signal to a const member function.
785
template <typename R, class ClassT,class A1, class A2, class A3, class A4>
786
Connection connect(Signal<A1,A2,A3,A4>& signal, ClassT& object, R(ClassT::*memFunc)(A1,A2,A3,A4) const)
788
return connect( signal, slot(object, memFunc) );
791
/** Connects a Signal to another Signal. */
792
template <class A1, class A2, class A3, class A4>
793
Connection connect(Signal<A1,A2,A3,A4>& sender, Signal<A1,A2,A3,A4>& receiver)
795
return connect( sender, slot(receiver) );
800
template <class A1, class A2, class A3>
801
class Signal<A1,A2,A3,Void,Void,Void,Void,Void,Void,Void> : public SignalBase {
803
typedef Invokable<A1,A2,A3,Void,Void,Void,Void,Void,Void,Void> _Invokable;
810
/** Deeply copies rhs. */
811
Signal(const Signal& rhs)
813
Signal::operator=(rhs);
817
Connects slot to this signal, such that firing this signal
820
template <typename R>
821
Connection connect(const BasicSlot<R, A1,A2,A3,Void,Void,Void,Void,Void,Void,Void>& slot)
823
return Connection(*this, slot.clone() );
827
Invokes all slots connected to this signal, in an undefined
828
order. Their return values are ignored. Calling of connected slots will
829
be interrupted if a slot deletes this Signal object or throws an exception.
831
inline void send(A1 a1, A2 a2, A3 a3) const
833
// The sentry will set the Signal to the sending state and
834
// reset it to not-sending upon destruction. In the sending
835
// state, removing connection will leave invalid connections
836
// in the connection list to keep the iterator valid, but mark
837
// the Signal dirty. If the Signal is dirty, all invalid
838
// connections will be removed by the Sentry when it destructs..
839
SignalBase::Sentry sentry(this);
841
std::list<Connection>::const_iterator it = Connectable::connections().begin();
842
std::list<Connection>::const_iterator end = Connectable::connections().end();
844
for(; it != end; ++it)
846
if( false == it->valid() || &( it->sender() ) != this )
849
// The following scenarios must be considered when the
851
// - The slot might get deleted and thus disconnected from
853
// - The slot might delete this signal and we must end
854
// calling any slots immediately
855
// - A new Connection might get added to this Signal in
857
const _Invokable* invokable = static_cast<const _Invokable*>( it->slot().callable() );
858
invokable->invoke(a1,a2,a3);
860
// if this signal gets deleted by the slot, the Sentry
861
// will be detached. In this case we bail out immediately
867
/** Same as send(...). */
868
inline void operator()(A1 a1, A2 a2, A3 a3) const
869
{ this->send(a1,a2,a3); }
873
// BEGIN_SignalSlot 3
875
//! Connects a Signal to a function.
876
template <typename R,class A1, class A2, class A3>
877
Connection connect(Signal<A1,A2,A3>& signal, R(*func)(A1,A2,A3))
879
return connect( signal, slot(func) );
882
//! Connects a Signal to a member function.
883
template <typename R, class BaseT, class ClassT,class A1, class A2, class A3>
884
Connection connect(Signal<A1,A2,A3>& signal, BaseT& object, R(ClassT::*memFunc)(A1,A2,A3))
886
return connect( signal, slot(object, memFunc) );
889
//! Connects a Signal to a const member function.
890
template <typename R, class ClassT,class A1, class A2, class A3>
891
Connection connect(Signal<A1,A2,A3>& signal, ClassT& object, R(ClassT::*memFunc)(A1,A2,A3) const)
893
return connect( signal, slot(object, memFunc) );
896
/** Connects a Signal to another Signal. */
897
template <class A1, class A2, class A3>
898
Connection connect(Signal<A1,A2,A3>& sender, Signal<A1,A2,A3>& receiver)
900
return connect( sender, slot(receiver) );
905
template <class A1, class A2>
906
class Signal<A1,A2,Void,Void,Void,Void,Void,Void,Void,Void> : public SignalBase {
908
typedef Invokable<A1,A2,Void,Void,Void,Void,Void,Void,Void,Void> _Invokable;
915
/** Deeply copies rhs. */
916
Signal(const Signal& rhs)
918
Signal::operator=(rhs);
922
Connects slot to this signal, such that firing this signal
925
template <typename R>
926
Connection connect(const BasicSlot<R, A1,A2,Void,Void,Void,Void,Void,Void,Void,Void>& slot)
928
return Connection(*this, slot.clone() );
932
Invokes all slots connected to this signal, in an undefined
933
order. Their return values are ignored. Calling of connected slots will
934
be interrupted if a slot deletes this Signal object or throws an exception.
936
inline void send(A1 a1, A2 a2) const
938
// The sentry will set the Signal to the sending state and
939
// reset it to not-sending upon destruction. In the sending
940
// state, removing connection will leave invalid connections
941
// in the connection list to keep the iterator valid, but mark
942
// the Signal dirty. If the Signal is dirty, all invalid
943
// connections will be removed by the Sentry when it destructs..
944
SignalBase::Sentry sentry(this);
946
std::list<Connection>::const_iterator it = Connectable::connections().begin();
947
std::list<Connection>::const_iterator end = Connectable::connections().end();
949
for(; it != end; ++it)
951
if( false == it->valid() || &( it->sender() ) != this )
954
// The following scenarios must be considered when the
956
// - The slot might get deleted and thus disconnected from
958
// - The slot might delete this signal and we must end
959
// calling any slots immediately
960
// - A new Connection might get added to this Signal in
962
const _Invokable* invokable = static_cast<const _Invokable*>( it->slot().callable() );
963
invokable->invoke(a1,a2);
965
// if this signal gets deleted by the slot, the Sentry
966
// will be detached. In this case we bail out immediately
972
/** Same as send(...). */
973
inline void operator()(A1 a1, A2 a2) const
974
{ this->send(a1,a2); }
978
// BEGIN_SignalSlot 2
980
//! Connects a Signal to a function.
981
template <typename R,class A1, class A2>
982
Connection connect(Signal<A1,A2>& signal, R(*func)(A1,A2))
984
return connect( signal, slot(func) );
987
//! Connects a Signal to a member function.
988
template <typename R, class BaseT, class ClassT,class A1, class A2>
989
Connection connect(Signal<A1,A2>& signal, BaseT& object, R(ClassT::*memFunc)(A1,A2))
991
return connect( signal, slot(object, memFunc) );
994
//! Connects a Signal to a const member function.
995
template <typename R, class ClassT,class A1, class A2>
996
Connection connect(Signal<A1,A2>& signal, ClassT& object, R(ClassT::*memFunc)(A1,A2) const)
998
return connect( signal, slot(object, memFunc) );
1001
/** Connects a Signal to another Signal. */
1002
template <class A1, class A2>
1003
Connection connect(Signal<A1,A2>& sender, Signal<A1,A2>& receiver)
1005
return connect( sender, slot(receiver) );
1011
class Signal<A1,Void,Void,Void,Void,Void,Void,Void,Void,Void> : public SignalBase {
1013
typedef Invokable<A1,Void,Void,Void,Void,Void,Void,Void,Void,Void> _Invokable;
1016
/** Does nothing. */
1020
/** Deeply copies rhs. */
1021
Signal(const Signal& rhs)
1023
Signal::operator=(rhs);
1027
Connects slot to this signal, such that firing this signal
1030
template <typename R>
1031
Connection connect(const BasicSlot<R, A1,Void,Void,Void,Void,Void,Void,Void,Void,Void>& slot)
1033
return Connection(*this, slot.clone() );
1037
Invokes all slots connected to this signal, in an undefined
1038
order. Their return values are ignored. Calling of connected slots will
1039
be interrupted if a slot deletes this Signal object or throws an exception.
1041
inline void send(A1 a1) const
1043
// The sentry will set the Signal to the sending state and
1044
// reset it to not-sending upon destruction. In the sending
1045
// state, removing connection will leave invalid connections
1046
// in the connection list to keep the iterator valid, but mark
1047
// the Signal dirty. If the Signal is dirty, all invalid
1048
// connections will be removed by the Sentry when it destructs..
1049
SignalBase::Sentry sentry(this);
1051
std::list<Connection>::const_iterator it = Connectable::connections().begin();
1052
std::list<Connection>::const_iterator end = Connectable::connections().end();
1054
for(; it != end; ++it)
1056
if( false == it->valid() || &( it->sender() ) != this )
1059
// The following scenarios must be considered when the
1061
// - The slot might get deleted and thus disconnected from
1063
// - The slot might delete this signal and we must end
1064
// calling any slots immediately
1065
// - A new Connection might get added to this Signal in
1067
const _Invokable* invokable = static_cast<const _Invokable*>( it->slot().callable() );
1068
invokable->invoke(a1);
1070
// if this signal gets deleted by the slot, the Sentry
1071
// will be detached. In this case we bail out immediately
1077
/** Same as send(...). */
1078
inline void operator()(A1 a1) const
1083
// BEGIN_SignalSlot 1
1085
//! Connects a Signal to a function.
1086
template <typename R,class A1>
1087
Connection connect(Signal<A1>& signal, R(*func)(A1))
1089
return connect( signal, slot(func) );
1092
//! Connects a Signal to a member function.
1093
template <typename R, class BaseT, class ClassT,class A1>
1094
Connection connect(Signal<A1>& signal, BaseT& object, R(ClassT::*memFunc)(A1))
1096
return connect( signal, slot(object, memFunc) );
1099
//! Connects a Signal to a const member function.
1100
template <typename R, class ClassT,class A1>
1101
Connection connect(Signal<A1>& signal, ClassT& object, R(ClassT::*memFunc)(A1) const)
1103
return connect( signal, slot(object, memFunc) );
1106
/** Connects a Signal to another Signal. */
1108
Connection connect(Signal<A1>& sender, Signal<A1>& receiver)
1110
return connect( sender, slot(receiver) );
1116
class Signal<Void,Void,Void,Void,Void,Void,Void,Void,Void,Void> : public SignalBase {
1118
typedef Invokable<Void,Void,Void,Void,Void,Void,Void,Void,Void,Void> _Invokable;
1121
/** Does nothing. */
1125
/** Deeply copies rhs. */
1126
Signal(const Signal& rhs)
1128
Signal::operator=(rhs);
1132
Connects slot to this signal, such that firing this signal
1135
template <typename R>
1136
Connection connect(const BasicSlot<R, Void,Void,Void,Void,Void,Void,Void,Void,Void,Void>& slot)
1138
return Connection(*this, slot.clone() );
1142
Invokes all slots connected to this signal, in an undefined
1143
order. Their return values are ignored. Calling of connected slots will
1144
be interrupted if a slot deletes this Signal object or throws an exception.
1146
inline void send() const
1148
// The sentry will set the Signal to the sending state and
1149
// reset it to not-sending upon destruction. In the sending
1150
// state, removing connection will leave invalid connections
1151
// in the connection list to keep the iterator valid, but mark
1152
// the Signal dirty. If the Signal is dirty, all invalid
1153
// connections will be removed by the Sentry when it destructs..
1154
SignalBase::Sentry sentry(this);
1156
std::list<Connection>::const_iterator it = Connectable::connections().begin();
1157
std::list<Connection>::const_iterator end = Connectable::connections().end();
1159
for(; it != end; ++it)
1161
if( false == it->valid() || &( it->sender() ) != this )
1164
// The following scenarios must be considered when the
1166
// - The slot might get deleted and thus disconnected from
1168
// - The slot might delete this signal and we must end
1169
// calling any slots immediately
1170
// - A new Connection might get added to this Signal in
1172
const _Invokable* invokable = static_cast<const _Invokable*>( it->slot().callable() );
1173
invokable->invoke();
1175
// if this signal gets deleted by the slot, the Sentry
1176
// will be detached. In this case we bail out immediately
1182
/** Same as send(...). */
1183
inline void operator()() const
1188
// BEGIN_SignalSlot 0
1190
//! Connects a Signal to a function.
1191
template <typename R>
1192
Connection connect(Signal<>& signal, R(*func)())
1194
return connect( signal, slot(func) );
1197
//! Connects a Signal to a member function.
1198
template <typename R, class BaseT, class ClassT>
1199
Connection connect(Signal<>& signal, BaseT& object, R(ClassT::*memFunc)())
1201
return connect( signal, slot(object, memFunc) );
1204
//! Connects a Signal to a const member function.
1205
template <typename R, class ClassT>
1206
Connection connect(Signal<>& signal, ClassT& object, R(ClassT::*memFunc)() const)
1208
return connect( signal, slot(object, memFunc) );
1211
/** Connects a Signal to another Signal. */
1212
inline Connection connect(Signal<>& sender, Signal<>& receiver)
1214
return connect( sender, slot(receiver) );