media/mtransport/sigslot.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // sigslot.h: Signal/Slot classes
michael@0 2 //
michael@0 3 // Written by Sarah Thompson (sarah@telergy.com) 2002.
michael@0 4 //
michael@0 5 // License: Public domain. You are free to use this code however you like, with the proviso that
michael@0 6 // the author takes on no responsibility or liability for any use.
michael@0 7 //
michael@0 8 // QUICK DOCUMENTATION
michael@0 9 //
michael@0 10 // (see also the full documentation at http://sigslot.sourceforge.net/)
michael@0 11 //
michael@0 12 // #define switches
michael@0 13 // SIGSLOT_PURE_ISO - Define this to force ISO C++ compliance. This also disables
michael@0 14 // all of the thread safety support on platforms where it is
michael@0 15 // available.
michael@0 16 //
michael@0 17 // SIGSLOT_USE_POSIX_THREADS - Force use of Posix threads when using a C++ compiler other than
michael@0 18 // gcc on a platform that supports Posix threads. (When using gcc,
michael@0 19 // this is the default - use SIGSLOT_PURE_ISO to disable this if
michael@0 20 // necessary)
michael@0 21 //
michael@0 22 // SIGSLOT_DEFAULT_MT_POLICY - Where thread support is enabled, this defaults to multi_threaded_global.
michael@0 23 // Otherwise, the default is single_threaded. #define this yourself to
michael@0 24 // override the default. In pure ISO mode, anything other than
michael@0 25 // single_threaded will cause a compiler error.
michael@0 26 //
michael@0 27 // PLATFORM NOTES
michael@0 28 //
michael@0 29 // Win32 - On Win32, the WIN32 symbol must be #defined. Most mainstream
michael@0 30 // compilers do this by default, but you may need to define it
michael@0 31 // yourself if your build environment is less standard. This causes
michael@0 32 // the Win32 thread support to be compiled in and used automatically.
michael@0 33 //
michael@0 34 // Unix/Linux/BSD, etc. - If you're using gcc, it is assumed that you have Posix threads
michael@0 35 // available, so they are used automatically. You can override this
michael@0 36 // (as under Windows) with the SIGSLOT_PURE_ISO switch. If you're using
michael@0 37 // something other than gcc but still want to use Posix threads, you
michael@0 38 // need to #define SIGSLOT_USE_POSIX_THREADS.
michael@0 39 //
michael@0 40 // ISO C++ - If none of the supported platforms are detected, or if
michael@0 41 // SIGSLOT_PURE_ISO is defined, all multithreading support is turned off,
michael@0 42 // along with any code that might cause a pure ISO C++ environment to
michael@0 43 // complain. Before you ask, gcc -ansi -pedantic won't compile this
michael@0 44 // library, but gcc -ansi is fine. Pedantic mode seems to throw a lot of
michael@0 45 // errors that aren't really there. If you feel like investigating this,
michael@0 46 // please contact the author.
michael@0 47 //
michael@0 48 //
michael@0 49 // THREADING MODES
michael@0 50 //
michael@0 51 // single_threaded - Your program is assumed to be single threaded from the point of view
michael@0 52 // of signal/slot usage (i.e. all objects using signals and slots are
michael@0 53 // created and destroyed from a single thread). Behaviour if objects are
michael@0 54 // destroyed concurrently is undefined (i.e. you'll get the occasional
michael@0 55 // segmentation fault/memory exception).
michael@0 56 //
michael@0 57 // multi_threaded_global - Your program is assumed to be multi threaded. Objects using signals and
michael@0 58 // slots can be safely created and destroyed from any thread, even when
michael@0 59 // connections exist. In multi_threaded_global mode, this is achieved by a
michael@0 60 // single global mutex (actually a critical section on Windows because they
michael@0 61 // are faster). This option uses less OS resources, but results in more
michael@0 62 // opportunities for contention, possibly resulting in more context switches
michael@0 63 // than are strictly necessary.
michael@0 64 //
michael@0 65 // multi_threaded_local - Behaviour in this mode is essentially the same as multi_threaded_global,
michael@0 66 // except that each signal, and each object that inherits has_slots, all
michael@0 67 // have their own mutex/critical section. In practice, this means that
michael@0 68 // mutex collisions (and hence context switches) only happen if they are
michael@0 69 // absolutely essential. However, on some platforms, creating a lot of
michael@0 70 // mutexes can slow down the whole OS, so use this option with care.
michael@0 71 //
michael@0 72 // USING THE LIBRARY
michael@0 73 //
michael@0 74 // See the full documentation at http://sigslot.sourceforge.net/
michael@0 75 //
michael@0 76 //
michael@0 77 // Libjingle specific:
michael@0 78 // This file has been modified such that has_slots and signalx do not have to be
michael@0 79 // using the same threading requirements. E.g. it is possible to connect a
michael@0 80 // has_slots<single_threaded> and signal0<multi_threaded_local> or
michael@0 81 // has_slots<multi_threaded_local> and signal0<single_threaded>.
michael@0 82 // If has_slots is single threaded the user must ensure that it is not trying
michael@0 83 // to connect or disconnect to signalx concurrently or data race may occur.
michael@0 84 // If signalx is single threaded the user must ensure that disconnect, connect
michael@0 85 // or signal is not happening concurrently or data race may occur.
michael@0 86
michael@0 87 #ifndef TALK_BASE_SIGSLOT_H__
michael@0 88 #define TALK_BASE_SIGSLOT_H__
michael@0 89
michael@0 90 #include <list>
michael@0 91 #include <set>
michael@0 92 #include <stdlib.h>
michael@0 93
michael@0 94 // On our copy of sigslot.h, we set single threading as default.
michael@0 95 #define SIGSLOT_DEFAULT_MT_POLICY single_threaded
michael@0 96
michael@0 97 // For now, this avoids windows.h in bindings (PeerConnectionImpl.h) on WIN32
michael@0 98 // TODO: wrap win32 crit section and move to another file instead (Bug 932570)
michael@0 99 #define SIGSLOT_LEAVE_OUT_MULTITHREADING 1
michael@0 100
michael@0 101 #if defined(SIGSLOT_PURE_ISO) || (!defined(WIN32) && !defined(__GNUG__) && !defined(SIGSLOT_USE_POSIX_THREADS))
michael@0 102 # define _SIGSLOT_SINGLE_THREADED
michael@0 103 #elif defined(WIN32)
michael@0 104 # define _SIGSLOT_HAS_WIN32_THREADS
michael@0 105 # ifndef SIGSLOT_LEAVE_OUT_MULTITHREADING
michael@0 106 # if !defined(WIN32_LEAN_AND_MEAN)
michael@0 107 # define WIN32_LEAN_AND_MEAN
michael@0 108 # endif
michael@0 109 # include "windows.h"
michael@0 110 # endif
michael@0 111 #elif defined(__GNUG__) || defined(SIGSLOT_USE_POSIX_THREADS)
michael@0 112 # define _SIGSLOT_HAS_POSIX_THREADS
michael@0 113 # include <pthread.h>
michael@0 114 #else
michael@0 115 # define _SIGSLOT_SINGLE_THREADED
michael@0 116 #endif
michael@0 117
michael@0 118 #ifndef SIGSLOT_DEFAULT_MT_POLICY
michael@0 119 # ifdef _SIGSLOT_SINGLE_THREADED
michael@0 120 # define SIGSLOT_DEFAULT_MT_POLICY single_threaded
michael@0 121 # else
michael@0 122 # define SIGSLOT_DEFAULT_MT_POLICY multi_threaded_local
michael@0 123 # endif
michael@0 124 #endif
michael@0 125
michael@0 126 // TODO: change this namespace to talk_base?
michael@0 127 namespace sigslot {
michael@0 128
michael@0 129 class single_threaded
michael@0 130 {
michael@0 131 public:
michael@0 132 single_threaded()
michael@0 133 {
michael@0 134 ;
michael@0 135 }
michael@0 136
michael@0 137 virtual ~single_threaded()
michael@0 138 {
michael@0 139 ;
michael@0 140 }
michael@0 141
michael@0 142 virtual void lock()
michael@0 143 {
michael@0 144 ;
michael@0 145 }
michael@0 146
michael@0 147 virtual void unlock()
michael@0 148 {
michael@0 149 ;
michael@0 150 }
michael@0 151 };
michael@0 152
michael@0 153 #ifndef SIGSLOT_LEAVE_OUT_MULTITHREADING
michael@0 154 # ifdef _SIGSLOT_HAS_WIN32_THREADS
michael@0 155
michael@0 156 // The multi threading policies only get compiled in if they are enabled.
michael@0 157 class multi_threaded_global
michael@0 158 {
michael@0 159 public:
michael@0 160 multi_threaded_global()
michael@0 161 {
michael@0 162 static bool isinitialised = false;
michael@0 163
michael@0 164 if(!isinitialised)
michael@0 165 {
michael@0 166 InitializeCriticalSection(get_critsec());
michael@0 167 isinitialised = true;
michael@0 168 }
michael@0 169 }
michael@0 170
michael@0 171 multi_threaded_global(const multi_threaded_global&)
michael@0 172 {
michael@0 173 ;
michael@0 174 }
michael@0 175
michael@0 176 virtual ~multi_threaded_global()
michael@0 177 {
michael@0 178 ;
michael@0 179 }
michael@0 180
michael@0 181 virtual void lock()
michael@0 182 {
michael@0 183 EnterCriticalSection(get_critsec());
michael@0 184 }
michael@0 185
michael@0 186 virtual void unlock()
michael@0 187 {
michael@0 188 LeaveCriticalSection(get_critsec());
michael@0 189 }
michael@0 190
michael@0 191 private:
michael@0 192 CRITICAL_SECTION* get_critsec()
michael@0 193 {
michael@0 194 static CRITICAL_SECTION g_critsec;
michael@0 195 return &g_critsec;
michael@0 196 }
michael@0 197 };
michael@0 198
michael@0 199 class multi_threaded_local
michael@0 200 {
michael@0 201 public:
michael@0 202 multi_threaded_local()
michael@0 203 {
michael@0 204 InitializeCriticalSection(&m_critsec);
michael@0 205 }
michael@0 206
michael@0 207 multi_threaded_local(const multi_threaded_local&)
michael@0 208 {
michael@0 209 InitializeCriticalSection(&m_critsec);
michael@0 210 }
michael@0 211
michael@0 212 virtual ~multi_threaded_local()
michael@0 213 {
michael@0 214 DeleteCriticalSection(&m_critsec);
michael@0 215 }
michael@0 216
michael@0 217 virtual void lock()
michael@0 218 {
michael@0 219 EnterCriticalSection(&m_critsec);
michael@0 220 }
michael@0 221
michael@0 222 virtual void unlock()
michael@0 223 {
michael@0 224 LeaveCriticalSection(&m_critsec);
michael@0 225 }
michael@0 226
michael@0 227 private:
michael@0 228 CRITICAL_SECTION m_critsec;
michael@0 229 };
michael@0 230 # endif // _SIGSLOT_HAS_WIN32_THREADS
michael@0 231
michael@0 232 # ifdef _SIGSLOT_HAS_POSIX_THREADS
michael@0 233 // The multi threading policies only get compiled in if they are enabled.
michael@0 234 class multi_threaded_global
michael@0 235 {
michael@0 236 public:
michael@0 237 multi_threaded_global()
michael@0 238 {
michael@0 239 pthread_mutex_init(get_mutex(), NULL);
michael@0 240 }
michael@0 241
michael@0 242 multi_threaded_global(const multi_threaded_global&)
michael@0 243 {
michael@0 244 ;
michael@0 245 }
michael@0 246
michael@0 247 virtual ~multi_threaded_global()
michael@0 248 {
michael@0 249 ;
michael@0 250 }
michael@0 251
michael@0 252 virtual void lock()
michael@0 253 {
michael@0 254 pthread_mutex_lock(get_mutex());
michael@0 255 }
michael@0 256
michael@0 257 virtual void unlock()
michael@0 258 {
michael@0 259 pthread_mutex_unlock(get_mutex());
michael@0 260 }
michael@0 261
michael@0 262 private:
michael@0 263 pthread_mutex_t* get_mutex()
michael@0 264 {
michael@0 265 static pthread_mutex_t g_mutex;
michael@0 266 return &g_mutex;
michael@0 267 }
michael@0 268 };
michael@0 269
michael@0 270 class multi_threaded_local
michael@0 271 {
michael@0 272 public:
michael@0 273 multi_threaded_local()
michael@0 274 {
michael@0 275 pthread_mutex_init(&m_mutex, NULL);
michael@0 276 }
michael@0 277
michael@0 278 multi_threaded_local(const multi_threaded_local&)
michael@0 279 {
michael@0 280 pthread_mutex_init(&m_mutex, NULL);
michael@0 281 }
michael@0 282
michael@0 283 virtual ~multi_threaded_local()
michael@0 284 {
michael@0 285 pthread_mutex_destroy(&m_mutex);
michael@0 286 }
michael@0 287
michael@0 288 virtual void lock()
michael@0 289 {
michael@0 290 pthread_mutex_lock(&m_mutex);
michael@0 291 }
michael@0 292
michael@0 293 virtual void unlock()
michael@0 294 {
michael@0 295 pthread_mutex_unlock(&m_mutex);
michael@0 296 }
michael@0 297
michael@0 298 private:
michael@0 299 pthread_mutex_t m_mutex;
michael@0 300 };
michael@0 301 # endif // _SIGSLOT_HAS_POSIX_THREADS
michael@0 302 #endif // SIGSLOT_LEAVE_OUT_MULTITHREADING
michael@0 303
michael@0 304 template<class mt_policy>
michael@0 305 class lock_block
michael@0 306 {
michael@0 307 public:
michael@0 308 mt_policy *m_mutex;
michael@0 309
michael@0 310 lock_block(mt_policy *mtx)
michael@0 311 : m_mutex(mtx)
michael@0 312 {
michael@0 313 m_mutex->lock();
michael@0 314 }
michael@0 315
michael@0 316 ~lock_block()
michael@0 317 {
michael@0 318 m_mutex->unlock();
michael@0 319 }
michael@0 320 };
michael@0 321
michael@0 322 class has_slots_interface;
michael@0 323
michael@0 324 template<class mt_policy>
michael@0 325 class _connection_base0
michael@0 326 {
michael@0 327 public:
michael@0 328 virtual ~_connection_base0() {}
michael@0 329 virtual has_slots_interface* getdest() const = 0;
michael@0 330 virtual void emit() = 0;
michael@0 331 virtual _connection_base0* clone() = 0;
michael@0 332 virtual _connection_base0* duplicate(has_slots_interface* pnewdest) = 0;
michael@0 333 };
michael@0 334
michael@0 335 template<class arg1_type, class mt_policy>
michael@0 336 class _connection_base1
michael@0 337 {
michael@0 338 public:
michael@0 339 virtual ~_connection_base1() {}
michael@0 340 virtual has_slots_interface* getdest() const = 0;
michael@0 341 virtual void emit(arg1_type) = 0;
michael@0 342 virtual _connection_base1<arg1_type, mt_policy>* clone() = 0;
michael@0 343 virtual _connection_base1<arg1_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
michael@0 344 };
michael@0 345
michael@0 346 template<class arg1_type, class arg2_type, class mt_policy>
michael@0 347 class _connection_base2
michael@0 348 {
michael@0 349 public:
michael@0 350 virtual ~_connection_base2() {}
michael@0 351 virtual has_slots_interface* getdest() const = 0;
michael@0 352 virtual void emit(arg1_type, arg2_type) = 0;
michael@0 353 virtual _connection_base2<arg1_type, arg2_type, mt_policy>* clone() = 0;
michael@0 354 virtual _connection_base2<arg1_type, arg2_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
michael@0 355 };
michael@0 356
michael@0 357 template<class arg1_type, class arg2_type, class arg3_type, class mt_policy>
michael@0 358 class _connection_base3
michael@0 359 {
michael@0 360 public:
michael@0 361 virtual ~_connection_base3() {}
michael@0 362 virtual has_slots_interface* getdest() const = 0;
michael@0 363 virtual void emit(arg1_type, arg2_type, arg3_type) = 0;
michael@0 364 virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* clone() = 0;
michael@0 365 virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
michael@0 366 };
michael@0 367
michael@0 368 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy>
michael@0 369 class _connection_base4
michael@0 370 {
michael@0 371 public:
michael@0 372 virtual ~_connection_base4() {}
michael@0 373 virtual has_slots_interface* getdest() const = 0;
michael@0 374 virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type) = 0;
michael@0 375 virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* clone() = 0;
michael@0 376 virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
michael@0 377 };
michael@0 378
michael@0 379 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
michael@0 380 class arg5_type, class mt_policy>
michael@0 381 class _connection_base5
michael@0 382 {
michael@0 383 public:
michael@0 384 virtual ~_connection_base5() {}
michael@0 385 virtual has_slots_interface* getdest() const = 0;
michael@0 386 virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 387 arg5_type) = 0;
michael@0 388 virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 389 arg5_type, mt_policy>* clone() = 0;
michael@0 390 virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 391 arg5_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
michael@0 392 };
michael@0 393
michael@0 394 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
michael@0 395 class arg5_type, class arg6_type, class mt_policy>
michael@0 396 class _connection_base6
michael@0 397 {
michael@0 398 public:
michael@0 399 virtual ~_connection_base6() {}
michael@0 400 virtual has_slots_interface* getdest() const = 0;
michael@0 401 virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
michael@0 402 arg6_type) = 0;
michael@0 403 virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 404 arg5_type, arg6_type, mt_policy>* clone() = 0;
michael@0 405 virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 406 arg5_type, arg6_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
michael@0 407 };
michael@0 408
michael@0 409 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
michael@0 410 class arg5_type, class arg6_type, class arg7_type, class mt_policy>
michael@0 411 class _connection_base7
michael@0 412 {
michael@0 413 public:
michael@0 414 virtual ~_connection_base7() {}
michael@0 415 virtual has_slots_interface* getdest() const = 0;
michael@0 416 virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
michael@0 417 arg6_type, arg7_type) = 0;
michael@0 418 virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 419 arg5_type, arg6_type, arg7_type, mt_policy>* clone() = 0;
michael@0 420 virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 421 arg5_type, arg6_type, arg7_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
michael@0 422 };
michael@0 423
michael@0 424 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
michael@0 425 class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy>
michael@0 426 class _connection_base8
michael@0 427 {
michael@0 428 public:
michael@0 429 virtual ~_connection_base8() {}
michael@0 430 virtual has_slots_interface* getdest() const = 0;
michael@0 431 virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
michael@0 432 arg6_type, arg7_type, arg8_type) = 0;
michael@0 433 virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 434 arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* clone() = 0;
michael@0 435 virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 436 arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
michael@0 437 };
michael@0 438
michael@0 439 class _signal_base_interface
michael@0 440 {
michael@0 441 public:
michael@0 442 virtual void slot_disconnect(has_slots_interface* pslot) = 0;
michael@0 443 virtual void slot_duplicate(const has_slots_interface* poldslot, has_slots_interface* pnewslot) = 0;
michael@0 444 };
michael@0 445
michael@0 446 template<class mt_policy>
michael@0 447 class _signal_base : public _signal_base_interface, public mt_policy
michael@0 448 {
michael@0 449 };
michael@0 450
michael@0 451 class has_slots_interface
michael@0 452 {
michael@0 453 public:
michael@0 454 has_slots_interface()
michael@0 455 {
michael@0 456 ;
michael@0 457 }
michael@0 458
michael@0 459 virtual void signal_connect(_signal_base_interface* sender) = 0;
michael@0 460
michael@0 461 virtual void signal_disconnect(_signal_base_interface* sender) = 0;
michael@0 462
michael@0 463 virtual ~has_slots_interface()
michael@0 464 {
michael@0 465 }
michael@0 466
michael@0 467 virtual void disconnect_all() = 0;
michael@0 468 };
michael@0 469
michael@0 470 template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
michael@0 471 class has_slots : public has_slots_interface, public mt_policy
michael@0 472 {
michael@0 473 private:
michael@0 474 typedef std::set<_signal_base_interface*> sender_set;
michael@0 475 typedef sender_set::const_iterator const_iterator;
michael@0 476
michael@0 477 public:
michael@0 478 has_slots()
michael@0 479 {
michael@0 480 ;
michael@0 481 }
michael@0 482
michael@0 483 has_slots(const has_slots& hs)
michael@0 484 {
michael@0 485 lock_block<mt_policy> lock(this);
michael@0 486 const_iterator it = hs.m_senders.begin();
michael@0 487 const_iterator itEnd = hs.m_senders.end();
michael@0 488
michael@0 489 while(it != itEnd)
michael@0 490 {
michael@0 491 (*it)->slot_duplicate(&hs, this);
michael@0 492 m_senders.insert(*it);
michael@0 493 ++it;
michael@0 494 }
michael@0 495 }
michael@0 496
michael@0 497 void signal_connect(_signal_base_interface* sender)
michael@0 498 {
michael@0 499 lock_block<mt_policy> lock(this);
michael@0 500 m_senders.insert(sender);
michael@0 501 }
michael@0 502
michael@0 503 void signal_disconnect(_signal_base_interface* sender)
michael@0 504 {
michael@0 505 lock_block<mt_policy> lock(this);
michael@0 506 m_senders.erase(sender);
michael@0 507 }
michael@0 508
michael@0 509 virtual ~has_slots()
michael@0 510 {
michael@0 511 disconnect_all();
michael@0 512 }
michael@0 513
michael@0 514 void disconnect_all()
michael@0 515 {
michael@0 516 lock_block<mt_policy> lock(this);
michael@0 517 const_iterator it = m_senders.begin();
michael@0 518 const_iterator itEnd = m_senders.end();
michael@0 519
michael@0 520 while(it != itEnd)
michael@0 521 {
michael@0 522 (*it)->slot_disconnect(this);
michael@0 523 ++it;
michael@0 524 }
michael@0 525
michael@0 526 m_senders.erase(m_senders.begin(), m_senders.end());
michael@0 527 }
michael@0 528
michael@0 529 private:
michael@0 530 sender_set m_senders;
michael@0 531 };
michael@0 532
michael@0 533 template<class mt_policy>
michael@0 534 class _signal_base0 : public _signal_base<mt_policy>
michael@0 535 {
michael@0 536 public:
michael@0 537 typedef std::list<_connection_base0<mt_policy> *> connections_list;
michael@0 538
michael@0 539 _signal_base0()
michael@0 540 {
michael@0 541 ;
michael@0 542 }
michael@0 543
michael@0 544 _signal_base0(const _signal_base0& s)
michael@0 545 : _signal_base<mt_policy>(s)
michael@0 546 {
michael@0 547 lock_block<mt_policy> lock(this);
michael@0 548 typename connections_list::const_iterator it = s.m_connected_slots.begin();
michael@0 549 typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
michael@0 550
michael@0 551 while(it != itEnd)
michael@0 552 {
michael@0 553 (*it)->getdest()->signal_connect(this);
michael@0 554 m_connected_slots.push_back((*it)->clone());
michael@0 555
michael@0 556 ++it;
michael@0 557 }
michael@0 558 }
michael@0 559
michael@0 560 ~_signal_base0()
michael@0 561 {
michael@0 562 disconnect_all();
michael@0 563 }
michael@0 564
michael@0 565 bool is_empty()
michael@0 566 {
michael@0 567 lock_block<mt_policy> lock(this);
michael@0 568 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 569 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 570 return it == itEnd;
michael@0 571 }
michael@0 572
michael@0 573 void disconnect_all()
michael@0 574 {
michael@0 575 lock_block<mt_policy> lock(this);
michael@0 576 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 577 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 578
michael@0 579 while(it != itEnd)
michael@0 580 {
michael@0 581 (*it)->getdest()->signal_disconnect(this);
michael@0 582 delete *it;
michael@0 583
michael@0 584 ++it;
michael@0 585 }
michael@0 586
michael@0 587 m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
michael@0 588 }
michael@0 589
michael@0 590 #ifdef _DEBUG
michael@0 591 bool connected(has_slots_interface* pclass)
michael@0 592 {
michael@0 593 lock_block<mt_policy> lock(this);
michael@0 594 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 595 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 596 while(it != itEnd)
michael@0 597 {
michael@0 598 itNext = it;
michael@0 599 ++itNext;
michael@0 600 if ((*it)->getdest() == pclass)
michael@0 601 return true;
michael@0 602 it = itNext;
michael@0 603 }
michael@0 604 return false;
michael@0 605 }
michael@0 606 #endif
michael@0 607
michael@0 608 void disconnect(has_slots_interface* pclass)
michael@0 609 {
michael@0 610 lock_block<mt_policy> lock(this);
michael@0 611 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 612 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 613
michael@0 614 while(it != itEnd)
michael@0 615 {
michael@0 616 if((*it)->getdest() == pclass)
michael@0 617 {
michael@0 618 delete *it;
michael@0 619 m_connected_slots.erase(it);
michael@0 620 pclass->signal_disconnect(this);
michael@0 621 return;
michael@0 622 }
michael@0 623
michael@0 624 ++it;
michael@0 625 }
michael@0 626 }
michael@0 627
michael@0 628 void slot_disconnect(has_slots_interface* pslot)
michael@0 629 {
michael@0 630 lock_block<mt_policy> lock(this);
michael@0 631 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 632 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 633
michael@0 634 while(it != itEnd)
michael@0 635 {
michael@0 636 typename connections_list::iterator itNext = it;
michael@0 637 ++itNext;
michael@0 638
michael@0 639 if((*it)->getdest() == pslot)
michael@0 640 {
michael@0 641 delete *it;
michael@0 642 m_connected_slots.erase(it);
michael@0 643 }
michael@0 644
michael@0 645 it = itNext;
michael@0 646 }
michael@0 647 }
michael@0 648
michael@0 649 void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
michael@0 650 {
michael@0 651 lock_block<mt_policy> lock(this);
michael@0 652 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 653 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 654
michael@0 655 while(it != itEnd)
michael@0 656 {
michael@0 657 if((*it)->getdest() == oldtarget)
michael@0 658 {
michael@0 659 m_connected_slots.push_back((*it)->duplicate(newtarget));
michael@0 660 }
michael@0 661
michael@0 662 ++it;
michael@0 663 }
michael@0 664 }
michael@0 665
michael@0 666 protected:
michael@0 667 connections_list m_connected_slots;
michael@0 668 };
michael@0 669
michael@0 670 template<class arg1_type, class mt_policy>
michael@0 671 class _signal_base1 : public _signal_base<mt_policy>
michael@0 672 {
michael@0 673 public:
michael@0 674 typedef std::list<_connection_base1<arg1_type, mt_policy> *> connections_list;
michael@0 675
michael@0 676 _signal_base1()
michael@0 677 {
michael@0 678 ;
michael@0 679 }
michael@0 680
michael@0 681 _signal_base1(const _signal_base1<arg1_type, mt_policy>& s)
michael@0 682 : _signal_base<mt_policy>(s)
michael@0 683 {
michael@0 684 lock_block<mt_policy> lock(this);
michael@0 685 typename connections_list::const_iterator it = s.m_connected_slots.begin();
michael@0 686 typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
michael@0 687
michael@0 688 while(it != itEnd)
michael@0 689 {
michael@0 690 (*it)->getdest()->signal_connect(this);
michael@0 691 m_connected_slots.push_back((*it)->clone());
michael@0 692
michael@0 693 ++it;
michael@0 694 }
michael@0 695 }
michael@0 696
michael@0 697 void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
michael@0 698 {
michael@0 699 lock_block<mt_policy> lock(this);
michael@0 700 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 701 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 702
michael@0 703 while(it != itEnd)
michael@0 704 {
michael@0 705 if((*it)->getdest() == oldtarget)
michael@0 706 {
michael@0 707 m_connected_slots.push_back((*it)->duplicate(newtarget));
michael@0 708 }
michael@0 709
michael@0 710 ++it;
michael@0 711 }
michael@0 712 }
michael@0 713
michael@0 714 ~_signal_base1()
michael@0 715 {
michael@0 716 disconnect_all();
michael@0 717 }
michael@0 718
michael@0 719 bool is_empty()
michael@0 720 {
michael@0 721 lock_block<mt_policy> lock(this);
michael@0 722 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 723 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 724 return it == itEnd;
michael@0 725 }
michael@0 726
michael@0 727 void disconnect_all()
michael@0 728 {
michael@0 729 lock_block<mt_policy> lock(this);
michael@0 730 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 731 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 732
michael@0 733 while(it != itEnd)
michael@0 734 {
michael@0 735 (*it)->getdest()->signal_disconnect(this);
michael@0 736 delete *it;
michael@0 737
michael@0 738 ++it;
michael@0 739 }
michael@0 740
michael@0 741 m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
michael@0 742 }
michael@0 743
michael@0 744 #ifdef _DEBUG
michael@0 745 bool connected(has_slots_interface* pclass)
michael@0 746 {
michael@0 747 lock_block<mt_policy> lock(this);
michael@0 748 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 749 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 750 while(it != itEnd)
michael@0 751 {
michael@0 752 itNext = it;
michael@0 753 ++itNext;
michael@0 754 if ((*it)->getdest() == pclass)
michael@0 755 return true;
michael@0 756 it = itNext;
michael@0 757 }
michael@0 758 return false;
michael@0 759 }
michael@0 760 #endif
michael@0 761
michael@0 762 void disconnect(has_slots_interface* pclass)
michael@0 763 {
michael@0 764 lock_block<mt_policy> lock(this);
michael@0 765 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 766 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 767
michael@0 768 while(it != itEnd)
michael@0 769 {
michael@0 770 if((*it)->getdest() == pclass)
michael@0 771 {
michael@0 772 delete *it;
michael@0 773 m_connected_slots.erase(it);
michael@0 774 pclass->signal_disconnect(this);
michael@0 775 return;
michael@0 776 }
michael@0 777
michael@0 778 ++it;
michael@0 779 }
michael@0 780 }
michael@0 781
michael@0 782 void slot_disconnect(has_slots_interface* pslot)
michael@0 783 {
michael@0 784 lock_block<mt_policy> lock(this);
michael@0 785 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 786 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 787
michael@0 788 while(it != itEnd)
michael@0 789 {
michael@0 790 typename connections_list::iterator itNext = it;
michael@0 791 ++itNext;
michael@0 792
michael@0 793 if((*it)->getdest() == pslot)
michael@0 794 {
michael@0 795 delete *it;
michael@0 796 m_connected_slots.erase(it);
michael@0 797 }
michael@0 798
michael@0 799 it = itNext;
michael@0 800 }
michael@0 801 }
michael@0 802
michael@0 803
michael@0 804 protected:
michael@0 805 connections_list m_connected_slots;
michael@0 806 };
michael@0 807
michael@0 808 template<class arg1_type, class arg2_type, class mt_policy>
michael@0 809 class _signal_base2 : public _signal_base<mt_policy>
michael@0 810 {
michael@0 811 public:
michael@0 812 typedef std::list<_connection_base2<arg1_type, arg2_type, mt_policy> *>
michael@0 813 connections_list;
michael@0 814
michael@0 815 _signal_base2()
michael@0 816 {
michael@0 817 ;
michael@0 818 }
michael@0 819
michael@0 820 _signal_base2(const _signal_base2<arg1_type, arg2_type, mt_policy>& s)
michael@0 821 : _signal_base<mt_policy>(s)
michael@0 822 {
michael@0 823 lock_block<mt_policy> lock(this);
michael@0 824 typename connections_list::const_iterator it = s.m_connected_slots.begin();
michael@0 825 typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
michael@0 826
michael@0 827 while(it != itEnd)
michael@0 828 {
michael@0 829 (*it)->getdest()->signal_connect(this);
michael@0 830 m_connected_slots.push_back((*it)->clone());
michael@0 831
michael@0 832 ++it;
michael@0 833 }
michael@0 834 }
michael@0 835
michael@0 836 void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
michael@0 837 {
michael@0 838 lock_block<mt_policy> lock(this);
michael@0 839 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 840 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 841
michael@0 842 while(it != itEnd)
michael@0 843 {
michael@0 844 if((*it)->getdest() == oldtarget)
michael@0 845 {
michael@0 846 m_connected_slots.push_back((*it)->duplicate(newtarget));
michael@0 847 }
michael@0 848
michael@0 849 ++it;
michael@0 850 }
michael@0 851 }
michael@0 852
michael@0 853 ~_signal_base2()
michael@0 854 {
michael@0 855 disconnect_all();
michael@0 856 }
michael@0 857
michael@0 858 bool is_empty()
michael@0 859 {
michael@0 860 lock_block<mt_policy> lock(this);
michael@0 861 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 862 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 863 return it == itEnd;
michael@0 864 }
michael@0 865
michael@0 866 void disconnect_all()
michael@0 867 {
michael@0 868 lock_block<mt_policy> lock(this);
michael@0 869 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 870 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 871
michael@0 872 while(it != itEnd)
michael@0 873 {
michael@0 874 (*it)->getdest()->signal_disconnect(this);
michael@0 875 delete *it;
michael@0 876
michael@0 877 ++it;
michael@0 878 }
michael@0 879
michael@0 880 m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
michael@0 881 }
michael@0 882
michael@0 883 #ifdef _DEBUG
michael@0 884 bool connected(has_slots_interface* pclass)
michael@0 885 {
michael@0 886 lock_block<mt_policy> lock(this);
michael@0 887 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 888 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 889 while(it != itEnd)
michael@0 890 {
michael@0 891 itNext = it;
michael@0 892 ++itNext;
michael@0 893 if ((*it)->getdest() == pclass)
michael@0 894 return true;
michael@0 895 it = itNext;
michael@0 896 }
michael@0 897 return false;
michael@0 898 }
michael@0 899 #endif
michael@0 900
michael@0 901 void disconnect(has_slots_interface* pclass)
michael@0 902 {
michael@0 903 lock_block<mt_policy> lock(this);
michael@0 904 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 905 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 906
michael@0 907 while(it != itEnd)
michael@0 908 {
michael@0 909 if((*it)->getdest() == pclass)
michael@0 910 {
michael@0 911 delete *it;
michael@0 912 m_connected_slots.erase(it);
michael@0 913 pclass->signal_disconnect(this);
michael@0 914 return;
michael@0 915 }
michael@0 916
michael@0 917 ++it;
michael@0 918 }
michael@0 919 }
michael@0 920
michael@0 921 void slot_disconnect(has_slots_interface* pslot)
michael@0 922 {
michael@0 923 lock_block<mt_policy> lock(this);
michael@0 924 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 925 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 926
michael@0 927 while(it != itEnd)
michael@0 928 {
michael@0 929 typename connections_list::iterator itNext = it;
michael@0 930 ++itNext;
michael@0 931
michael@0 932 if((*it)->getdest() == pslot)
michael@0 933 {
michael@0 934 delete *it;
michael@0 935 m_connected_slots.erase(it);
michael@0 936 }
michael@0 937
michael@0 938 it = itNext;
michael@0 939 }
michael@0 940 }
michael@0 941
michael@0 942 protected:
michael@0 943 connections_list m_connected_slots;
michael@0 944 };
michael@0 945
michael@0 946 template<class arg1_type, class arg2_type, class arg3_type, class mt_policy>
michael@0 947 class _signal_base3 : public _signal_base<mt_policy>
michael@0 948 {
michael@0 949 public:
michael@0 950 typedef std::list<_connection_base3<arg1_type, arg2_type, arg3_type, mt_policy> *>
michael@0 951 connections_list;
michael@0 952
michael@0 953 _signal_base3()
michael@0 954 {
michael@0 955 ;
michael@0 956 }
michael@0 957
michael@0 958 _signal_base3(const _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>& s)
michael@0 959 : _signal_base<mt_policy>(s)
michael@0 960 {
michael@0 961 lock_block<mt_policy> lock(this);
michael@0 962 typename connections_list::const_iterator it = s.m_connected_slots.begin();
michael@0 963 typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
michael@0 964
michael@0 965 while(it != itEnd)
michael@0 966 {
michael@0 967 (*it)->getdest()->signal_connect(this);
michael@0 968 m_connected_slots.push_back((*it)->clone());
michael@0 969
michael@0 970 ++it;
michael@0 971 }
michael@0 972 }
michael@0 973
michael@0 974 void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
michael@0 975 {
michael@0 976 lock_block<mt_policy> lock(this);
michael@0 977 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 978 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 979
michael@0 980 while(it != itEnd)
michael@0 981 {
michael@0 982 if((*it)->getdest() == oldtarget)
michael@0 983 {
michael@0 984 m_connected_slots.push_back((*it)->duplicate(newtarget));
michael@0 985 }
michael@0 986
michael@0 987 ++it;
michael@0 988 }
michael@0 989 }
michael@0 990
michael@0 991 ~_signal_base3()
michael@0 992 {
michael@0 993 disconnect_all();
michael@0 994 }
michael@0 995
michael@0 996 bool is_empty()
michael@0 997 {
michael@0 998 lock_block<mt_policy> lock(this);
michael@0 999 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 1000 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1001 return it == itEnd;
michael@0 1002 }
michael@0 1003
michael@0 1004 void disconnect_all()
michael@0 1005 {
michael@0 1006 lock_block<mt_policy> lock(this);
michael@0 1007 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 1008 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1009
michael@0 1010 while(it != itEnd)
michael@0 1011 {
michael@0 1012 (*it)->getdest()->signal_disconnect(this);
michael@0 1013 delete *it;
michael@0 1014
michael@0 1015 ++it;
michael@0 1016 }
michael@0 1017
michael@0 1018 m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
michael@0 1019 }
michael@0 1020
michael@0 1021 #ifdef _DEBUG
michael@0 1022 bool connected(has_slots_interface* pclass)
michael@0 1023 {
michael@0 1024 lock_block<mt_policy> lock(this);
michael@0 1025 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 1026 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1027 while(it != itEnd)
michael@0 1028 {
michael@0 1029 itNext = it;
michael@0 1030 ++itNext;
michael@0 1031 if ((*it)->getdest() == pclass)
michael@0 1032 return true;
michael@0 1033 it = itNext;
michael@0 1034 }
michael@0 1035 return false;
michael@0 1036 }
michael@0 1037 #endif
michael@0 1038
michael@0 1039 void disconnect(has_slots_interface* pclass)
michael@0 1040 {
michael@0 1041 lock_block<mt_policy> lock(this);
michael@0 1042 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1043 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1044
michael@0 1045 while(it != itEnd)
michael@0 1046 {
michael@0 1047 if((*it)->getdest() == pclass)
michael@0 1048 {
michael@0 1049 delete *it;
michael@0 1050 m_connected_slots.erase(it);
michael@0 1051 pclass->signal_disconnect(this);
michael@0 1052 return;
michael@0 1053 }
michael@0 1054
michael@0 1055 ++it;
michael@0 1056 }
michael@0 1057 }
michael@0 1058
michael@0 1059 void slot_disconnect(has_slots_interface* pslot)
michael@0 1060 {
michael@0 1061 lock_block<mt_policy> lock(this);
michael@0 1062 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1063 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1064
michael@0 1065 while(it != itEnd)
michael@0 1066 {
michael@0 1067 typename connections_list::iterator itNext = it;
michael@0 1068 ++itNext;
michael@0 1069
michael@0 1070 if((*it)->getdest() == pslot)
michael@0 1071 {
michael@0 1072 delete *it;
michael@0 1073 m_connected_slots.erase(it);
michael@0 1074 }
michael@0 1075
michael@0 1076 it = itNext;
michael@0 1077 }
michael@0 1078 }
michael@0 1079
michael@0 1080 protected:
michael@0 1081 connections_list m_connected_slots;
michael@0 1082 };
michael@0 1083
michael@0 1084 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy>
michael@0 1085 class _signal_base4 : public _signal_base<mt_policy>
michael@0 1086 {
michael@0 1087 public:
michael@0 1088 typedef std::list<_connection_base4<arg1_type, arg2_type, arg3_type,
michael@0 1089 arg4_type, mt_policy> *> connections_list;
michael@0 1090
michael@0 1091 _signal_base4()
michael@0 1092 {
michael@0 1093 ;
michael@0 1094 }
michael@0 1095
michael@0 1096 _signal_base4(const _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>& s)
michael@0 1097 : _signal_base<mt_policy>(s)
michael@0 1098 {
michael@0 1099 lock_block<mt_policy> lock(this);
michael@0 1100 typename connections_list::const_iterator it = s.m_connected_slots.begin();
michael@0 1101 typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
michael@0 1102
michael@0 1103 while(it != itEnd)
michael@0 1104 {
michael@0 1105 (*it)->getdest()->signal_connect(this);
michael@0 1106 m_connected_slots.push_back((*it)->clone());
michael@0 1107
michael@0 1108 ++it;
michael@0 1109 }
michael@0 1110 }
michael@0 1111
michael@0 1112 void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
michael@0 1113 {
michael@0 1114 lock_block<mt_policy> lock(this);
michael@0 1115 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1116 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1117
michael@0 1118 while(it != itEnd)
michael@0 1119 {
michael@0 1120 if((*it)->getdest() == oldtarget)
michael@0 1121 {
michael@0 1122 m_connected_slots.push_back((*it)->duplicate(newtarget));
michael@0 1123 }
michael@0 1124
michael@0 1125 ++it;
michael@0 1126 }
michael@0 1127 }
michael@0 1128
michael@0 1129 ~_signal_base4()
michael@0 1130 {
michael@0 1131 disconnect_all();
michael@0 1132 }
michael@0 1133
michael@0 1134 bool is_empty()
michael@0 1135 {
michael@0 1136 lock_block<mt_policy> lock(this);
michael@0 1137 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 1138 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1139 return it == itEnd;
michael@0 1140 }
michael@0 1141
michael@0 1142 void disconnect_all()
michael@0 1143 {
michael@0 1144 lock_block<mt_policy> lock(this);
michael@0 1145 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 1146 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1147
michael@0 1148 while(it != itEnd)
michael@0 1149 {
michael@0 1150 (*it)->getdest()->signal_disconnect(this);
michael@0 1151 delete *it;
michael@0 1152
michael@0 1153 ++it;
michael@0 1154 }
michael@0 1155
michael@0 1156 m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
michael@0 1157 }
michael@0 1158
michael@0 1159 #ifdef _DEBUG
michael@0 1160 bool connected(has_slots_interface* pclass)
michael@0 1161 {
michael@0 1162 lock_block<mt_policy> lock(this);
michael@0 1163 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 1164 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1165 while(it != itEnd)
michael@0 1166 {
michael@0 1167 itNext = it;
michael@0 1168 ++itNext;
michael@0 1169 if ((*it)->getdest() == pclass)
michael@0 1170 return true;
michael@0 1171 it = itNext;
michael@0 1172 }
michael@0 1173 return false;
michael@0 1174 }
michael@0 1175 #endif
michael@0 1176
michael@0 1177 void disconnect(has_slots_interface* pclass)
michael@0 1178 {
michael@0 1179 lock_block<mt_policy> lock(this);
michael@0 1180 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1181 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1182
michael@0 1183 while(it != itEnd)
michael@0 1184 {
michael@0 1185 if((*it)->getdest() == pclass)
michael@0 1186 {
michael@0 1187 delete *it;
michael@0 1188 m_connected_slots.erase(it);
michael@0 1189 pclass->signal_disconnect(this);
michael@0 1190 return;
michael@0 1191 }
michael@0 1192
michael@0 1193 ++it;
michael@0 1194 }
michael@0 1195 }
michael@0 1196
michael@0 1197 void slot_disconnect(has_slots_interface* pslot)
michael@0 1198 {
michael@0 1199 lock_block<mt_policy> lock(this);
michael@0 1200 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1201 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1202
michael@0 1203 while(it != itEnd)
michael@0 1204 {
michael@0 1205 typename connections_list::iterator itNext = it;
michael@0 1206 ++itNext;
michael@0 1207
michael@0 1208 if((*it)->getdest() == pslot)
michael@0 1209 {
michael@0 1210 delete *it;
michael@0 1211 m_connected_slots.erase(it);
michael@0 1212 }
michael@0 1213
michael@0 1214 it = itNext;
michael@0 1215 }
michael@0 1216 }
michael@0 1217
michael@0 1218 protected:
michael@0 1219 connections_list m_connected_slots;
michael@0 1220 };
michael@0 1221
michael@0 1222 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
michael@0 1223 class arg5_type, class mt_policy>
michael@0 1224 class _signal_base5 : public _signal_base<mt_policy>
michael@0 1225 {
michael@0 1226 public:
michael@0 1227 typedef std::list<_connection_base5<arg1_type, arg2_type, arg3_type,
michael@0 1228 arg4_type, arg5_type, mt_policy> *> connections_list;
michael@0 1229
michael@0 1230 _signal_base5()
michael@0 1231 {
michael@0 1232 ;
michael@0 1233 }
michael@0 1234
michael@0 1235 _signal_base5(const _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 1236 arg5_type, mt_policy>& s)
michael@0 1237 : _signal_base<mt_policy>(s)
michael@0 1238 {
michael@0 1239 lock_block<mt_policy> lock(this);
michael@0 1240 typename connections_list::const_iterator it = s.m_connected_slots.begin();
michael@0 1241 typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
michael@0 1242
michael@0 1243 while(it != itEnd)
michael@0 1244 {
michael@0 1245 (*it)->getdest()->signal_connect(this);
michael@0 1246 m_connected_slots.push_back((*it)->clone());
michael@0 1247
michael@0 1248 ++it;
michael@0 1249 }
michael@0 1250 }
michael@0 1251
michael@0 1252 void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
michael@0 1253 {
michael@0 1254 lock_block<mt_policy> lock(this);
michael@0 1255 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1256 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1257
michael@0 1258 while(it != itEnd)
michael@0 1259 {
michael@0 1260 if((*it)->getdest() == oldtarget)
michael@0 1261 {
michael@0 1262 m_connected_slots.push_back((*it)->duplicate(newtarget));
michael@0 1263 }
michael@0 1264
michael@0 1265 ++it;
michael@0 1266 }
michael@0 1267 }
michael@0 1268
michael@0 1269 ~_signal_base5()
michael@0 1270 {
michael@0 1271 disconnect_all();
michael@0 1272 }
michael@0 1273
michael@0 1274 bool is_empty()
michael@0 1275 {
michael@0 1276 lock_block<mt_policy> lock(this);
michael@0 1277 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 1278 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1279 return it == itEnd;
michael@0 1280 }
michael@0 1281
michael@0 1282 void disconnect_all()
michael@0 1283 {
michael@0 1284 lock_block<mt_policy> lock(this);
michael@0 1285 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 1286 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1287
michael@0 1288 while(it != itEnd)
michael@0 1289 {
michael@0 1290 (*it)->getdest()->signal_disconnect(this);
michael@0 1291 delete *it;
michael@0 1292
michael@0 1293 ++it;
michael@0 1294 }
michael@0 1295
michael@0 1296 m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
michael@0 1297 }
michael@0 1298
michael@0 1299 #ifdef _DEBUG
michael@0 1300 bool connected(has_slots_interface* pclass)
michael@0 1301 {
michael@0 1302 lock_block<mt_policy> lock(this);
michael@0 1303 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 1304 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1305 while(it != itEnd)
michael@0 1306 {
michael@0 1307 itNext = it;
michael@0 1308 ++itNext;
michael@0 1309 if ((*it)->getdest() == pclass)
michael@0 1310 return true;
michael@0 1311 it = itNext;
michael@0 1312 }
michael@0 1313 return false;
michael@0 1314 }
michael@0 1315 #endif
michael@0 1316
michael@0 1317 void disconnect(has_slots_interface* pclass)
michael@0 1318 {
michael@0 1319 lock_block<mt_policy> lock(this);
michael@0 1320 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1321 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1322
michael@0 1323 while(it != itEnd)
michael@0 1324 {
michael@0 1325 if((*it)->getdest() == pclass)
michael@0 1326 {
michael@0 1327 delete *it;
michael@0 1328 m_connected_slots.erase(it);
michael@0 1329 pclass->signal_disconnect(this);
michael@0 1330 return;
michael@0 1331 }
michael@0 1332
michael@0 1333 ++it;
michael@0 1334 }
michael@0 1335 }
michael@0 1336
michael@0 1337 void slot_disconnect(has_slots_interface* pslot)
michael@0 1338 {
michael@0 1339 lock_block<mt_policy> lock(this);
michael@0 1340 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1341 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1342
michael@0 1343 while(it != itEnd)
michael@0 1344 {
michael@0 1345 typename connections_list::iterator itNext = it;
michael@0 1346 ++itNext;
michael@0 1347
michael@0 1348 if((*it)->getdest() == pslot)
michael@0 1349 {
michael@0 1350 delete *it;
michael@0 1351 m_connected_slots.erase(it);
michael@0 1352 }
michael@0 1353
michael@0 1354 it = itNext;
michael@0 1355 }
michael@0 1356 }
michael@0 1357
michael@0 1358 protected:
michael@0 1359 connections_list m_connected_slots;
michael@0 1360 };
michael@0 1361
michael@0 1362 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
michael@0 1363 class arg5_type, class arg6_type, class mt_policy>
michael@0 1364 class _signal_base6 : public _signal_base<mt_policy>
michael@0 1365 {
michael@0 1366 public:
michael@0 1367 typedef std::list<_connection_base6<arg1_type, arg2_type, arg3_type,
michael@0 1368 arg4_type, arg5_type, arg6_type, mt_policy> *> connections_list;
michael@0 1369
michael@0 1370 _signal_base6()
michael@0 1371 {
michael@0 1372 ;
michael@0 1373 }
michael@0 1374
michael@0 1375 _signal_base6(const _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 1376 arg5_type, arg6_type, mt_policy>& s)
michael@0 1377 : _signal_base<mt_policy>(s)
michael@0 1378 {
michael@0 1379 lock_block<mt_policy> lock(this);
michael@0 1380 typename connections_list::const_iterator it = s.m_connected_slots.begin();
michael@0 1381 typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
michael@0 1382
michael@0 1383 while(it != itEnd)
michael@0 1384 {
michael@0 1385 (*it)->getdest()->signal_connect(this);
michael@0 1386 m_connected_slots.push_back((*it)->clone());
michael@0 1387
michael@0 1388 ++it;
michael@0 1389 }
michael@0 1390 }
michael@0 1391
michael@0 1392 void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
michael@0 1393 {
michael@0 1394 lock_block<mt_policy> lock(this);
michael@0 1395 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1396 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1397
michael@0 1398 while(it != itEnd)
michael@0 1399 {
michael@0 1400 if((*it)->getdest() == oldtarget)
michael@0 1401 {
michael@0 1402 m_connected_slots.push_back((*it)->duplicate(newtarget));
michael@0 1403 }
michael@0 1404
michael@0 1405 ++it;
michael@0 1406 }
michael@0 1407 }
michael@0 1408
michael@0 1409 ~_signal_base6()
michael@0 1410 {
michael@0 1411 disconnect_all();
michael@0 1412 }
michael@0 1413
michael@0 1414 bool is_empty()
michael@0 1415 {
michael@0 1416 lock_block<mt_policy> lock(this);
michael@0 1417 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 1418 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1419 return it == itEnd;
michael@0 1420 }
michael@0 1421
michael@0 1422 void disconnect_all()
michael@0 1423 {
michael@0 1424 lock_block<mt_policy> lock(this);
michael@0 1425 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 1426 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1427
michael@0 1428 while(it != itEnd)
michael@0 1429 {
michael@0 1430 (*it)->getdest()->signal_disconnect(this);
michael@0 1431 delete *it;
michael@0 1432
michael@0 1433 ++it;
michael@0 1434 }
michael@0 1435
michael@0 1436 m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
michael@0 1437 }
michael@0 1438
michael@0 1439 #ifdef _DEBUG
michael@0 1440 bool connected(has_slots_interface* pclass)
michael@0 1441 {
michael@0 1442 lock_block<mt_policy> lock(this);
michael@0 1443 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 1444 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1445 while(it != itEnd)
michael@0 1446 {
michael@0 1447 itNext = it;
michael@0 1448 ++itNext;
michael@0 1449 if ((*it)->getdest() == pclass)
michael@0 1450 return true;
michael@0 1451 it = itNext;
michael@0 1452 }
michael@0 1453 return false;
michael@0 1454 }
michael@0 1455 #endif
michael@0 1456
michael@0 1457 void disconnect(has_slots_interface* pclass)
michael@0 1458 {
michael@0 1459 lock_block<mt_policy> lock(this);
michael@0 1460 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1461 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1462
michael@0 1463 while(it != itEnd)
michael@0 1464 {
michael@0 1465 if((*it)->getdest() == pclass)
michael@0 1466 {
michael@0 1467 delete *it;
michael@0 1468 m_connected_slots.erase(it);
michael@0 1469 pclass->signal_disconnect(this);
michael@0 1470 return;
michael@0 1471 }
michael@0 1472
michael@0 1473 ++it;
michael@0 1474 }
michael@0 1475 }
michael@0 1476
michael@0 1477 void slot_disconnect(has_slots_interface* pslot)
michael@0 1478 {
michael@0 1479 lock_block<mt_policy> lock(this);
michael@0 1480 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1481 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1482
michael@0 1483 while(it != itEnd)
michael@0 1484 {
michael@0 1485 typename connections_list::iterator itNext = it;
michael@0 1486 ++itNext;
michael@0 1487
michael@0 1488 if((*it)->getdest() == pslot)
michael@0 1489 {
michael@0 1490 delete *it;
michael@0 1491 m_connected_slots.erase(it);
michael@0 1492 }
michael@0 1493
michael@0 1494 it = itNext;
michael@0 1495 }
michael@0 1496 }
michael@0 1497
michael@0 1498 protected:
michael@0 1499 connections_list m_connected_slots;
michael@0 1500 };
michael@0 1501
michael@0 1502 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
michael@0 1503 class arg5_type, class arg6_type, class arg7_type, class mt_policy>
michael@0 1504 class _signal_base7 : public _signal_base<mt_policy>
michael@0 1505 {
michael@0 1506 public:
michael@0 1507 typedef std::list<_connection_base7<arg1_type, arg2_type, arg3_type,
michael@0 1508 arg4_type, arg5_type, arg6_type, arg7_type, mt_policy> *> connections_list;
michael@0 1509
michael@0 1510 _signal_base7()
michael@0 1511 {
michael@0 1512 ;
michael@0 1513 }
michael@0 1514
michael@0 1515 _signal_base7(const _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 1516 arg5_type, arg6_type, arg7_type, mt_policy>& s)
michael@0 1517 : _signal_base<mt_policy>(s)
michael@0 1518 {
michael@0 1519 lock_block<mt_policy> lock(this);
michael@0 1520 typename connections_list::const_iterator it = s.m_connected_slots.begin();
michael@0 1521 typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
michael@0 1522
michael@0 1523 while(it != itEnd)
michael@0 1524 {
michael@0 1525 (*it)->getdest()->signal_connect(this);
michael@0 1526 m_connected_slots.push_back((*it)->clone());
michael@0 1527
michael@0 1528 ++it;
michael@0 1529 }
michael@0 1530 }
michael@0 1531
michael@0 1532 void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
michael@0 1533 {
michael@0 1534 lock_block<mt_policy> lock(this);
michael@0 1535 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1536 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1537
michael@0 1538 while(it != itEnd)
michael@0 1539 {
michael@0 1540 if((*it)->getdest() == oldtarget)
michael@0 1541 {
michael@0 1542 m_connected_slots.push_back((*it)->duplicate(newtarget));
michael@0 1543 }
michael@0 1544
michael@0 1545 ++it;
michael@0 1546 }
michael@0 1547 }
michael@0 1548
michael@0 1549 ~_signal_base7()
michael@0 1550 {
michael@0 1551 disconnect_all();
michael@0 1552 }
michael@0 1553
michael@0 1554 bool is_empty()
michael@0 1555 {
michael@0 1556 lock_block<mt_policy> lock(this);
michael@0 1557 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 1558 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1559 return it == itEnd;
michael@0 1560 }
michael@0 1561
michael@0 1562 void disconnect_all()
michael@0 1563 {
michael@0 1564 lock_block<mt_policy> lock(this);
michael@0 1565 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 1566 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1567
michael@0 1568 while(it != itEnd)
michael@0 1569 {
michael@0 1570 (*it)->getdest()->signal_disconnect(this);
michael@0 1571 delete *it;
michael@0 1572
michael@0 1573 ++it;
michael@0 1574 }
michael@0 1575
michael@0 1576 m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
michael@0 1577 }
michael@0 1578
michael@0 1579 #ifdef _DEBUG
michael@0 1580 bool connected(has_slots_interface* pclass)
michael@0 1581 {
michael@0 1582 lock_block<mt_policy> lock(this);
michael@0 1583 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 1584 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1585 while(it != itEnd)
michael@0 1586 {
michael@0 1587 itNext = it;
michael@0 1588 ++itNext;
michael@0 1589 if ((*it)->getdest() == pclass)
michael@0 1590 return true;
michael@0 1591 it = itNext;
michael@0 1592 }
michael@0 1593 return false;
michael@0 1594 }
michael@0 1595 #endif
michael@0 1596
michael@0 1597 void disconnect(has_slots_interface* pclass)
michael@0 1598 {
michael@0 1599 lock_block<mt_policy> lock(this);
michael@0 1600 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1601 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1602
michael@0 1603 while(it != itEnd)
michael@0 1604 {
michael@0 1605 if((*it)->getdest() == pclass)
michael@0 1606 {
michael@0 1607 delete *it;
michael@0 1608 m_connected_slots.erase(it);
michael@0 1609 pclass->signal_disconnect(this);
michael@0 1610 return;
michael@0 1611 }
michael@0 1612
michael@0 1613 ++it;
michael@0 1614 }
michael@0 1615 }
michael@0 1616
michael@0 1617 void slot_disconnect(has_slots_interface* pslot)
michael@0 1618 {
michael@0 1619 lock_block<mt_policy> lock(this);
michael@0 1620 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1621 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1622
michael@0 1623 while(it != itEnd)
michael@0 1624 {
michael@0 1625 typename connections_list::iterator itNext = it;
michael@0 1626 ++itNext;
michael@0 1627
michael@0 1628 if((*it)->getdest() == pslot)
michael@0 1629 {
michael@0 1630 delete *it;
michael@0 1631 m_connected_slots.erase(it);
michael@0 1632 }
michael@0 1633
michael@0 1634 it = itNext;
michael@0 1635 }
michael@0 1636 }
michael@0 1637
michael@0 1638 protected:
michael@0 1639 connections_list m_connected_slots;
michael@0 1640 };
michael@0 1641
michael@0 1642 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
michael@0 1643 class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy>
michael@0 1644 class _signal_base8 : public _signal_base<mt_policy>
michael@0 1645 {
michael@0 1646 public:
michael@0 1647 typedef std::list<_connection_base8<arg1_type, arg2_type, arg3_type,
michael@0 1648 arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *>
michael@0 1649 connections_list;
michael@0 1650
michael@0 1651 _signal_base8()
michael@0 1652 {
michael@0 1653 ;
michael@0 1654 }
michael@0 1655
michael@0 1656 _signal_base8(const _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 1657 arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>& s)
michael@0 1658 : _signal_base<mt_policy>(s)
michael@0 1659 {
michael@0 1660 lock_block<mt_policy> lock(this);
michael@0 1661 typename connections_list::const_iterator it = s.m_connected_slots.begin();
michael@0 1662 typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
michael@0 1663
michael@0 1664 while(it != itEnd)
michael@0 1665 {
michael@0 1666 (*it)->getdest()->signal_connect(this);
michael@0 1667 m_connected_slots.push_back((*it)->clone());
michael@0 1668
michael@0 1669 ++it;
michael@0 1670 }
michael@0 1671 }
michael@0 1672
michael@0 1673 void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
michael@0 1674 {
michael@0 1675 lock_block<mt_policy> lock(this);
michael@0 1676 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1677 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1678
michael@0 1679 while(it != itEnd)
michael@0 1680 {
michael@0 1681 if((*it)->getdest() == oldtarget)
michael@0 1682 {
michael@0 1683 m_connected_slots.push_back((*it)->duplicate(newtarget));
michael@0 1684 }
michael@0 1685
michael@0 1686 ++it;
michael@0 1687 }
michael@0 1688 }
michael@0 1689
michael@0 1690 ~_signal_base8()
michael@0 1691 {
michael@0 1692 disconnect_all();
michael@0 1693 }
michael@0 1694
michael@0 1695 bool is_empty()
michael@0 1696 {
michael@0 1697 lock_block<mt_policy> lock(this);
michael@0 1698 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 1699 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1700 return it == itEnd;
michael@0 1701 }
michael@0 1702
michael@0 1703 void disconnect_all()
michael@0 1704 {
michael@0 1705 lock_block<mt_policy> lock(this);
michael@0 1706 typename connections_list::const_iterator it = m_connected_slots.begin();
michael@0 1707 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1708
michael@0 1709 while(it != itEnd)
michael@0 1710 {
michael@0 1711 (*it)->getdest()->signal_disconnect(this);
michael@0 1712 delete *it;
michael@0 1713
michael@0 1714 ++it;
michael@0 1715 }
michael@0 1716
michael@0 1717 m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
michael@0 1718 }
michael@0 1719
michael@0 1720 #ifdef _DEBUG
michael@0 1721 bool connected(has_slots_interface* pclass)
michael@0 1722 {
michael@0 1723 lock_block<mt_policy> lock(this);
michael@0 1724 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 1725 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 1726 while(it != itEnd)
michael@0 1727 {
michael@0 1728 itNext = it;
michael@0 1729 ++itNext;
michael@0 1730 if ((*it)->getdest() == pclass)
michael@0 1731 return true;
michael@0 1732 it = itNext;
michael@0 1733 }
michael@0 1734 return false;
michael@0 1735 }
michael@0 1736 #endif
michael@0 1737
michael@0 1738 void disconnect(has_slots_interface* pclass)
michael@0 1739 {
michael@0 1740 lock_block<mt_policy> lock(this);
michael@0 1741 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1742 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1743
michael@0 1744 while(it != itEnd)
michael@0 1745 {
michael@0 1746 if((*it)->getdest() == pclass)
michael@0 1747 {
michael@0 1748 delete *it;
michael@0 1749 m_connected_slots.erase(it);
michael@0 1750 pclass->signal_disconnect(this);
michael@0 1751 return;
michael@0 1752 }
michael@0 1753
michael@0 1754 ++it;
michael@0 1755 }
michael@0 1756 }
michael@0 1757
michael@0 1758 void slot_disconnect(has_slots_interface* pslot)
michael@0 1759 {
michael@0 1760 lock_block<mt_policy> lock(this);
michael@0 1761 typename connections_list::iterator it = m_connected_slots.begin();
michael@0 1762 typename connections_list::iterator itEnd = m_connected_slots.end();
michael@0 1763
michael@0 1764 while(it != itEnd)
michael@0 1765 {
michael@0 1766 typename connections_list::iterator itNext = it;
michael@0 1767 ++itNext;
michael@0 1768
michael@0 1769 if((*it)->getdest() == pslot)
michael@0 1770 {
michael@0 1771 delete *it;
michael@0 1772 m_connected_slots.erase(it);
michael@0 1773 }
michael@0 1774
michael@0 1775 it = itNext;
michael@0 1776 }
michael@0 1777 }
michael@0 1778
michael@0 1779 protected:
michael@0 1780 connections_list m_connected_slots;
michael@0 1781 };
michael@0 1782
michael@0 1783
michael@0 1784 template<class dest_type, class mt_policy>
michael@0 1785 class _connection0 : public _connection_base0<mt_policy>
michael@0 1786 {
michael@0 1787 public:
michael@0 1788 _connection0()
michael@0 1789 {
michael@0 1790 m_pobject = NULL;
michael@0 1791 m_pmemfun = NULL;
michael@0 1792 }
michael@0 1793
michael@0 1794 _connection0(dest_type* pobject, void (dest_type::*pmemfun)())
michael@0 1795 {
michael@0 1796 m_pobject = pobject;
michael@0 1797 m_pmemfun = pmemfun;
michael@0 1798 }
michael@0 1799
michael@0 1800 virtual ~_connection0()
michael@0 1801 {
michael@0 1802 }
michael@0 1803
michael@0 1804 virtual _connection_base0<mt_policy>* clone()
michael@0 1805 {
michael@0 1806 return new _connection0<dest_type, mt_policy>(*this);
michael@0 1807 }
michael@0 1808
michael@0 1809 virtual _connection_base0<mt_policy>* duplicate(has_slots_interface* pnewdest)
michael@0 1810 {
michael@0 1811 return new _connection0<dest_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
michael@0 1812 }
michael@0 1813
michael@0 1814 virtual void emit()
michael@0 1815 {
michael@0 1816 (m_pobject->*m_pmemfun)();
michael@0 1817 }
michael@0 1818
michael@0 1819 virtual has_slots_interface* getdest() const
michael@0 1820 {
michael@0 1821 return m_pobject;
michael@0 1822 }
michael@0 1823
michael@0 1824 private:
michael@0 1825 dest_type* m_pobject;
michael@0 1826 void (dest_type::* m_pmemfun)();
michael@0 1827 };
michael@0 1828
michael@0 1829 template<class dest_type, class arg1_type, class mt_policy>
michael@0 1830 class _connection1 : public _connection_base1<arg1_type, mt_policy>
michael@0 1831 {
michael@0 1832 public:
michael@0 1833 _connection1()
michael@0 1834 {
michael@0 1835 m_pobject = NULL;
michael@0 1836 m_pmemfun = NULL;
michael@0 1837 }
michael@0 1838
michael@0 1839 _connection1(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type))
michael@0 1840 {
michael@0 1841 m_pobject = pobject;
michael@0 1842 m_pmemfun = pmemfun;
michael@0 1843 }
michael@0 1844
michael@0 1845 virtual ~_connection1()
michael@0 1846 {
michael@0 1847 }
michael@0 1848
michael@0 1849 virtual _connection_base1<arg1_type, mt_policy>* clone()
michael@0 1850 {
michael@0 1851 return new _connection1<dest_type, arg1_type, mt_policy>(*this);
michael@0 1852 }
michael@0 1853
michael@0 1854 virtual _connection_base1<arg1_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
michael@0 1855 {
michael@0 1856 return new _connection1<dest_type, arg1_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
michael@0 1857 }
michael@0 1858
michael@0 1859 virtual void emit(arg1_type a1)
michael@0 1860 {
michael@0 1861 (m_pobject->*m_pmemfun)(a1);
michael@0 1862 }
michael@0 1863
michael@0 1864 virtual has_slots_interface* getdest() const
michael@0 1865 {
michael@0 1866 return m_pobject;
michael@0 1867 }
michael@0 1868
michael@0 1869 private:
michael@0 1870 dest_type* m_pobject;
michael@0 1871 void (dest_type::* m_pmemfun)(arg1_type);
michael@0 1872 };
michael@0 1873
michael@0 1874 template<class dest_type, class arg1_type, class arg2_type, class mt_policy>
michael@0 1875 class _connection2 : public _connection_base2<arg1_type, arg2_type, mt_policy>
michael@0 1876 {
michael@0 1877 public:
michael@0 1878 _connection2()
michael@0 1879 {
michael@0 1880 m_pobject = NULL;
michael@0 1881 m_pmemfun = NULL;
michael@0 1882 }
michael@0 1883
michael@0 1884 _connection2(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
michael@0 1885 arg2_type))
michael@0 1886 {
michael@0 1887 m_pobject = pobject;
michael@0 1888 m_pmemfun = pmemfun;
michael@0 1889 }
michael@0 1890
michael@0 1891 virtual ~_connection2()
michael@0 1892 {
michael@0 1893 }
michael@0 1894
michael@0 1895 virtual _connection_base2<arg1_type, arg2_type, mt_policy>* clone()
michael@0 1896 {
michael@0 1897 return new _connection2<dest_type, arg1_type, arg2_type, mt_policy>(*this);
michael@0 1898 }
michael@0 1899
michael@0 1900 virtual _connection_base2<arg1_type, arg2_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
michael@0 1901 {
michael@0 1902 return new _connection2<dest_type, arg1_type, arg2_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
michael@0 1903 }
michael@0 1904
michael@0 1905 virtual void emit(arg1_type a1, arg2_type a2)
michael@0 1906 {
michael@0 1907 (m_pobject->*m_pmemfun)(a1, a2);
michael@0 1908 }
michael@0 1909
michael@0 1910 virtual has_slots_interface* getdest() const
michael@0 1911 {
michael@0 1912 return m_pobject;
michael@0 1913 }
michael@0 1914
michael@0 1915 private:
michael@0 1916 dest_type* m_pobject;
michael@0 1917 void (dest_type::* m_pmemfun)(arg1_type, arg2_type);
michael@0 1918 };
michael@0 1919
michael@0 1920 template<class dest_type, class arg1_type, class arg2_type, class arg3_type, class mt_policy>
michael@0 1921 class _connection3 : public _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>
michael@0 1922 {
michael@0 1923 public:
michael@0 1924 _connection3()
michael@0 1925 {
michael@0 1926 m_pobject = NULL;
michael@0 1927 m_pmemfun = NULL;
michael@0 1928 }
michael@0 1929
michael@0 1930 _connection3(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
michael@0 1931 arg2_type, arg3_type))
michael@0 1932 {
michael@0 1933 m_pobject = pobject;
michael@0 1934 m_pmemfun = pmemfun;
michael@0 1935 }
michael@0 1936
michael@0 1937 virtual ~_connection3()
michael@0 1938 {
michael@0 1939 }
michael@0 1940
michael@0 1941 virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* clone()
michael@0 1942 {
michael@0 1943 return new _connection3<dest_type, arg1_type, arg2_type, arg3_type, mt_policy>(*this);
michael@0 1944 }
michael@0 1945
michael@0 1946 virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
michael@0 1947 {
michael@0 1948 return new _connection3<dest_type, arg1_type, arg2_type, arg3_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
michael@0 1949 }
michael@0 1950
michael@0 1951 virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3)
michael@0 1952 {
michael@0 1953 (m_pobject->*m_pmemfun)(a1, a2, a3);
michael@0 1954 }
michael@0 1955
michael@0 1956 virtual has_slots_interface* getdest() const
michael@0 1957 {
michael@0 1958 return m_pobject;
michael@0 1959 }
michael@0 1960
michael@0 1961 private:
michael@0 1962 dest_type* m_pobject;
michael@0 1963 void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type);
michael@0 1964 };
michael@0 1965
michael@0 1966 template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
michael@0 1967 class arg4_type, class mt_policy>
michael@0 1968 class _connection4 : public _connection_base4<arg1_type, arg2_type,
michael@0 1969 arg3_type, arg4_type, mt_policy>
michael@0 1970 {
michael@0 1971 public:
michael@0 1972 _connection4()
michael@0 1973 {
michael@0 1974 m_pobject = NULL;
michael@0 1975 m_pmemfun = NULL;
michael@0 1976 }
michael@0 1977
michael@0 1978 _connection4(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
michael@0 1979 arg2_type, arg3_type, arg4_type))
michael@0 1980 {
michael@0 1981 m_pobject = pobject;
michael@0 1982 m_pmemfun = pmemfun;
michael@0 1983 }
michael@0 1984
michael@0 1985 virtual ~_connection4()
michael@0 1986 {
michael@0 1987 }
michael@0 1988
michael@0 1989 virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* clone()
michael@0 1990 {
michael@0 1991 return new _connection4<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>(*this);
michael@0 1992 }
michael@0 1993
michael@0 1994 virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
michael@0 1995 {
michael@0 1996 return new _connection4<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
michael@0 1997 }
michael@0 1998
michael@0 1999 virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3,
michael@0 2000 arg4_type a4)
michael@0 2001 {
michael@0 2002 (m_pobject->*m_pmemfun)(a1, a2, a3, a4);
michael@0 2003 }
michael@0 2004
michael@0 2005 virtual has_slots_interface* getdest() const
michael@0 2006 {
michael@0 2007 return m_pobject;
michael@0 2008 }
michael@0 2009
michael@0 2010 private:
michael@0 2011 dest_type* m_pobject;
michael@0 2012 void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type,
michael@0 2013 arg4_type);
michael@0 2014 };
michael@0 2015
michael@0 2016 template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
michael@0 2017 class arg4_type, class arg5_type, class mt_policy>
michael@0 2018 class _connection5 : public _connection_base5<arg1_type, arg2_type,
michael@0 2019 arg3_type, arg4_type, arg5_type, mt_policy>
michael@0 2020 {
michael@0 2021 public:
michael@0 2022 _connection5()
michael@0 2023 {
michael@0 2024 m_pobject = NULL;
michael@0 2025 m_pmemfun = NULL;
michael@0 2026 }
michael@0 2027
michael@0 2028 _connection5(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
michael@0 2029 arg2_type, arg3_type, arg4_type, arg5_type))
michael@0 2030 {
michael@0 2031 m_pobject = pobject;
michael@0 2032 m_pmemfun = pmemfun;
michael@0 2033 }
michael@0 2034
michael@0 2035 virtual ~_connection5()
michael@0 2036 {
michael@0 2037 }
michael@0 2038
michael@0 2039 virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2040 arg5_type, mt_policy>* clone()
michael@0 2041 {
michael@0 2042 return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2043 arg5_type, mt_policy>(*this);
michael@0 2044 }
michael@0 2045
michael@0 2046 virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2047 arg5_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
michael@0 2048 {
michael@0 2049 return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2050 arg5_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
michael@0 2051 }
michael@0 2052
michael@0 2053 virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
michael@0 2054 arg5_type a5)
michael@0 2055 {
michael@0 2056 (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5);
michael@0 2057 }
michael@0 2058
michael@0 2059 virtual has_slots_interface* getdest() const
michael@0 2060 {
michael@0 2061 return m_pobject;
michael@0 2062 }
michael@0 2063
michael@0 2064 private:
michael@0 2065 dest_type* m_pobject;
michael@0 2066 void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2067 arg5_type);
michael@0 2068 };
michael@0 2069
michael@0 2070 template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
michael@0 2071 class arg4_type, class arg5_type, class arg6_type, class mt_policy>
michael@0 2072 class _connection6 : public _connection_base6<arg1_type, arg2_type,
michael@0 2073 arg3_type, arg4_type, arg5_type, arg6_type, mt_policy>
michael@0 2074 {
michael@0 2075 public:
michael@0 2076 _connection6()
michael@0 2077 {
michael@0 2078 m_pobject = NULL;
michael@0 2079 m_pmemfun = NULL;
michael@0 2080 }
michael@0 2081
michael@0 2082 _connection6(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
michael@0 2083 arg2_type, arg3_type, arg4_type, arg5_type, arg6_type))
michael@0 2084 {
michael@0 2085 m_pobject = pobject;
michael@0 2086 m_pmemfun = pmemfun;
michael@0 2087 }
michael@0 2088
michael@0 2089 virtual ~_connection6()
michael@0 2090 {
michael@0 2091 }
michael@0 2092
michael@0 2093 virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2094 arg5_type, arg6_type, mt_policy>* clone()
michael@0 2095 {
michael@0 2096 return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2097 arg5_type, arg6_type, mt_policy>(*this);
michael@0 2098 }
michael@0 2099
michael@0 2100 virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2101 arg5_type, arg6_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
michael@0 2102 {
michael@0 2103 return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2104 arg5_type, arg6_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
michael@0 2105 }
michael@0 2106
michael@0 2107 virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
michael@0 2108 arg5_type a5, arg6_type a6)
michael@0 2109 {
michael@0 2110 (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6);
michael@0 2111 }
michael@0 2112
michael@0 2113 virtual has_slots_interface* getdest() const
michael@0 2114 {
michael@0 2115 return m_pobject;
michael@0 2116 }
michael@0 2117
michael@0 2118 private:
michael@0 2119 dest_type* m_pobject;
michael@0 2120 void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2121 arg5_type, arg6_type);
michael@0 2122 };
michael@0 2123
michael@0 2124 template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
michael@0 2125 class arg4_type, class arg5_type, class arg6_type, class arg7_type, class mt_policy>
michael@0 2126 class _connection7 : public _connection_base7<arg1_type, arg2_type,
michael@0 2127 arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>
michael@0 2128 {
michael@0 2129 public:
michael@0 2130 _connection7()
michael@0 2131 {
michael@0 2132 m_pobject = NULL;
michael@0 2133 m_pmemfun = NULL;
michael@0 2134 }
michael@0 2135
michael@0 2136 _connection7(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
michael@0 2137 arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type))
michael@0 2138 {
michael@0 2139 m_pobject = pobject;
michael@0 2140 m_pmemfun = pmemfun;
michael@0 2141 }
michael@0 2142
michael@0 2143 virtual ~_connection7()
michael@0 2144 {
michael@0 2145 }
michael@0 2146
michael@0 2147 virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2148 arg5_type, arg6_type, arg7_type, mt_policy>* clone()
michael@0 2149 {
michael@0 2150 return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2151 arg5_type, arg6_type, arg7_type, mt_policy>(*this);
michael@0 2152 }
michael@0 2153
michael@0 2154 virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2155 arg5_type, arg6_type, arg7_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
michael@0 2156 {
michael@0 2157 return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2158 arg5_type, arg6_type, arg7_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
michael@0 2159 }
michael@0 2160
michael@0 2161 virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
michael@0 2162 arg5_type a5, arg6_type a6, arg7_type a7)
michael@0 2163 {
michael@0 2164 (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7);
michael@0 2165 }
michael@0 2166
michael@0 2167 virtual has_slots_interface* getdest() const
michael@0 2168 {
michael@0 2169 return m_pobject;
michael@0 2170 }
michael@0 2171
michael@0 2172 private:
michael@0 2173 dest_type* m_pobject;
michael@0 2174 void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2175 arg5_type, arg6_type, arg7_type);
michael@0 2176 };
michael@0 2177
michael@0 2178 template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
michael@0 2179 class arg4_type, class arg5_type, class arg6_type, class arg7_type,
michael@0 2180 class arg8_type, class mt_policy>
michael@0 2181 class _connection8 : public _connection_base8<arg1_type, arg2_type,
michael@0 2182 arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>
michael@0 2183 {
michael@0 2184 public:
michael@0 2185 _connection8()
michael@0 2186 {
michael@0 2187 m_pobject = NULL;
michael@0 2188 m_pmemfun = NULL;
michael@0 2189 }
michael@0 2190
michael@0 2191 _connection8(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
michael@0 2192 arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
michael@0 2193 arg7_type, arg8_type))
michael@0 2194 {
michael@0 2195 m_pobject = pobject;
michael@0 2196 m_pmemfun = pmemfun;
michael@0 2197 }
michael@0 2198
michael@0 2199 virtual ~_connection8()
michael@0 2200 {
michael@0 2201 }
michael@0 2202
michael@0 2203 virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2204 arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* clone()
michael@0 2205 {
michael@0 2206 return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2207 arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(*this);
michael@0 2208 }
michael@0 2209
michael@0 2210 virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2211 arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
michael@0 2212 {
michael@0 2213 return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2214 arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
michael@0 2215 }
michael@0 2216
michael@0 2217 virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
michael@0 2218 arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8)
michael@0 2219 {
michael@0 2220 (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7, a8);
michael@0 2221 }
michael@0 2222
michael@0 2223 virtual has_slots_interface* getdest() const
michael@0 2224 {
michael@0 2225 return m_pobject;
michael@0 2226 }
michael@0 2227
michael@0 2228 private:
michael@0 2229 dest_type* m_pobject;
michael@0 2230 void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2231 arg5_type, arg6_type, arg7_type, arg8_type);
michael@0 2232 };
michael@0 2233
michael@0 2234 template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
michael@0 2235 class signal0 : public _signal_base0<mt_policy>
michael@0 2236 {
michael@0 2237 public:
michael@0 2238 typedef _signal_base0<mt_policy> base;
michael@0 2239 typedef typename base::connections_list connections_list;
michael@0 2240 using base::m_connected_slots;
michael@0 2241
michael@0 2242 signal0()
michael@0 2243 {
michael@0 2244 ;
michael@0 2245 }
michael@0 2246
michael@0 2247 signal0(const signal0<mt_policy>& s)
michael@0 2248 : _signal_base0<mt_policy>(s)
michael@0 2249 {
michael@0 2250 ;
michael@0 2251 }
michael@0 2252
michael@0 2253 template<class desttype>
michael@0 2254 void connect(desttype* pclass, void (desttype::*pmemfun)())
michael@0 2255 {
michael@0 2256 lock_block<mt_policy> lock(this);
michael@0 2257 _connection0<desttype, mt_policy>* conn =
michael@0 2258 new _connection0<desttype, mt_policy>(pclass, pmemfun);
michael@0 2259 m_connected_slots.push_back(conn);
michael@0 2260 pclass->signal_connect(this);
michael@0 2261 }
michael@0 2262
michael@0 2263 void emit()
michael@0 2264 {
michael@0 2265 lock_block<mt_policy> lock(this);
michael@0 2266 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2267 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2268
michael@0 2269 while(it != itEnd)
michael@0 2270 {
michael@0 2271 itNext = it;
michael@0 2272 ++itNext;
michael@0 2273
michael@0 2274 (*it)->emit();
michael@0 2275
michael@0 2276 it = itNext;
michael@0 2277 }
michael@0 2278 }
michael@0 2279
michael@0 2280 void operator()()
michael@0 2281 {
michael@0 2282 lock_block<mt_policy> lock(this);
michael@0 2283 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2284 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2285
michael@0 2286 while(it != itEnd)
michael@0 2287 {
michael@0 2288 itNext = it;
michael@0 2289 ++itNext;
michael@0 2290
michael@0 2291 (*it)->emit();
michael@0 2292
michael@0 2293 it = itNext;
michael@0 2294 }
michael@0 2295 }
michael@0 2296 };
michael@0 2297
michael@0 2298 template<class arg1_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
michael@0 2299 class signal1 : public _signal_base1<arg1_type, mt_policy>
michael@0 2300 {
michael@0 2301 public:
michael@0 2302 typedef _signal_base1<arg1_type, mt_policy> base;
michael@0 2303 typedef typename base::connections_list connections_list;
michael@0 2304 using base::m_connected_slots;
michael@0 2305
michael@0 2306 signal1()
michael@0 2307 {
michael@0 2308 ;
michael@0 2309 }
michael@0 2310
michael@0 2311 signal1(const signal1<arg1_type, mt_policy>& s)
michael@0 2312 : _signal_base1<arg1_type, mt_policy>(s)
michael@0 2313 {
michael@0 2314 ;
michael@0 2315 }
michael@0 2316
michael@0 2317 template<class desttype>
michael@0 2318 void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type))
michael@0 2319 {
michael@0 2320 lock_block<mt_policy> lock(this);
michael@0 2321 _connection1<desttype, arg1_type, mt_policy>* conn =
michael@0 2322 new _connection1<desttype, arg1_type, mt_policy>(pclass, pmemfun);
michael@0 2323 m_connected_slots.push_back(conn);
michael@0 2324 pclass->signal_connect(this);
michael@0 2325 }
michael@0 2326
michael@0 2327 void emit(arg1_type a1)
michael@0 2328 {
michael@0 2329 lock_block<mt_policy> lock(this);
michael@0 2330 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2331 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2332
michael@0 2333 while(it != itEnd)
michael@0 2334 {
michael@0 2335 itNext = it;
michael@0 2336 ++itNext;
michael@0 2337
michael@0 2338 (*it)->emit(a1);
michael@0 2339
michael@0 2340 it = itNext;
michael@0 2341 }
michael@0 2342 }
michael@0 2343
michael@0 2344 void operator()(arg1_type a1)
michael@0 2345 {
michael@0 2346 lock_block<mt_policy> lock(this);
michael@0 2347 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2348 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2349
michael@0 2350 while(it != itEnd)
michael@0 2351 {
michael@0 2352 itNext = it;
michael@0 2353 ++itNext;
michael@0 2354
michael@0 2355 (*it)->emit(a1);
michael@0 2356
michael@0 2357 it = itNext;
michael@0 2358 }
michael@0 2359 }
michael@0 2360 };
michael@0 2361
michael@0 2362 template<class arg1_type, class arg2_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
michael@0 2363 class signal2 : public _signal_base2<arg1_type, arg2_type, mt_policy>
michael@0 2364 {
michael@0 2365 public:
michael@0 2366 typedef _signal_base2<arg1_type, arg2_type, mt_policy> base;
michael@0 2367 typedef typename base::connections_list connections_list;
michael@0 2368 using base::m_connected_slots;
michael@0 2369
michael@0 2370 signal2()
michael@0 2371 {
michael@0 2372 ;
michael@0 2373 }
michael@0 2374
michael@0 2375 signal2(const signal2<arg1_type, arg2_type, mt_policy>& s)
michael@0 2376 : _signal_base2<arg1_type, arg2_type, mt_policy>(s)
michael@0 2377 {
michael@0 2378 ;
michael@0 2379 }
michael@0 2380
michael@0 2381 template<class desttype>
michael@0 2382 void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
michael@0 2383 arg2_type))
michael@0 2384 {
michael@0 2385 lock_block<mt_policy> lock(this);
michael@0 2386 _connection2<desttype, arg1_type, arg2_type, mt_policy>* conn = new
michael@0 2387 _connection2<desttype, arg1_type, arg2_type, mt_policy>(pclass, pmemfun);
michael@0 2388 m_connected_slots.push_back(conn);
michael@0 2389 pclass->signal_connect(this);
michael@0 2390 }
michael@0 2391
michael@0 2392 void emit(arg1_type a1, arg2_type a2)
michael@0 2393 {
michael@0 2394 lock_block<mt_policy> lock(this);
michael@0 2395 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2396 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2397
michael@0 2398 while(it != itEnd)
michael@0 2399 {
michael@0 2400 itNext = it;
michael@0 2401 ++itNext;
michael@0 2402
michael@0 2403 (*it)->emit(a1, a2);
michael@0 2404
michael@0 2405 it = itNext;
michael@0 2406 }
michael@0 2407 }
michael@0 2408
michael@0 2409 void operator()(arg1_type a1, arg2_type a2)
michael@0 2410 {
michael@0 2411 lock_block<mt_policy> lock(this);
michael@0 2412 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2413 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2414
michael@0 2415 while(it != itEnd)
michael@0 2416 {
michael@0 2417 itNext = it;
michael@0 2418 ++itNext;
michael@0 2419
michael@0 2420 (*it)->emit(a1, a2);
michael@0 2421
michael@0 2422 it = itNext;
michael@0 2423 }
michael@0 2424 }
michael@0 2425 };
michael@0 2426
michael@0 2427 template<class arg1_type, class arg2_type, class arg3_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
michael@0 2428 class signal3 : public _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>
michael@0 2429 {
michael@0 2430 public:
michael@0 2431 typedef _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy> base;
michael@0 2432 typedef typename base::connections_list connections_list;
michael@0 2433 using base::m_connected_slots;
michael@0 2434
michael@0 2435 signal3()
michael@0 2436 {
michael@0 2437 ;
michael@0 2438 }
michael@0 2439
michael@0 2440 signal3(const signal3<arg1_type, arg2_type, arg3_type, mt_policy>& s)
michael@0 2441 : _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>(s)
michael@0 2442 {
michael@0 2443 ;
michael@0 2444 }
michael@0 2445
michael@0 2446 template<class desttype>
michael@0 2447 void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
michael@0 2448 arg2_type, arg3_type))
michael@0 2449 {
michael@0 2450 lock_block<mt_policy> lock(this);
michael@0 2451 _connection3<desttype, arg1_type, arg2_type, arg3_type, mt_policy>* conn =
michael@0 2452 new _connection3<desttype, arg1_type, arg2_type, arg3_type, mt_policy>(pclass,
michael@0 2453 pmemfun);
michael@0 2454 m_connected_slots.push_back(conn);
michael@0 2455 pclass->signal_connect(this);
michael@0 2456 }
michael@0 2457
michael@0 2458 void emit(arg1_type a1, arg2_type a2, arg3_type a3)
michael@0 2459 {
michael@0 2460 lock_block<mt_policy> lock(this);
michael@0 2461 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2462 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2463
michael@0 2464 while(it != itEnd)
michael@0 2465 {
michael@0 2466 itNext = it;
michael@0 2467 ++itNext;
michael@0 2468
michael@0 2469 (*it)->emit(a1, a2, a3);
michael@0 2470
michael@0 2471 it = itNext;
michael@0 2472 }
michael@0 2473 }
michael@0 2474
michael@0 2475 void operator()(arg1_type a1, arg2_type a2, arg3_type a3)
michael@0 2476 {
michael@0 2477 lock_block<mt_policy> lock(this);
michael@0 2478 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2479 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2480
michael@0 2481 while(it != itEnd)
michael@0 2482 {
michael@0 2483 itNext = it;
michael@0 2484 ++itNext;
michael@0 2485
michael@0 2486 (*it)->emit(a1, a2, a3);
michael@0 2487
michael@0 2488 it = itNext;
michael@0 2489 }
michael@0 2490 }
michael@0 2491 };
michael@0 2492
michael@0 2493 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
michael@0 2494 class signal4 : public _signal_base4<arg1_type, arg2_type, arg3_type,
michael@0 2495 arg4_type, mt_policy>
michael@0 2496 {
michael@0 2497 public:
michael@0 2498 typedef _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy> base;
michael@0 2499 typedef typename base::connections_list connections_list;
michael@0 2500 using base::m_connected_slots;
michael@0 2501
michael@0 2502 signal4()
michael@0 2503 {
michael@0 2504 ;
michael@0 2505 }
michael@0 2506
michael@0 2507 signal4(const signal4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>& s)
michael@0 2508 : _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>(s)
michael@0 2509 {
michael@0 2510 ;
michael@0 2511 }
michael@0 2512
michael@0 2513 template<class desttype>
michael@0 2514 void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
michael@0 2515 arg2_type, arg3_type, arg4_type))
michael@0 2516 {
michael@0 2517 lock_block<mt_policy> lock(this);
michael@0 2518 _connection4<desttype, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>*
michael@0 2519 conn = new _connection4<desttype, arg1_type, arg2_type, arg3_type,
michael@0 2520 arg4_type, mt_policy>(pclass, pmemfun);
michael@0 2521 m_connected_slots.push_back(conn);
michael@0 2522 pclass->signal_connect(this);
michael@0 2523 }
michael@0 2524
michael@0 2525 void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
michael@0 2526 {
michael@0 2527 lock_block<mt_policy> lock(this);
michael@0 2528 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2529 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2530
michael@0 2531 while(it != itEnd)
michael@0 2532 {
michael@0 2533 itNext = it;
michael@0 2534 ++itNext;
michael@0 2535
michael@0 2536 (*it)->emit(a1, a2, a3, a4);
michael@0 2537
michael@0 2538 it = itNext;
michael@0 2539 }
michael@0 2540 }
michael@0 2541
michael@0 2542 void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
michael@0 2543 {
michael@0 2544 lock_block<mt_policy> lock(this);
michael@0 2545 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2546 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2547
michael@0 2548 while(it != itEnd)
michael@0 2549 {
michael@0 2550 itNext = it;
michael@0 2551 ++itNext;
michael@0 2552
michael@0 2553 (*it)->emit(a1, a2, a3, a4);
michael@0 2554
michael@0 2555 it = itNext;
michael@0 2556 }
michael@0 2557 }
michael@0 2558 };
michael@0 2559
michael@0 2560 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
michael@0 2561 class arg5_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
michael@0 2562 class signal5 : public _signal_base5<arg1_type, arg2_type, arg3_type,
michael@0 2563 arg4_type, arg5_type, mt_policy>
michael@0 2564 {
michael@0 2565 public:
michael@0 2566 typedef _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, mt_policy> base;
michael@0 2567 typedef typename base::connections_list connections_list;
michael@0 2568 using base::m_connected_slots;
michael@0 2569
michael@0 2570 signal5()
michael@0 2571 {
michael@0 2572 ;
michael@0 2573 }
michael@0 2574
michael@0 2575 signal5(const signal5<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2576 arg5_type, mt_policy>& s)
michael@0 2577 : _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2578 arg5_type, mt_policy>(s)
michael@0 2579 {
michael@0 2580 ;
michael@0 2581 }
michael@0 2582
michael@0 2583 template<class desttype>
michael@0 2584 void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
michael@0 2585 arg2_type, arg3_type, arg4_type, arg5_type))
michael@0 2586 {
michael@0 2587 lock_block<mt_policy> lock(this);
michael@0 2588 _connection5<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2589 arg5_type, mt_policy>* conn = new _connection5<desttype, arg1_type, arg2_type,
michael@0 2590 arg3_type, arg4_type, arg5_type, mt_policy>(pclass, pmemfun);
michael@0 2591 m_connected_slots.push_back(conn);
michael@0 2592 pclass->signal_connect(this);
michael@0 2593 }
michael@0 2594
michael@0 2595 void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
michael@0 2596 arg5_type a5)
michael@0 2597 {
michael@0 2598 lock_block<mt_policy> lock(this);
michael@0 2599 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2600 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2601
michael@0 2602 while(it != itEnd)
michael@0 2603 {
michael@0 2604 itNext = it;
michael@0 2605 ++itNext;
michael@0 2606
michael@0 2607 (*it)->emit(a1, a2, a3, a4, a5);
michael@0 2608
michael@0 2609 it = itNext;
michael@0 2610 }
michael@0 2611 }
michael@0 2612
michael@0 2613 void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
michael@0 2614 arg5_type a5)
michael@0 2615 {
michael@0 2616 lock_block<mt_policy> lock(this);
michael@0 2617 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2618 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2619
michael@0 2620 while(it != itEnd)
michael@0 2621 {
michael@0 2622 itNext = it;
michael@0 2623 ++itNext;
michael@0 2624
michael@0 2625 (*it)->emit(a1, a2, a3, a4, a5);
michael@0 2626
michael@0 2627 it = itNext;
michael@0 2628 }
michael@0 2629 }
michael@0 2630 };
michael@0 2631
michael@0 2632
michael@0 2633 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
michael@0 2634 class arg5_type, class arg6_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
michael@0 2635 class signal6 : public _signal_base6<arg1_type, arg2_type, arg3_type,
michael@0 2636 arg4_type, arg5_type, arg6_type, mt_policy>
michael@0 2637 {
michael@0 2638 public:
michael@0 2639 typedef _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, mt_policy> base;
michael@0 2640 typedef typename base::connections_list connections_list;
michael@0 2641 using base::m_connected_slots;
michael@0 2642
michael@0 2643 signal6()
michael@0 2644 {
michael@0 2645 ;
michael@0 2646 }
michael@0 2647
michael@0 2648 signal6(const signal6<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2649 arg5_type, arg6_type, mt_policy>& s)
michael@0 2650 : _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2651 arg5_type, arg6_type, mt_policy>(s)
michael@0 2652 {
michael@0 2653 ;
michael@0 2654 }
michael@0 2655
michael@0 2656 template<class desttype>
michael@0 2657 void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
michael@0 2658 arg2_type, arg3_type, arg4_type, arg5_type, arg6_type))
michael@0 2659 {
michael@0 2660 lock_block<mt_policy> lock(this);
michael@0 2661 _connection6<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2662 arg5_type, arg6_type, mt_policy>* conn =
michael@0 2663 new _connection6<desttype, arg1_type, arg2_type, arg3_type,
michael@0 2664 arg4_type, arg5_type, arg6_type, mt_policy>(pclass, pmemfun);
michael@0 2665 m_connected_slots.push_back(conn);
michael@0 2666 pclass->signal_connect(this);
michael@0 2667 }
michael@0 2668
michael@0 2669 void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
michael@0 2670 arg5_type a5, arg6_type a6)
michael@0 2671 {
michael@0 2672 lock_block<mt_policy> lock(this);
michael@0 2673 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2674 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2675
michael@0 2676 while(it != itEnd)
michael@0 2677 {
michael@0 2678 itNext = it;
michael@0 2679 ++itNext;
michael@0 2680
michael@0 2681 (*it)->emit(a1, a2, a3, a4, a5, a6);
michael@0 2682
michael@0 2683 it = itNext;
michael@0 2684 }
michael@0 2685 }
michael@0 2686
michael@0 2687 void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
michael@0 2688 arg5_type a5, arg6_type a6)
michael@0 2689 {
michael@0 2690 lock_block<mt_policy> lock(this);
michael@0 2691 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2692 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2693
michael@0 2694 while(it != itEnd)
michael@0 2695 {
michael@0 2696 itNext = it;
michael@0 2697 ++itNext;
michael@0 2698
michael@0 2699 (*it)->emit(a1, a2, a3, a4, a5, a6);
michael@0 2700
michael@0 2701 it = itNext;
michael@0 2702 }
michael@0 2703 }
michael@0 2704 };
michael@0 2705
michael@0 2706 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
michael@0 2707 class arg5_type, class arg6_type, class arg7_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
michael@0 2708 class signal7 : public _signal_base7<arg1_type, arg2_type, arg3_type,
michael@0 2709 arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>
michael@0 2710 {
michael@0 2711 public:
michael@0 2712 typedef _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2713 arg5_type, arg6_type, arg7_type, mt_policy> base;
michael@0 2714 typedef typename base::connections_list connections_list;
michael@0 2715 using base::m_connected_slots;
michael@0 2716
michael@0 2717 signal7()
michael@0 2718 {
michael@0 2719 ;
michael@0 2720 }
michael@0 2721
michael@0 2722 signal7(const signal7<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2723 arg5_type, arg6_type, arg7_type, mt_policy>& s)
michael@0 2724 : _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2725 arg5_type, arg6_type, arg7_type, mt_policy>(s)
michael@0 2726 {
michael@0 2727 ;
michael@0 2728 }
michael@0 2729
michael@0 2730 template<class desttype>
michael@0 2731 void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
michael@0 2732 arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
michael@0 2733 arg7_type))
michael@0 2734 {
michael@0 2735 lock_block<mt_policy> lock(this);
michael@0 2736 _connection7<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2737 arg5_type, arg6_type, arg7_type, mt_policy>* conn =
michael@0 2738 new _connection7<desttype, arg1_type, arg2_type, arg3_type,
michael@0 2739 arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>(pclass, pmemfun);
michael@0 2740 m_connected_slots.push_back(conn);
michael@0 2741 pclass->signal_connect(this);
michael@0 2742 }
michael@0 2743
michael@0 2744 void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
michael@0 2745 arg5_type a5, arg6_type a6, arg7_type a7)
michael@0 2746 {
michael@0 2747 lock_block<mt_policy> lock(this);
michael@0 2748 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2749 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2750
michael@0 2751 while(it != itEnd)
michael@0 2752 {
michael@0 2753 itNext = it;
michael@0 2754 ++itNext;
michael@0 2755
michael@0 2756 (*it)->emit(a1, a2, a3, a4, a5, a6, a7);
michael@0 2757
michael@0 2758 it = itNext;
michael@0 2759 }
michael@0 2760 }
michael@0 2761
michael@0 2762 void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
michael@0 2763 arg5_type a5, arg6_type a6, arg7_type a7)
michael@0 2764 {
michael@0 2765 lock_block<mt_policy> lock(this);
michael@0 2766 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2767 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2768
michael@0 2769 while(it != itEnd)
michael@0 2770 {
michael@0 2771 itNext = it;
michael@0 2772 ++itNext;
michael@0 2773
michael@0 2774 (*it)->emit(a1, a2, a3, a4, a5, a6, a7);
michael@0 2775
michael@0 2776 it = itNext;
michael@0 2777 }
michael@0 2778 }
michael@0 2779 };
michael@0 2780
michael@0 2781 template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
michael@0 2782 class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
michael@0 2783 class signal8 : public _signal_base8<arg1_type, arg2_type, arg3_type,
michael@0 2784 arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>
michael@0 2785 {
michael@0 2786 public:
michael@0 2787 typedef _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2788 arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> base;
michael@0 2789 typedef typename base::connections_list connections_list;
michael@0 2790 using base::m_connected_slots;
michael@0 2791
michael@0 2792 signal8()
michael@0 2793 {
michael@0 2794 ;
michael@0 2795 }
michael@0 2796
michael@0 2797 signal8(const signal8<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2798 arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>& s)
michael@0 2799 : _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2800 arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(s)
michael@0 2801 {
michael@0 2802 ;
michael@0 2803 }
michael@0 2804
michael@0 2805 template<class desttype>
michael@0 2806 void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
michael@0 2807 arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
michael@0 2808 arg7_type, arg8_type))
michael@0 2809 {
michael@0 2810 lock_block<mt_policy> lock(this);
michael@0 2811 _connection8<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
michael@0 2812 arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* conn =
michael@0 2813 new _connection8<desttype, arg1_type, arg2_type, arg3_type,
michael@0 2814 arg4_type, arg5_type, arg6_type, arg7_type,
michael@0 2815 arg8_type, mt_policy>(pclass, pmemfun);
michael@0 2816 m_connected_slots.push_back(conn);
michael@0 2817 pclass->signal_connect(this);
michael@0 2818 }
michael@0 2819
michael@0 2820 void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
michael@0 2821 arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8)
michael@0 2822 {
michael@0 2823 lock_block<mt_policy> lock(this);
michael@0 2824 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2825 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2826
michael@0 2827 while(it != itEnd)
michael@0 2828 {
michael@0 2829 itNext = it;
michael@0 2830 ++itNext;
michael@0 2831
michael@0 2832 (*it)->emit(a1, a2, a3, a4, a5, a6, a7, a8);
michael@0 2833
michael@0 2834 it = itNext;
michael@0 2835 }
michael@0 2836 }
michael@0 2837
michael@0 2838 void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
michael@0 2839 arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8)
michael@0 2840 {
michael@0 2841 lock_block<mt_policy> lock(this);
michael@0 2842 typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
michael@0 2843 typename connections_list::const_iterator itEnd = m_connected_slots.end();
michael@0 2844
michael@0 2845 while(it != itEnd)
michael@0 2846 {
michael@0 2847 itNext = it;
michael@0 2848 ++itNext;
michael@0 2849
michael@0 2850 (*it)->emit(a1, a2, a3, a4, a5, a6, a7, a8);
michael@0 2851
michael@0 2852 it = itNext;
michael@0 2853 }
michael@0 2854 }
michael@0 2855 };
michael@0 2856
michael@0 2857 } // namespace sigslot
michael@0 2858
michael@0 2859 #endif // TALK_BASE_SIGSLOT_H__

mercurial