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