1 // -*- c++ -*- 2 /* Do not edit! -- generated file */ 3 4 #ifndef _SIGC_SIGNAL_H_ 5 #define _SIGC_SIGNAL_H_ 6 7 #include <list> 8 #include <sigc++/signal_base.h> 9 #include <sigc++/type_traits.h> 10 #include <sigc++/trackable.h> 11 #include <sigc++/functors/slot.h> 12 #include <sigc++/functors/mem_fun.h> 13 14 //SIGC_TYPEDEF_REDEFINE_ALLOWED: 15 // TODO: This should have its own test, but I can not create one that gives the error instead of just a warning. murrayc. 16 // I have just used this because there is a correlation between these two problems. 17 #ifdef SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD 18 //Compilers, such as older versions of SUN Forte C++, that do not allow this also often 19 //do not allow a typedef to have the same name as a class in the typedef's definition. 20 //For Sun Forte CC 5.7 (SUN Workshop 10), comment this out to fix the build. 21 // 22 //A.Leo.: Disabled since this feature doesn't really required and it causes problems during 23 //compilation on gcc-4.3.0 (at least on my system and with default flags/options) 24 //#define SIGC_TYPEDEF_REDEFINE_ALLOWED 1 25 #endif 26 27 namespace sigc { 28 29 /** STL-style iterator for slot_list. 30 * 31 * @ingroup signal 32 */ 33 template <typename T_slot> 34 struct slot_iterator 35 { 36 typedef size_t size_type; 37 typedef ptrdiff_t difference_type; 38 typedef std::bidirectional_iterator_tag iterator_category; 39 40 typedef T_slot slot_type; 41 42 typedef T_slot value_type; 43 typedef T_slot* pointer; 44 typedef T_slot& reference; 45 46 typedef typename internal::signal_impl::iterator_type iterator_type; 47 slot_iteratorslot_iterator48 slot_iterator() 49 {} 50 slot_iteratorslot_iterator51 explicit slot_iterator(const iterator_type& i) 52 : i_(i) {} 53 54 reference operator*() const 55 { return static_cast<reference>(*i_); } 56 57 pointer operator->() const 58 { return &(operator*()); } 59 60 slot_iterator& operator++() 61 { 62 ++i_; 63 return *this; 64 } 65 66 slot_iterator operator++(int) 67 { 68 slot_iterator __tmp(*this); 69 ++i_; 70 return __tmp; 71 } 72 73 slot_iterator& operator--() 74 { 75 --i_; 76 return *this; 77 } 78 79 slot_iterator operator--(int) 80 { 81 slot_iterator __tmp(*this); 82 --i_; 83 return __tmp; 84 } 85 86 bool operator == (const slot_iterator& other) const 87 { return i_ == other.i_; } 88 89 bool operator != (const slot_iterator& other) const 90 { return i_ != other.i_; } 91 92 iterator_type i_; 93 }; 94 95 /** STL-style const iterator for slot_list. 96 * 97 * @ingroup signal 98 */ 99 template <typename T_slot> 100 struct slot_const_iterator 101 { 102 typedef size_t size_type; 103 typedef ptrdiff_t difference_type; 104 typedef std::bidirectional_iterator_tag iterator_category; 105 106 typedef T_slot slot_type; 107 108 typedef T_slot value_type; 109 typedef const T_slot* pointer; 110 typedef const T_slot& reference; 111 112 typedef typename internal::signal_impl::const_iterator_type iterator_type; 113 slot_const_iteratorslot_const_iterator114 slot_const_iterator() 115 {} 116 slot_const_iteratorslot_const_iterator117 explicit slot_const_iterator(const iterator_type& i) 118 : i_(i) {} 119 120 reference operator*() const 121 { return static_cast<reference>(*i_); } 122 123 pointer operator->() const 124 { return &(operator*()); } 125 126 slot_const_iterator& operator++() 127 { 128 ++i_; 129 return *this; 130 } 131 132 slot_const_iterator operator++(int) 133 { 134 slot_const_iterator __tmp(*this); 135 ++i_; 136 return __tmp; 137 } 138 139 slot_const_iterator& operator--() 140 { 141 --i_; 142 return *this; 143 } 144 145 slot_const_iterator operator--(int) 146 { 147 slot_const_iterator __tmp(*this); 148 --i_; 149 return __tmp; 150 } 151 152 bool operator == (const slot_const_iterator& other) const 153 { return i_ == other.i_; } 154 155 bool operator != (const slot_const_iterator& other) const 156 { return i_ != other.i_; } 157 158 iterator_type i_; 159 }; 160 161 /** STL-style list interface for sigc::signal#. 162 * slot_list can be used to iterate over the list of slots that 163 * is managed by a signal. Slots can be added or removed from 164 * the list while existing iterators stay valid. A slot_list 165 * object can be retrieved from the signal's slots() function. 166 * 167 * @ingroup signal 168 */ 169 template <class T_slot> 170 struct slot_list 171 { 172 typedef T_slot slot_type; 173 174 typedef slot_type& reference; 175 typedef const slot_type& const_reference; 176 177 typedef slot_iterator<slot_type> iterator; 178 typedef slot_const_iterator<slot_type> const_iterator; 179 180 #ifndef SIGC_HAVE_SUN_REVERSE_ITERATOR 181 typedef std::reverse_iterator<iterator> reverse_iterator; 182 typedef std::reverse_iterator<const_iterator> const_reverse_iterator; 183 #else 184 typedef std::reverse_iterator<iterator, std::random_access_iterator_tag, 185 int, int&, int*, ptrdiff_t> reverse_iterator; 186 187 typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag, 188 int, const int&, const int*, ptrdiff_t> const_reverse_iterator; 189 #endif /* SIGC_HAVE_SUN_REVERSE_ITERATOR */ 190 191 192 193 slot_listslot_list194 slot_list() 195 : list_(0) {} 196 slot_listslot_list197 explicit slot_list(internal::signal_impl* __list) 198 : list_(__list) {} 199 beginslot_list200 iterator begin() 201 { return iterator(list_->slots_.begin()); } 202 beginslot_list203 const_iterator begin() const 204 { return const_iterator(list_->slots_.begin()); } 205 endslot_list206 iterator end() 207 { return iterator(list_->slots_.end()); } 208 endslot_list209 const_iterator end() const 210 { return const_iterator(list_->slots_.end()); } 211 rbeginslot_list212 reverse_iterator rbegin() 213 { return reverse_iterator(end()); } 214 rbeginslot_list215 const_reverse_iterator rbegin() const 216 { return const_reverse_iterator(end()); } 217 rendslot_list218 reverse_iterator rend() 219 { return reverse_iterator(begin()); } 220 rendslot_list221 const_reverse_iterator rend() const 222 { return const_reverse_iterator(begin()); } 223 frontslot_list224 reference front() 225 { return *begin(); } 226 frontslot_list227 const_reference front() const 228 { return *begin(); } 229 backslot_list230 reference back() 231 { return *(--end()); } 232 backslot_list233 const_reference back() const 234 { return *(--end()); } 235 insertslot_list236 iterator insert(iterator i, const slot_type& slot_) 237 { return iterator(list_->insert(i.i_, static_cast<const slot_base&>(slot_))); } 238 push_frontslot_list239 void push_front(const slot_type& c) 240 { insert(begin(), c); } 241 push_backslot_list242 void push_back(const slot_type& c) 243 { insert(end(), c); } 244 eraseslot_list245 iterator erase(iterator i) 246 { return iterator(list_->erase(i.i_)); } 247 eraseslot_list248 iterator erase(iterator first_, iterator last_) 249 { 250 while (first_ != last_) 251 first_ = erase(first_); 252 return last_; 253 } 254 pop_frontslot_list255 void pop_front() 256 { erase(begin()); } 257 pop_backslot_list258 void pop_back() 259 { 260 iterator tmp_ = end(); 261 erase(--tmp_); 262 } 263 264 protected: 265 internal::signal_impl* list_; 266 }; 267 268 269 namespace internal { 270 271 /** Special iterator over sigc::internal::signal_impl's slot list that holds extra data. 272 * This iterators is for use in accumulators. operator*() executes 273 * the slot. The return value is buffered, so that in an expression 274 * like @code a = (*i) * (*i); @endcode the slot is executed only once. 275 */ 276 template <class T_emitter, class T_result = typename T_emitter::result_type> 277 struct slot_iterator_buf 278 { 279 typedef size_t size_type; 280 typedef ptrdiff_t difference_type; 281 typedef std::bidirectional_iterator_tag iterator_category; 282 283 typedef T_emitter emitter_type; 284 typedef T_result result_type; 285 typedef typename T_emitter::slot_type slot_type; 286 287 typedef signal_impl::const_iterator_type iterator_type; 288 slot_iterator_bufslot_iterator_buf289 slot_iterator_buf() 290 : c_(0), invoked_(false) {} 291 slot_iterator_bufslot_iterator_buf292 slot_iterator_buf(const iterator_type& i, const emitter_type* c) 293 : i_(i), c_(c), invoked_(false) {} 294 295 result_type operator*() const 296 { 297 if (!i_->empty() && !i_->blocked() && !invoked_) 298 { 299 r_ = (*c_)(static_cast<const slot_type&>(*i_)); 300 invoked_ = true; 301 } 302 return r_; 303 } 304 305 slot_iterator_buf& operator++() 306 { 307 ++i_; 308 invoked_ = false; 309 return *this; 310 } 311 312 slot_iterator_buf operator++(int) 313 { 314 slot_iterator_buf __tmp(*this); 315 ++i_; 316 invoked_ = false; 317 return __tmp; 318 } 319 320 slot_iterator_buf& operator--() 321 { 322 --i_; 323 invoked_ = false; 324 return *this; 325 } 326 327 slot_iterator_buf operator--(int) 328 { 329 slot_iterator_buf __tmp(*this); 330 --i_; 331 invoked_ = false; 332 return __tmp; 333 } 334 335 bool operator == (const slot_iterator_buf& other) const 336 { return (!c_ || (i_ == other.i_)); } /* If '!c_' the iterators are empty. 337 * Unfortunately, empty stl iterators are not equal. 338 * We are forcing equality so that 'first==last' 339 * in the accumulator's emit function yields true. */ 340 341 bool operator != (const slot_iterator_buf& other) const 342 { return (c_ && (i_ != other.i_)); } 343 344 private: 345 iterator_type i_; 346 const emitter_type* c_; 347 mutable result_type r_; 348 mutable bool invoked_; 349 }; 350 351 /** Template specialization of slot_iterator_buf for void return signals. 352 */ 353 template <class T_emitter> 354 struct slot_iterator_buf<T_emitter, void> 355 { 356 typedef size_t size_type; 357 typedef ptrdiff_t difference_type; 358 typedef std::bidirectional_iterator_tag iterator_category; 359 360 typedef T_emitter emitter_type; 361 typedef void result_type; 362 typedef typename T_emitter::slot_type slot_type; 363 364 typedef signal_impl::const_iterator_type iterator_type; 365 366 slot_iterator_buf() 367 : c_(0), invoked_(false) {} 368 369 slot_iterator_buf(const iterator_type& i, const emitter_type* c) 370 : i_(i), c_(c), invoked_(false) {} 371 372 void operator*() const 373 { 374 if (!i_->empty() && !i_->blocked() && !invoked_) 375 { 376 (*c_)(static_cast<const slot_type&>(*i_)); 377 invoked_ = true; 378 } 379 } 380 381 slot_iterator_buf& operator++() 382 { 383 ++i_; 384 invoked_ = false; 385 return *this; 386 } 387 388 slot_iterator_buf operator++(int) 389 { 390 slot_iterator_buf __tmp(*this); 391 ++i_; 392 invoked_ = false; 393 return __tmp; 394 } 395 396 slot_iterator_buf& operator--() 397 { 398 --i_; 399 invoked_ = false; 400 return *this; 401 } 402 403 slot_iterator_buf operator--(int) 404 { 405 slot_iterator_buf __tmp(*this); 406 --i_; 407 invoked_ = false; 408 return __tmp; 409 } 410 411 bool operator == (const slot_iterator_buf& other) const 412 { return i_ == other.i_; } 413 414 bool operator != (const slot_iterator_buf& other) const 415 { return i_ != other.i_; } 416 417 private: 418 iterator_type i_; 419 const emitter_type* c_; 420 mutable bool invoked_; 421 }; 422 423 /** Abstracts signal emission. 424 * This template implements the emit() function of signal0. 425 * Template specializations are available to optimize signal 426 * emission when no accumulator is used, i.e. the template 427 * argument @e T_accumulator is @p nil. 428 */ 429 template <class T_return, class T_accumulator> 430 struct signal_emit0 431 { 432 typedef signal_emit0<T_return, T_accumulator> self_type; 433 typedef typename T_accumulator::result_type result_type; 434 typedef slot<T_return> slot_type; 435 typedef internal::slot_iterator_buf<self_type> slot_iterator_buf_type; 436 typedef signal_impl::const_iterator_type iterator_type; 437 438 signal_emit0() {} 439 440 /** Invokes a slot. 441 * @param _A_slot Some slot to invoke. 442 * @return The slot's return value. 443 */ 444 T_return operator()(const slot_type& _A_slot) const 445 { return (reinterpret_cast<typename slot_type::call_type>(_A_slot.rep_->call_))(_A_slot.rep_); } 446 447 /** Executes a list of slots using an accumulator of type @e T_accumulator. 448 449 * @return The accumulated return values of the slot invocations as processed by the accumulator. 450 */ 451 static result_type emit(signal_impl* impl) 452 { 453 T_accumulator accumulator; 454 455 if (!impl) 456 return accumulator(slot_iterator_buf_type(), slot_iterator_buf_type()); 457 458 signal_exec exec(impl); 459 temp_slot_list slots(impl->slots_); 460 461 self_type self ; 462 return accumulator(slot_iterator_buf_type(slots.begin(), &self), 463 slot_iterator_buf_type(slots.end(), &self)); 464 } 465 466 }; 467 468 /** Abstracts signal emission. 469 * This template specialization implements an optimized emit() 470 * function for the case that no accumulator is used. 471 */ 472 template <class T_return> 473 struct signal_emit0<T_return, nil> 474 { 475 typedef signal_emit0<T_return, nil > self_type; 476 typedef T_return result_type; 477 typedef slot<T_return> slot_type; 478 typedef signal_impl::const_iterator_type iterator_type; 479 typedef typename slot_type::call_type call_type; 480 481 /** Executes a list of slots using an accumulator of type @e T_accumulator. 482 * The return value of the last slot invoked is returned. 483 * @param first An iterator pointing to the first slot in the list. 484 * @param last An iterator pointing to the last slot in the list. 485 * @return The return value of the last slot invoked. 486 */ 487 static result_type emit(signal_impl* impl) 488 { 489 if (!impl || impl->slots_.empty()) 490 return T_return(); 491 492 signal_exec exec(impl); 493 T_return r_ = T_return(); 494 495 //Use this scope to make sure that "slots" is destroyed before "exec" is destroyed. 496 //This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249 497 { 498 temp_slot_list slots(impl->slots_); 499 iterator_type it = slots.begin(); 500 for (; it != slots.end(); ++it) 501 if (!it->empty() && !it->blocked()) break; 502 503 if (it == slots.end()) 504 return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and initialize as follows: 505 506 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_); 507 for (++it; it != slots.end(); ++it) 508 { 509 if (it->empty() || it->blocked()) 510 continue; 511 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_); 512 } 513 } 514 515 return r_; 516 } 517 }; 518 519 /** Abstracts signal emission. 520 * This template specialization implements an optimized emit() 521 * function for the case that no accumulator is used and the 522 * return type is @p void. 523 */ 524 template <> 525 struct signal_emit0<void, nil> 526 { 527 typedef signal_emit0<void, nil> self_type; 528 typedef void result_type; 529 typedef slot<void> slot_type; 530 typedef signal_impl::const_iterator_type iterator_type; 531 typedef void (*call_type)(slot_rep*); 532 533 /** Executes a list of slots using an accumulator of type @e T_accumulator. 534 * @param first An iterator pointing to the first slot in the list. 535 * @param last An iterator pointing to the last slot in the list. 536 */ 537 static result_type emit(signal_impl* impl) 538 { 539 if (!impl || impl->slots_.empty()) return; 540 signal_exec exec(impl); 541 temp_slot_list slots(impl->slots_); 542 543 for (iterator_type it = slots.begin(); it != slots.end(); ++it) 544 { 545 if (it->empty() || it->blocked()) 546 continue; 547 (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_); 548 } 549 } 550 }; 551 552 /** Abstracts signal emission. 553 * This template implements the emit() function of signal1. 554 * Template specializations are available to optimize signal 555 * emission when no accumulator is used, i.e. the template 556 * argument @e T_accumulator is @p nil. 557 */ 558 template <class T_return, class T_arg1, class T_accumulator> 559 struct signal_emit1 560 { 561 typedef signal_emit1<T_return, T_arg1, T_accumulator> self_type; 562 typedef typename T_accumulator::result_type result_type; 563 typedef slot<T_return, T_arg1> slot_type; 564 typedef internal::slot_iterator_buf<self_type> slot_iterator_buf_type; 565 typedef signal_impl::const_iterator_type iterator_type; 566 567 /** Instantiates the class. 568 * The parameters are stored in member variables. operator()() passes 569 * the values on to some slot. 570 */ 571 signal_emit1(typename type_trait<T_arg1>::take _A_a1) 572 : _A_a1_(_A_a1) {} 573 574 575 /** Invokes a slot using the buffered parameter values. 576 * @param _A_slot Some slot to invoke. 577 * @return The slot's return value. 578 */ 579 T_return operator()(const slot_type& _A_slot) const 580 { return (reinterpret_cast<typename slot_type::call_type>(_A_slot.rep_->call_))(_A_slot.rep_, _A_a1_); } 581 582 /** Executes a list of slots using an accumulator of type @e T_accumulator. 583 * The arguments are buffered in a temporary instance of signal_emit1. 584 585 * @param _A_a1 Argument to be passed on to the slots. 586 * @return The accumulated return values of the slot invocations as processed by the accumulator. 587 */ 588 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1) 589 { 590 T_accumulator accumulator; 591 592 if (!impl) 593 return accumulator(slot_iterator_buf_type(), slot_iterator_buf_type()); 594 595 signal_exec exec(impl); 596 temp_slot_list slots(impl->slots_); 597 598 self_type self (_A_a1); 599 return accumulator(slot_iterator_buf_type(slots.begin(), &self), 600 slot_iterator_buf_type(slots.end(), &self)); 601 } 602 603 typename type_trait<T_arg1>::take _A_a1_; 604 }; 605 606 /** Abstracts signal emission. 607 * This template specialization implements an optimized emit() 608 * function for the case that no accumulator is used. 609 */ 610 template <class T_return, class T_arg1> 611 struct signal_emit1<T_return, T_arg1, nil> 612 { 613 typedef signal_emit1<T_return, T_arg1, nil > self_type; 614 typedef T_return result_type; 615 typedef slot<T_return, T_arg1> slot_type; 616 typedef signal_impl::const_iterator_type iterator_type; 617 typedef typename slot_type::call_type call_type; 618 619 /** Executes a list of slots using an accumulator of type @e T_accumulator. 620 * The arguments are passed directly on to the slots. 621 * The return value of the last slot invoked is returned. 622 * @param first An iterator pointing to the first slot in the list. 623 * @param last An iterator pointing to the last slot in the list. 624 * @param _A_a1 Argument to be passed on to the slots. 625 * @return The return value of the last slot invoked. 626 */ 627 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1) 628 { 629 if (!impl || impl->slots_.empty()) 630 return T_return(); 631 632 signal_exec exec(impl); 633 T_return r_ = T_return(); 634 635 //Use this scope to make sure that "slots" is destroyed before "exec" is destroyed. 636 //This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249 637 { 638 temp_slot_list slots(impl->slots_); 639 iterator_type it = slots.begin(); 640 for (; it != slots.end(); ++it) 641 if (!it->empty() && !it->blocked()) break; 642 643 if (it == slots.end()) 644 return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and initialize as follows: 645 646 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1); 647 for (++it; it != slots.end(); ++it) 648 { 649 if (it->empty() || it->blocked()) 650 continue; 651 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1); 652 } 653 } 654 655 return r_; 656 } 657 }; 658 659 /** Abstracts signal emission. 660 * This template specialization implements an optimized emit() 661 * function for the case that no accumulator is used and the 662 * return type is @p void. 663 */ 664 template <class T_arg1> 665 struct signal_emit1<void, T_arg1, nil> 666 { 667 typedef signal_emit1<void, T_arg1, nil> self_type; 668 typedef void result_type; 669 typedef slot<void, T_arg1> slot_type; 670 typedef signal_impl::const_iterator_type iterator_type; 671 typedef typename slot_type::call_type call_type; 672 673 /** Executes a list of slots using an accumulator of type @e T_accumulator. 674 * The arguments are passed directly on to the slots. 675 * @param first An iterator pointing to the first slot in the list. 676 * @param last An iterator pointing to the last slot in the list. 677 * @param _A_a1 Argument to be passed on to the slots. 678 */ 679 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1) 680 { 681 if (!impl || impl->slots_.empty()) return; 682 signal_exec exec(impl); 683 temp_slot_list slots(impl->slots_); 684 685 for (iterator_type it = slots.begin(); it != slots.end(); ++it) 686 { 687 if (it->empty() || it->blocked()) 688 continue; 689 (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1); 690 } 691 } 692 }; 693 694 /** Abstracts signal emission. 695 * This template implements the emit() function of signal2. 696 * Template specializations are available to optimize signal 697 * emission when no accumulator is used, i.e. the template 698 * argument @e T_accumulator is @p nil. 699 */ 700 template <class T_return, class T_arg1,class T_arg2, class T_accumulator> 701 struct signal_emit2 702 { 703 typedef signal_emit2<T_return, T_arg1,T_arg2, T_accumulator> self_type; 704 typedef typename T_accumulator::result_type result_type; 705 typedef slot<T_return, T_arg1,T_arg2> slot_type; 706 typedef internal::slot_iterator_buf<self_type> slot_iterator_buf_type; 707 typedef signal_impl::const_iterator_type iterator_type; 708 709 /** Instantiates the class. 710 * The parameters are stored in member variables. operator()() passes 711 * the values on to some slot. 712 */ 713 signal_emit2(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2) 714 : _A_a1_(_A_a1),_A_a2_(_A_a2) {} 715 716 717 /** Invokes a slot using the buffered parameter values. 718 * @param _A_slot Some slot to invoke. 719 * @return The slot's return value. 720 */ 721 T_return operator()(const slot_type& _A_slot) const 722 { return (reinterpret_cast<typename slot_type::call_type>(_A_slot.rep_->call_))(_A_slot.rep_, _A_a1_,_A_a2_); } 723 724 /** Executes a list of slots using an accumulator of type @e T_accumulator. 725 * The arguments are buffered in a temporary instance of signal_emit2. 726 727 * @param _A_a1 Argument to be passed on to the slots. 728 * @param _A_a2 Argument to be passed on to the slots. 729 * @return The accumulated return values of the slot invocations as processed by the accumulator. 730 */ 731 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2) 732 { 733 T_accumulator accumulator; 734 735 if (!impl) 736 return accumulator(slot_iterator_buf_type(), slot_iterator_buf_type()); 737 738 signal_exec exec(impl); 739 temp_slot_list slots(impl->slots_); 740 741 self_type self (_A_a1,_A_a2); 742 return accumulator(slot_iterator_buf_type(slots.begin(), &self), 743 slot_iterator_buf_type(slots.end(), &self)); 744 } 745 746 typename type_trait<T_arg1>::take _A_a1_; 747 typename type_trait<T_arg2>::take _A_a2_; 748 }; 749 750 /** Abstracts signal emission. 751 * This template specialization implements an optimized emit() 752 * function for the case that no accumulator is used. 753 */ 754 template <class T_return, class T_arg1,class T_arg2> 755 struct signal_emit2<T_return, T_arg1,T_arg2, nil> 756 { 757 typedef signal_emit2<T_return, T_arg1,T_arg2, nil > self_type; 758 typedef T_return result_type; 759 typedef slot<T_return, T_arg1,T_arg2> slot_type; 760 typedef signal_impl::const_iterator_type iterator_type; 761 typedef typename slot_type::call_type call_type; 762 763 /** Executes a list of slots using an accumulator of type @e T_accumulator. 764 * The arguments are passed directly on to the slots. 765 * The return value of the last slot invoked is returned. 766 * @param first An iterator pointing to the first slot in the list. 767 * @param last An iterator pointing to the last slot in the list. 768 * @param _A_a1 Argument to be passed on to the slots. 769 * @param _A_a2 Argument to be passed on to the slots. 770 * @return The return value of the last slot invoked. 771 */ 772 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2) 773 { 774 if (!impl || impl->slots_.empty()) 775 return T_return(); 776 777 signal_exec exec(impl); 778 T_return r_ = T_return(); 779 780 //Use this scope to make sure that "slots" is destroyed before "exec" is destroyed. 781 //This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249 782 { 783 temp_slot_list slots(impl->slots_); 784 iterator_type it = slots.begin(); 785 for (; it != slots.end(); ++it) 786 if (!it->empty() && !it->blocked()) break; 787 788 if (it == slots.end()) 789 return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and initialize as follows: 790 791 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2); 792 for (++it; it != slots.end(); ++it) 793 { 794 if (it->empty() || it->blocked()) 795 continue; 796 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2); 797 } 798 } 799 800 return r_; 801 } 802 }; 803 804 /** Abstracts signal emission. 805 * This template specialization implements an optimized emit() 806 * function for the case that no accumulator is used and the 807 * return type is @p void. 808 */ 809 template <class T_arg1,class T_arg2> 810 struct signal_emit2<void, T_arg1,T_arg2, nil> 811 { 812 typedef signal_emit2<void, T_arg1,T_arg2, nil> self_type; 813 typedef void result_type; 814 typedef slot<void, T_arg1,T_arg2> slot_type; 815 typedef signal_impl::const_iterator_type iterator_type; 816 typedef typename slot_type::call_type call_type; 817 818 /** Executes a list of slots using an accumulator of type @e T_accumulator. 819 * The arguments are passed directly on to the slots. 820 * @param first An iterator pointing to the first slot in the list. 821 * @param last An iterator pointing to the last slot in the list. 822 * @param _A_a1 Argument to be passed on to the slots. 823 * @param _A_a2 Argument to be passed on to the slots. 824 */ 825 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2) 826 { 827 if (!impl || impl->slots_.empty()) return; 828 signal_exec exec(impl); 829 temp_slot_list slots(impl->slots_); 830 831 for (iterator_type it = slots.begin(); it != slots.end(); ++it) 832 { 833 if (it->empty() || it->blocked()) 834 continue; 835 (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2); 836 } 837 } 838 }; 839 840 /** Abstracts signal emission. 841 * This template implements the emit() function of signal3. 842 * Template specializations are available to optimize signal 843 * emission when no accumulator is used, i.e. the template 844 * argument @e T_accumulator is @p nil. 845 */ 846 template <class T_return, class T_arg1,class T_arg2,class T_arg3, class T_accumulator> 847 struct signal_emit3 848 { 849 typedef signal_emit3<T_return, T_arg1,T_arg2,T_arg3, T_accumulator> self_type; 850 typedef typename T_accumulator::result_type result_type; 851 typedef slot<T_return, T_arg1,T_arg2,T_arg3> slot_type; 852 typedef internal::slot_iterator_buf<self_type> slot_iterator_buf_type; 853 typedef signal_impl::const_iterator_type iterator_type; 854 855 /** Instantiates the class. 856 * The parameters are stored in member variables. operator()() passes 857 * the values on to some slot. 858 */ 859 signal_emit3(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3) 860 : _A_a1_(_A_a1),_A_a2_(_A_a2),_A_a3_(_A_a3) {} 861 862 863 /** Invokes a slot using the buffered parameter values. 864 * @param _A_slot Some slot to invoke. 865 * @return The slot's return value. 866 */ 867 T_return operator()(const slot_type& _A_slot) const 868 { return (reinterpret_cast<typename slot_type::call_type>(_A_slot.rep_->call_))(_A_slot.rep_, _A_a1_,_A_a2_,_A_a3_); } 869 870 /** Executes a list of slots using an accumulator of type @e T_accumulator. 871 * The arguments are buffered in a temporary instance of signal_emit3. 872 873 * @param _A_a1 Argument to be passed on to the slots. 874 * @param _A_a2 Argument to be passed on to the slots. 875 * @param _A_a3 Argument to be passed on to the slots. 876 * @return The accumulated return values of the slot invocations as processed by the accumulator. 877 */ 878 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3) 879 { 880 T_accumulator accumulator; 881 882 if (!impl) 883 return accumulator(slot_iterator_buf_type(), slot_iterator_buf_type()); 884 885 signal_exec exec(impl); 886 temp_slot_list slots(impl->slots_); 887 888 self_type self (_A_a1,_A_a2,_A_a3); 889 return accumulator(slot_iterator_buf_type(slots.begin(), &self), 890 slot_iterator_buf_type(slots.end(), &self)); 891 } 892 893 typename type_trait<T_arg1>::take _A_a1_; 894 typename type_trait<T_arg2>::take _A_a2_; 895 typename type_trait<T_arg3>::take _A_a3_; 896 }; 897 898 /** Abstracts signal emission. 899 * This template specialization implements an optimized emit() 900 * function for the case that no accumulator is used. 901 */ 902 template <class T_return, class T_arg1,class T_arg2,class T_arg3> 903 struct signal_emit3<T_return, T_arg1,T_arg2,T_arg3, nil> 904 { 905 typedef signal_emit3<T_return, T_arg1,T_arg2,T_arg3, nil > self_type; 906 typedef T_return result_type; 907 typedef slot<T_return, T_arg1,T_arg2,T_arg3> slot_type; 908 typedef signal_impl::const_iterator_type iterator_type; 909 typedef typename slot_type::call_type call_type; 910 911 /** Executes a list of slots using an accumulator of type @e T_accumulator. 912 * The arguments are passed directly on to the slots. 913 * The return value of the last slot invoked is returned. 914 * @param first An iterator pointing to the first slot in the list. 915 * @param last An iterator pointing to the last slot in the list. 916 * @param _A_a1 Argument to be passed on to the slots. 917 * @param _A_a2 Argument to be passed on to the slots. 918 * @param _A_a3 Argument to be passed on to the slots. 919 * @return The return value of the last slot invoked. 920 */ 921 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3) 922 { 923 if (!impl || impl->slots_.empty()) 924 return T_return(); 925 926 signal_exec exec(impl); 927 T_return r_ = T_return(); 928 929 //Use this scope to make sure that "slots" is destroyed before "exec" is destroyed. 930 //This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249 931 { 932 temp_slot_list slots(impl->slots_); 933 iterator_type it = slots.begin(); 934 for (; it != slots.end(); ++it) 935 if (!it->empty() && !it->blocked()) break; 936 937 if (it == slots.end()) 938 return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and initialize as follows: 939 940 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3); 941 for (++it; it != slots.end(); ++it) 942 { 943 if (it->empty() || it->blocked()) 944 continue; 945 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3); 946 } 947 } 948 949 return r_; 950 } 951 }; 952 953 /** Abstracts signal emission. 954 * This template specialization implements an optimized emit() 955 * function for the case that no accumulator is used and the 956 * return type is @p void. 957 */ 958 template <class T_arg1,class T_arg2,class T_arg3> 959 struct signal_emit3<void, T_arg1,T_arg2,T_arg3, nil> 960 { 961 typedef signal_emit3<void, T_arg1,T_arg2,T_arg3, nil> self_type; 962 typedef void result_type; 963 typedef slot<void, T_arg1,T_arg2,T_arg3> slot_type; 964 typedef signal_impl::const_iterator_type iterator_type; 965 typedef typename slot_type::call_type call_type; 966 967 /** Executes a list of slots using an accumulator of type @e T_accumulator. 968 * The arguments are passed directly on to the slots. 969 * @param first An iterator pointing to the first slot in the list. 970 * @param last An iterator pointing to the last slot in the list. 971 * @param _A_a1 Argument to be passed on to the slots. 972 * @param _A_a2 Argument to be passed on to the slots. 973 * @param _A_a3 Argument to be passed on to the slots. 974 */ 975 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3) 976 { 977 if (!impl || impl->slots_.empty()) return; 978 signal_exec exec(impl); 979 temp_slot_list slots(impl->slots_); 980 981 for (iterator_type it = slots.begin(); it != slots.end(); ++it) 982 { 983 if (it->empty() || it->blocked()) 984 continue; 985 (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3); 986 } 987 } 988 }; 989 990 /** Abstracts signal emission. 991 * This template implements the emit() function of signal4. 992 * Template specializations are available to optimize signal 993 * emission when no accumulator is used, i.e. the template 994 * argument @e T_accumulator is @p nil. 995 */ 996 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4, class T_accumulator> 997 struct signal_emit4 998 { 999 typedef signal_emit4<T_return, T_arg1,T_arg2,T_arg3,T_arg4, T_accumulator> self_type; 1000 typedef typename T_accumulator::result_type result_type; 1001 typedef slot<T_return, T_arg1,T_arg2,T_arg3,T_arg4> slot_type; 1002 typedef internal::slot_iterator_buf<self_type> slot_iterator_buf_type; 1003 typedef signal_impl::const_iterator_type iterator_type; 1004 1005 /** Instantiates the class. 1006 * The parameters are stored in member variables. operator()() passes 1007 * the values on to some slot. 1008 */ 1009 signal_emit4(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4) 1010 : _A_a1_(_A_a1),_A_a2_(_A_a2),_A_a3_(_A_a3),_A_a4_(_A_a4) {} 1011 1012 1013 /** Invokes a slot using the buffered parameter values. 1014 * @param _A_slot Some slot to invoke. 1015 * @return The slot's return value. 1016 */ 1017 T_return operator()(const slot_type& _A_slot) const 1018 { return (reinterpret_cast<typename slot_type::call_type>(_A_slot.rep_->call_))(_A_slot.rep_, _A_a1_,_A_a2_,_A_a3_,_A_a4_); } 1019 1020 /** Executes a list of slots using an accumulator of type @e T_accumulator. 1021 * The arguments are buffered in a temporary instance of signal_emit4. 1022 1023 * @param _A_a1 Argument to be passed on to the slots. 1024 * @param _A_a2 Argument to be passed on to the slots. 1025 * @param _A_a3 Argument to be passed on to the slots. 1026 * @param _A_a4 Argument to be passed on to the slots. 1027 * @return The accumulated return values of the slot invocations as processed by the accumulator. 1028 */ 1029 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4) 1030 { 1031 T_accumulator accumulator; 1032 1033 if (!impl) 1034 return accumulator(slot_iterator_buf_type(), slot_iterator_buf_type()); 1035 1036 signal_exec exec(impl); 1037 temp_slot_list slots(impl->slots_); 1038 1039 self_type self (_A_a1,_A_a2,_A_a3,_A_a4); 1040 return accumulator(slot_iterator_buf_type(slots.begin(), &self), 1041 slot_iterator_buf_type(slots.end(), &self)); 1042 } 1043 1044 typename type_trait<T_arg1>::take _A_a1_; 1045 typename type_trait<T_arg2>::take _A_a2_; 1046 typename type_trait<T_arg3>::take _A_a3_; 1047 typename type_trait<T_arg4>::take _A_a4_; 1048 }; 1049 1050 /** Abstracts signal emission. 1051 * This template specialization implements an optimized emit() 1052 * function for the case that no accumulator is used. 1053 */ 1054 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4> 1055 struct signal_emit4<T_return, T_arg1,T_arg2,T_arg3,T_arg4, nil> 1056 { 1057 typedef signal_emit4<T_return, T_arg1,T_arg2,T_arg3,T_arg4, nil > self_type; 1058 typedef T_return result_type; 1059 typedef slot<T_return, T_arg1,T_arg2,T_arg3,T_arg4> slot_type; 1060 typedef signal_impl::const_iterator_type iterator_type; 1061 typedef typename slot_type::call_type call_type; 1062 1063 /** Executes a list of slots using an accumulator of type @e T_accumulator. 1064 * The arguments are passed directly on to the slots. 1065 * The return value of the last slot invoked is returned. 1066 * @param first An iterator pointing to the first slot in the list. 1067 * @param last An iterator pointing to the last slot in the list. 1068 * @param _A_a1 Argument to be passed on to the slots. 1069 * @param _A_a2 Argument to be passed on to the slots. 1070 * @param _A_a3 Argument to be passed on to the slots. 1071 * @param _A_a4 Argument to be passed on to the slots. 1072 * @return The return value of the last slot invoked. 1073 */ 1074 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4) 1075 { 1076 if (!impl || impl->slots_.empty()) 1077 return T_return(); 1078 1079 signal_exec exec(impl); 1080 T_return r_ = T_return(); 1081 1082 //Use this scope to make sure that "slots" is destroyed before "exec" is destroyed. 1083 //This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249 1084 { 1085 temp_slot_list slots(impl->slots_); 1086 iterator_type it = slots.begin(); 1087 for (; it != slots.end(); ++it) 1088 if (!it->empty() && !it->blocked()) break; 1089 1090 if (it == slots.end()) 1091 return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and initialize as follows: 1092 1093 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3,_A_a4); 1094 for (++it; it != slots.end(); ++it) 1095 { 1096 if (it->empty() || it->blocked()) 1097 continue; 1098 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3,_A_a4); 1099 } 1100 } 1101 1102 return r_; 1103 } 1104 }; 1105 1106 /** Abstracts signal emission. 1107 * This template specialization implements an optimized emit() 1108 * function for the case that no accumulator is used and the 1109 * return type is @p void. 1110 */ 1111 template <class T_arg1,class T_arg2,class T_arg3,class T_arg4> 1112 struct signal_emit4<void, T_arg1,T_arg2,T_arg3,T_arg4, nil> 1113 { 1114 typedef signal_emit4<void, T_arg1,T_arg2,T_arg3,T_arg4, nil> self_type; 1115 typedef void result_type; 1116 typedef slot<void, T_arg1,T_arg2,T_arg3,T_arg4> slot_type; 1117 typedef signal_impl::const_iterator_type iterator_type; 1118 typedef typename slot_type::call_type call_type; 1119 1120 /** Executes a list of slots using an accumulator of type @e T_accumulator. 1121 * The arguments are passed directly on to the slots. 1122 * @param first An iterator pointing to the first slot in the list. 1123 * @param last An iterator pointing to the last slot in the list. 1124 * @param _A_a1 Argument to be passed on to the slots. 1125 * @param _A_a2 Argument to be passed on to the slots. 1126 * @param _A_a3 Argument to be passed on to the slots. 1127 * @param _A_a4 Argument to be passed on to the slots. 1128 */ 1129 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4) 1130 { 1131 if (!impl || impl->slots_.empty()) return; 1132 signal_exec exec(impl); 1133 temp_slot_list slots(impl->slots_); 1134 1135 for (iterator_type it = slots.begin(); it != slots.end(); ++it) 1136 { 1137 if (it->empty() || it->blocked()) 1138 continue; 1139 (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3,_A_a4); 1140 } 1141 } 1142 }; 1143 1144 /** Abstracts signal emission. 1145 * This template implements the emit() function of signal5. 1146 * Template specializations are available to optimize signal 1147 * emission when no accumulator is used, i.e. the template 1148 * argument @e T_accumulator is @p nil. 1149 */ 1150 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5, class T_accumulator> 1151 struct signal_emit5 1152 { 1153 typedef signal_emit5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, T_accumulator> self_type; 1154 typedef typename T_accumulator::result_type result_type; 1155 typedef slot<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> slot_type; 1156 typedef internal::slot_iterator_buf<self_type> slot_iterator_buf_type; 1157 typedef signal_impl::const_iterator_type iterator_type; 1158 1159 /** Instantiates the class. 1160 * The parameters are stored in member variables. operator()() passes 1161 * the values on to some slot. 1162 */ 1163 signal_emit5(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5) 1164 : _A_a1_(_A_a1),_A_a2_(_A_a2),_A_a3_(_A_a3),_A_a4_(_A_a4),_A_a5_(_A_a5) {} 1165 1166 1167 /** Invokes a slot using the buffered parameter values. 1168 * @param _A_slot Some slot to invoke. 1169 * @return The slot's return value. 1170 */ 1171 T_return operator()(const slot_type& _A_slot) const 1172 { return (reinterpret_cast<typename slot_type::call_type>(_A_slot.rep_->call_))(_A_slot.rep_, _A_a1_,_A_a2_,_A_a3_,_A_a4_,_A_a5_); } 1173 1174 /** Executes a list of slots using an accumulator of type @e T_accumulator. 1175 * The arguments are buffered in a temporary instance of signal_emit5. 1176 1177 * @param _A_a1 Argument to be passed on to the slots. 1178 * @param _A_a2 Argument to be passed on to the slots. 1179 * @param _A_a3 Argument to be passed on to the slots. 1180 * @param _A_a4 Argument to be passed on to the slots. 1181 * @param _A_a5 Argument to be passed on to the slots. 1182 * @return The accumulated return values of the slot invocations as processed by the accumulator. 1183 */ 1184 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5) 1185 { 1186 T_accumulator accumulator; 1187 1188 if (!impl) 1189 return accumulator(slot_iterator_buf_type(), slot_iterator_buf_type()); 1190 1191 signal_exec exec(impl); 1192 temp_slot_list slots(impl->slots_); 1193 1194 self_type self (_A_a1,_A_a2,_A_a3,_A_a4,_A_a5); 1195 return accumulator(slot_iterator_buf_type(slots.begin(), &self), 1196 slot_iterator_buf_type(slots.end(), &self)); 1197 } 1198 1199 typename type_trait<T_arg1>::take _A_a1_; 1200 typename type_trait<T_arg2>::take _A_a2_; 1201 typename type_trait<T_arg3>::take _A_a3_; 1202 typename type_trait<T_arg4>::take _A_a4_; 1203 typename type_trait<T_arg5>::take _A_a5_; 1204 }; 1205 1206 /** Abstracts signal emission. 1207 * This template specialization implements an optimized emit() 1208 * function for the case that no accumulator is used. 1209 */ 1210 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5> 1211 struct signal_emit5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, nil> 1212 { 1213 typedef signal_emit5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, nil > self_type; 1214 typedef T_return result_type; 1215 typedef slot<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> slot_type; 1216 typedef signal_impl::const_iterator_type iterator_type; 1217 typedef typename slot_type::call_type call_type; 1218 1219 /** Executes a list of slots using an accumulator of type @e T_accumulator. 1220 * The arguments are passed directly on to the slots. 1221 * The return value of the last slot invoked is returned. 1222 * @param first An iterator pointing to the first slot in the list. 1223 * @param last An iterator pointing to the last slot in the list. 1224 * @param _A_a1 Argument to be passed on to the slots. 1225 * @param _A_a2 Argument to be passed on to the slots. 1226 * @param _A_a3 Argument to be passed on to the slots. 1227 * @param _A_a4 Argument to be passed on to the slots. 1228 * @param _A_a5 Argument to be passed on to the slots. 1229 * @return The return value of the last slot invoked. 1230 */ 1231 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5) 1232 { 1233 if (!impl || impl->slots_.empty()) 1234 return T_return(); 1235 1236 signal_exec exec(impl); 1237 T_return r_ = T_return(); 1238 1239 //Use this scope to make sure that "slots" is destroyed before "exec" is destroyed. 1240 //This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249 1241 { 1242 temp_slot_list slots(impl->slots_); 1243 iterator_type it = slots.begin(); 1244 for (; it != slots.end(); ++it) 1245 if (!it->empty() && !it->blocked()) break; 1246 1247 if (it == slots.end()) 1248 return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and initialize as follows: 1249 1250 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5); 1251 for (++it; it != slots.end(); ++it) 1252 { 1253 if (it->empty() || it->blocked()) 1254 continue; 1255 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5); 1256 } 1257 } 1258 1259 return r_; 1260 } 1261 }; 1262 1263 /** Abstracts signal emission. 1264 * This template specialization implements an optimized emit() 1265 * function for the case that no accumulator is used and the 1266 * return type is @p void. 1267 */ 1268 template <class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5> 1269 struct signal_emit5<void, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, nil> 1270 { 1271 typedef signal_emit5<void, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, nil> self_type; 1272 typedef void result_type; 1273 typedef slot<void, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> slot_type; 1274 typedef signal_impl::const_iterator_type iterator_type; 1275 typedef typename slot_type::call_type call_type; 1276 1277 /** Executes a list of slots using an accumulator of type @e T_accumulator. 1278 * The arguments are passed directly on to the slots. 1279 * @param first An iterator pointing to the first slot in the list. 1280 * @param last An iterator pointing to the last slot in the list. 1281 * @param _A_a1 Argument to be passed on to the slots. 1282 * @param _A_a2 Argument to be passed on to the slots. 1283 * @param _A_a3 Argument to be passed on to the slots. 1284 * @param _A_a4 Argument to be passed on to the slots. 1285 * @param _A_a5 Argument to be passed on to the slots. 1286 */ 1287 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5) 1288 { 1289 if (!impl || impl->slots_.empty()) return; 1290 signal_exec exec(impl); 1291 temp_slot_list slots(impl->slots_); 1292 1293 for (iterator_type it = slots.begin(); it != slots.end(); ++it) 1294 { 1295 if (it->empty() || it->blocked()) 1296 continue; 1297 (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5); 1298 } 1299 } 1300 }; 1301 1302 /** Abstracts signal emission. 1303 * This template implements the emit() function of signal6. 1304 * Template specializations are available to optimize signal 1305 * emission when no accumulator is used, i.e. the template 1306 * argument @e T_accumulator is @p nil. 1307 */ 1308 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6, class T_accumulator> 1309 struct signal_emit6 1310 { 1311 typedef signal_emit6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, T_accumulator> self_type; 1312 typedef typename T_accumulator::result_type result_type; 1313 typedef slot<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> slot_type; 1314 typedef internal::slot_iterator_buf<self_type> slot_iterator_buf_type; 1315 typedef signal_impl::const_iterator_type iterator_type; 1316 1317 /** Instantiates the class. 1318 * The parameters are stored in member variables. operator()() passes 1319 * the values on to some slot. 1320 */ 1321 signal_emit6(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5,typename type_trait<T_arg6>::take _A_a6) 1322 : _A_a1_(_A_a1),_A_a2_(_A_a2),_A_a3_(_A_a3),_A_a4_(_A_a4),_A_a5_(_A_a5),_A_a6_(_A_a6) {} 1323 1324 1325 /** Invokes a slot using the buffered parameter values. 1326 * @param _A_slot Some slot to invoke. 1327 * @return The slot's return value. 1328 */ 1329 T_return operator()(const slot_type& _A_slot) const 1330 { return (reinterpret_cast<typename slot_type::call_type>(_A_slot.rep_->call_))(_A_slot.rep_, _A_a1_,_A_a2_,_A_a3_,_A_a4_,_A_a5_,_A_a6_); } 1331 1332 /** Executes a list of slots using an accumulator of type @e T_accumulator. 1333 * The arguments are buffered in a temporary instance of signal_emit6. 1334 1335 * @param _A_a1 Argument to be passed on to the slots. 1336 * @param _A_a2 Argument to be passed on to the slots. 1337 * @param _A_a3 Argument to be passed on to the slots. 1338 * @param _A_a4 Argument to be passed on to the slots. 1339 * @param _A_a5 Argument to be passed on to the slots. 1340 * @param _A_a6 Argument to be passed on to the slots. 1341 * @return The accumulated return values of the slot invocations as processed by the accumulator. 1342 */ 1343 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5,typename type_trait<T_arg6>::take _A_a6) 1344 { 1345 T_accumulator accumulator; 1346 1347 if (!impl) 1348 return accumulator(slot_iterator_buf_type(), slot_iterator_buf_type()); 1349 1350 signal_exec exec(impl); 1351 temp_slot_list slots(impl->slots_); 1352 1353 self_type self (_A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6); 1354 return accumulator(slot_iterator_buf_type(slots.begin(), &self), 1355 slot_iterator_buf_type(slots.end(), &self)); 1356 } 1357 1358 typename type_trait<T_arg1>::take _A_a1_; 1359 typename type_trait<T_arg2>::take _A_a2_; 1360 typename type_trait<T_arg3>::take _A_a3_; 1361 typename type_trait<T_arg4>::take _A_a4_; 1362 typename type_trait<T_arg5>::take _A_a5_; 1363 typename type_trait<T_arg6>::take _A_a6_; 1364 }; 1365 1366 /** Abstracts signal emission. 1367 * This template specialization implements an optimized emit() 1368 * function for the case that no accumulator is used. 1369 */ 1370 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6> 1371 struct signal_emit6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, nil> 1372 { 1373 typedef signal_emit6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, nil > self_type; 1374 typedef T_return result_type; 1375 typedef slot<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> slot_type; 1376 typedef signal_impl::const_iterator_type iterator_type; 1377 typedef typename slot_type::call_type call_type; 1378 1379 /** Executes a list of slots using an accumulator of type @e T_accumulator. 1380 * The arguments are passed directly on to the slots. 1381 * The return value of the last slot invoked is returned. 1382 * @param first An iterator pointing to the first slot in the list. 1383 * @param last An iterator pointing to the last slot in the list. 1384 * @param _A_a1 Argument to be passed on to the slots. 1385 * @param _A_a2 Argument to be passed on to the slots. 1386 * @param _A_a3 Argument to be passed on to the slots. 1387 * @param _A_a4 Argument to be passed on to the slots. 1388 * @param _A_a5 Argument to be passed on to the slots. 1389 * @param _A_a6 Argument to be passed on to the slots. 1390 * @return The return value of the last slot invoked. 1391 */ 1392 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5,typename type_trait<T_arg6>::take _A_a6) 1393 { 1394 if (!impl || impl->slots_.empty()) 1395 return T_return(); 1396 1397 signal_exec exec(impl); 1398 T_return r_ = T_return(); 1399 1400 //Use this scope to make sure that "slots" is destroyed before "exec" is destroyed. 1401 //This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249 1402 { 1403 temp_slot_list slots(impl->slots_); 1404 iterator_type it = slots.begin(); 1405 for (; it != slots.end(); ++it) 1406 if (!it->empty() && !it->blocked()) break; 1407 1408 if (it == slots.end()) 1409 return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and initialize as follows: 1410 1411 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6); 1412 for (++it; it != slots.end(); ++it) 1413 { 1414 if (it->empty() || it->blocked()) 1415 continue; 1416 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6); 1417 } 1418 } 1419 1420 return r_; 1421 } 1422 }; 1423 1424 /** Abstracts signal emission. 1425 * This template specialization implements an optimized emit() 1426 * function for the case that no accumulator is used and the 1427 * return type is @p void. 1428 */ 1429 template <class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6> 1430 struct signal_emit6<void, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, nil> 1431 { 1432 typedef signal_emit6<void, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, nil> self_type; 1433 typedef void result_type; 1434 typedef slot<void, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> slot_type; 1435 typedef signal_impl::const_iterator_type iterator_type; 1436 typedef typename slot_type::call_type call_type; 1437 1438 /** Executes a list of slots using an accumulator of type @e T_accumulator. 1439 * The arguments are passed directly on to the slots. 1440 * @param first An iterator pointing to the first slot in the list. 1441 * @param last An iterator pointing to the last slot in the list. 1442 * @param _A_a1 Argument to be passed on to the slots. 1443 * @param _A_a2 Argument to be passed on to the slots. 1444 * @param _A_a3 Argument to be passed on to the slots. 1445 * @param _A_a4 Argument to be passed on to the slots. 1446 * @param _A_a5 Argument to be passed on to the slots. 1447 * @param _A_a6 Argument to be passed on to the slots. 1448 */ 1449 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5,typename type_trait<T_arg6>::take _A_a6) 1450 { 1451 if (!impl || impl->slots_.empty()) return; 1452 signal_exec exec(impl); 1453 temp_slot_list slots(impl->slots_); 1454 1455 for (iterator_type it = slots.begin(); it != slots.end(); ++it) 1456 { 1457 if (it->empty() || it->blocked()) 1458 continue; 1459 (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6); 1460 } 1461 } 1462 }; 1463 1464 /** Abstracts signal emission. 1465 * This template implements the emit() function of signal7. 1466 * Template specializations are available to optimize signal 1467 * emission when no accumulator is used, i.e. the template 1468 * argument @e T_accumulator is @p nil. 1469 */ 1470 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7, class T_accumulator> 1471 struct signal_emit7 1472 { 1473 typedef signal_emit7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, T_accumulator> self_type; 1474 typedef typename T_accumulator::result_type result_type; 1475 typedef slot<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> slot_type; 1476 typedef internal::slot_iterator_buf<self_type> slot_iterator_buf_type; 1477 typedef signal_impl::const_iterator_type iterator_type; 1478 1479 /** Instantiates the class. 1480 * The parameters are stored in member variables. operator()() passes 1481 * the values on to some slot. 1482 */ 1483 signal_emit7(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5,typename type_trait<T_arg6>::take _A_a6,typename type_trait<T_arg7>::take _A_a7) 1484 : _A_a1_(_A_a1),_A_a2_(_A_a2),_A_a3_(_A_a3),_A_a4_(_A_a4),_A_a5_(_A_a5),_A_a6_(_A_a6),_A_a7_(_A_a7) {} 1485 1486 1487 /** Invokes a slot using the buffered parameter values. 1488 * @param _A_slot Some slot to invoke. 1489 * @return The slot's return value. 1490 */ 1491 T_return operator()(const slot_type& _A_slot) const 1492 { return (reinterpret_cast<typename slot_type::call_type>(_A_slot.rep_->call_))(_A_slot.rep_, _A_a1_,_A_a2_,_A_a3_,_A_a4_,_A_a5_,_A_a6_,_A_a7_); } 1493 1494 /** Executes a list of slots using an accumulator of type @e T_accumulator. 1495 * The arguments are buffered in a temporary instance of signal_emit7. 1496 1497 * @param _A_a1 Argument to be passed on to the slots. 1498 * @param _A_a2 Argument to be passed on to the slots. 1499 * @param _A_a3 Argument to be passed on to the slots. 1500 * @param _A_a4 Argument to be passed on to the slots. 1501 * @param _A_a5 Argument to be passed on to the slots. 1502 * @param _A_a6 Argument to be passed on to the slots. 1503 * @param _A_a7 Argument to be passed on to the slots. 1504 * @return The accumulated return values of the slot invocations as processed by the accumulator. 1505 */ 1506 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5,typename type_trait<T_arg6>::take _A_a6,typename type_trait<T_arg7>::take _A_a7) 1507 { 1508 T_accumulator accumulator; 1509 1510 if (!impl) 1511 return accumulator(slot_iterator_buf_type(), slot_iterator_buf_type()); 1512 1513 signal_exec exec(impl); 1514 temp_slot_list slots(impl->slots_); 1515 1516 self_type self (_A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6,_A_a7); 1517 return accumulator(slot_iterator_buf_type(slots.begin(), &self), 1518 slot_iterator_buf_type(slots.end(), &self)); 1519 } 1520 1521 typename type_trait<T_arg1>::take _A_a1_; 1522 typename type_trait<T_arg2>::take _A_a2_; 1523 typename type_trait<T_arg3>::take _A_a3_; 1524 typename type_trait<T_arg4>::take _A_a4_; 1525 typename type_trait<T_arg5>::take _A_a5_; 1526 typename type_trait<T_arg6>::take _A_a6_; 1527 typename type_trait<T_arg7>::take _A_a7_; 1528 }; 1529 1530 /** Abstracts signal emission. 1531 * This template specialization implements an optimized emit() 1532 * function for the case that no accumulator is used. 1533 */ 1534 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7> 1535 struct signal_emit7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, nil> 1536 { 1537 typedef signal_emit7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, nil > self_type; 1538 typedef T_return result_type; 1539 typedef slot<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> slot_type; 1540 typedef signal_impl::const_iterator_type iterator_type; 1541 typedef typename slot_type::call_type call_type; 1542 1543 /** Executes a list of slots using an accumulator of type @e T_accumulator. 1544 * The arguments are passed directly on to the slots. 1545 * The return value of the last slot invoked is returned. 1546 * @param first An iterator pointing to the first slot in the list. 1547 * @param last An iterator pointing to the last slot in the list. 1548 * @param _A_a1 Argument to be passed on to the slots. 1549 * @param _A_a2 Argument to be passed on to the slots. 1550 * @param _A_a3 Argument to be passed on to the slots. 1551 * @param _A_a4 Argument to be passed on to the slots. 1552 * @param _A_a5 Argument to be passed on to the slots. 1553 * @param _A_a6 Argument to be passed on to the slots. 1554 * @param _A_a7 Argument to be passed on to the slots. 1555 * @return The return value of the last slot invoked. 1556 */ 1557 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5,typename type_trait<T_arg6>::take _A_a6,typename type_trait<T_arg7>::take _A_a7) 1558 { 1559 if (!impl || impl->slots_.empty()) 1560 return T_return(); 1561 1562 signal_exec exec(impl); 1563 T_return r_ = T_return(); 1564 1565 //Use this scope to make sure that "slots" is destroyed before "exec" is destroyed. 1566 //This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249 1567 { 1568 temp_slot_list slots(impl->slots_); 1569 iterator_type it = slots.begin(); 1570 for (; it != slots.end(); ++it) 1571 if (!it->empty() && !it->blocked()) break; 1572 1573 if (it == slots.end()) 1574 return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and initialize as follows: 1575 1576 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6,_A_a7); 1577 for (++it; it != slots.end(); ++it) 1578 { 1579 if (it->empty() || it->blocked()) 1580 continue; 1581 r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6,_A_a7); 1582 } 1583 } 1584 1585 return r_; 1586 } 1587 }; 1588 1589 /** Abstracts signal emission. 1590 * This template specialization implements an optimized emit() 1591 * function for the case that no accumulator is used and the 1592 * return type is @p void. 1593 */ 1594 template <class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7> 1595 struct signal_emit7<void, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, nil> 1596 { 1597 typedef signal_emit7<void, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, nil> self_type; 1598 typedef void result_type; 1599 typedef slot<void, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> slot_type; 1600 typedef signal_impl::const_iterator_type iterator_type; 1601 typedef typename slot_type::call_type call_type; 1602 1603 /** Executes a list of slots using an accumulator of type @e T_accumulator. 1604 * The arguments are passed directly on to the slots. 1605 * @param first An iterator pointing to the first slot in the list. 1606 * @param last An iterator pointing to the last slot in the list. 1607 * @param _A_a1 Argument to be passed on to the slots. 1608 * @param _A_a2 Argument to be passed on to the slots. 1609 * @param _A_a3 Argument to be passed on to the slots. 1610 * @param _A_a4 Argument to be passed on to the slots. 1611 * @param _A_a5 Argument to be passed on to the slots. 1612 * @param _A_a6 Argument to be passed on to the slots. 1613 * @param _A_a7 Argument to be passed on to the slots. 1614 */ 1615 static result_type emit(signal_impl* impl, typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5,typename type_trait<T_arg6>::take _A_a6,typename type_trait<T_arg7>::take _A_a7) 1616 { 1617 if (!impl || impl->slots_.empty()) return; 1618 signal_exec exec(impl); 1619 temp_slot_list slots(impl->slots_); 1620 1621 for (iterator_type it = slots.begin(); it != slots.end(); ++it) 1622 { 1623 if (it->empty() || it->blocked()) 1624 continue; 1625 (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6,_A_a7); 1626 } 1627 } 1628 }; 1629 1630 1631 } /* namespace internal */ 1632 1633 /** Signal declaration. 1634 * signal0 can be used to connect() slots that are invoked 1635 * during subsequent calls to emit(). Any functor or slot 1636 * can be passed into connect(). It is converted into a slot 1637 * implicitely. 1638 * 1639 * If you want to connect one signal to another, use make_slot() 1640 * to retrieve a functor that emits the signal when invoked. 1641 * 1642 * Be careful if you directly pass one signal into the connect() 1643 * method of another: a shallow copy of the signal is made and 1644 * the signal's slots are not disconnected until both the signal 1645 * and its clone are destroyed which is probably not what you want! 1646 * 1647 * An STL-style list interface for the signal's list of slots 1648 * can be retrieved with slots(). This interface supports 1649 * iteration, insertion and removal of slots. 1650 * 1651 * The following template arguments are used: 1652 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 1653 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used, i.e. signal emission returns the return value of the last slot invoked. 1654 * 1655 * You should use the more convenient unnumbered sigc::signal template. 1656 * 1657 * @ingroup signal 1658 */ 1659 template <class T_return, class T_accumulator=nil> 1660 class signal0 1661 : public signal_base 1662 { 1663 public: 1664 typedef internal::signal_emit0<T_return, T_accumulator> emitter_type; 1665 typedef typename emitter_type::result_type result_type; 1666 typedef slot<T_return> slot_type; 1667 typedef slot_list<slot_type> slot_list_type; 1668 typedef typename slot_list_type::iterator iterator; 1669 typedef typename slot_list_type::const_iterator const_iterator; 1670 typedef typename slot_list_type::reverse_iterator reverse_iterator; 1671 typedef typename slot_list_type::const_reverse_iterator const_reverse_iterator; 1672 1673 #ifdef SIGC_TYPEDEF_REDEFINE_ALLOWED 1674 /** This typedef is only for backwards-compatibility. 1675 * It is not available when using the SUN Forte compiler. 1676 * @deprecated slot_list_type; 1677 */ 1678 typedef slot_list_type slot_list; 1679 #endif 1680 1681 /** Add a slot to the list of slots. 1682 * Any functor or slot may be passed into connect(). 1683 * It will be converted into a slot implicitely. 1684 * The returned iterator may be stored for disconnection 1685 * of the slot at some later point. It stays valid until 1686 * the slot is removed from the list of slots. The iterator 1687 * can also be implicitely converted into a sigc::connection object 1688 * that may be used safely beyond the life time of the slot. 1689 * @param slot_ The slot to add to the list of slots. 1690 * @return An iterator pointing to the new slot in the list. 1691 */ 1692 iterator connect(const slot_type& slot_) 1693 { return iterator(signal_base::connect(static_cast<const slot_base&>(slot_))); } 1694 1695 /** Triggers the emission of the signal. 1696 * During signal emission all slots that have been connected 1697 * to the signal are invoked unless they are manually set into 1698 * a blocking state. The parameters are passed on to the slots. 1699 * If @e T_accumulated is not @p nil, an accumulator of this type 1700 * is used to process the return values of the slot invocations. 1701 * Otherwise, the return value of the last slot invoked is returned. 1702 * @return The accumulated return values of the slot invocations. 1703 */ 1704 result_type emit() const 1705 { return emitter_type::emit(impl_); } 1706 1707 /** Triggers the emission of the signal (see emit()). */ 1708 result_type operator()() const 1709 { return emit(); } 1710 1711 /** Creates a functor that calls emit() on this signal. 1712 * @code 1713 * sigc::mem_fun(mysignal, &sigc::signal0::emit) 1714 * @endcode 1715 * yields the same result. 1716 * @return A functor that calls emit() on this signal. 1717 */ 1718 bound_const_mem_functor0<result_type, signal0> make_slot() const 1719 { return bound_const_mem_functor0<result_type, signal0>(this, &signal0::emit); } 1720 1721 /** Creates an STL-style interface for the signal's list of slots. 1722 * This interface supports iteration, insertion and removal of slots. 1723 * @return An STL-style interface for the signal's list of slots. 1724 */ 1725 slot_list_type slots() 1726 { return slot_list_type(impl()); } 1727 1728 /** Creates an STL-style interface for the signal's list of slots. 1729 * This interface supports iteration, insertion and removal of slots. 1730 * @return An STL-style interface for the signal's list of slots. 1731 */ 1732 const slot_list_type slots() const 1733 { return slot_list_type(const_cast<signal0*>(this)->impl()); } 1734 1735 signal0() {} 1736 1737 signal0(const signal0& src) 1738 : signal_base(src) {} 1739 }; 1740 1741 /** Signal declaration. 1742 * signal1 can be used to connect() slots that are invoked 1743 * during subsequent calls to emit(). Any functor or slot 1744 * can be passed into connect(). It is converted into a slot 1745 * implicitely. 1746 * 1747 * If you want to connect one signal to another, use make_slot() 1748 * to retrieve a functor that emits the signal when invoked. 1749 * 1750 * Be careful if you directly pass one signal into the connect() 1751 * method of another: a shallow copy of the signal is made and 1752 * the signal's slots are not disconnected until both the signal 1753 * and its clone are destroyed which is probably not what you want! 1754 * 1755 * An STL-style list interface for the signal's list of slots 1756 * can be retrieved with slots(). This interface supports 1757 * iteration, insertion and removal of slots. 1758 * 1759 * The following template arguments are used: 1760 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 1761 * - @e T_arg1 Argument type used in the definition of emit(). 1762 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used, i.e. signal emission returns the return value of the last slot invoked. 1763 * 1764 * You should use the more convenient unnumbered sigc::signal template. 1765 * 1766 * @ingroup signal 1767 */ 1768 template <class T_return, class T_arg1, class T_accumulator=nil> 1769 class signal1 1770 : public signal_base 1771 { 1772 public: 1773 typedef internal::signal_emit1<T_return, T_arg1, T_accumulator> emitter_type; 1774 typedef typename emitter_type::result_type result_type; 1775 typedef slot<T_return, T_arg1> slot_type; 1776 typedef slot_list<slot_type> slot_list_type; 1777 typedef typename slot_list_type::iterator iterator; 1778 typedef typename slot_list_type::const_iterator const_iterator; 1779 typedef typename slot_list_type::reverse_iterator reverse_iterator; 1780 typedef typename slot_list_type::const_reverse_iterator const_reverse_iterator; 1781 1782 #ifdef SIGC_TYPEDEF_REDEFINE_ALLOWED 1783 /** This typedef is only for backwards-compatibility. 1784 * It is not available when using the SUN Forte compiler. 1785 * @deprecated slot_list_type; 1786 */ 1787 typedef slot_list_type slot_list; 1788 #endif 1789 1790 /** Add a slot to the list of slots. 1791 * Any functor or slot may be passed into connect(). 1792 * It will be converted into a slot implicitely. 1793 * The returned iterator may be stored for disconnection 1794 * of the slot at some later point. It stays valid until 1795 * the slot is removed from the list of slots. The iterator 1796 * can also be implicitely converted into a sigc::connection object 1797 * that may be used safely beyond the life time of the slot. 1798 * @param slot_ The slot to add to the list of slots. 1799 * @return An iterator pointing to the new slot in the list. 1800 */ 1801 iterator connect(const slot_type& slot_) 1802 { return iterator(signal_base::connect(static_cast<const slot_base&>(slot_))); } 1803 1804 /** Triggers the emission of the signal. 1805 * During signal emission all slots that have been connected 1806 * to the signal are invoked unless they are manually set into 1807 * a blocking state. The parameters are passed on to the slots. 1808 * If @e T_accumulated is not @p nil, an accumulator of this type 1809 * is used to process the return values of the slot invocations. 1810 * Otherwise, the return value of the last slot invoked is returned. 1811 * @param _A_a1 Argument to be passed on to the slots. 1812 * @return The accumulated return values of the slot invocations. 1813 */ 1814 result_type emit(typename type_trait<T_arg1>::take _A_a1) const 1815 { return emitter_type::emit(impl_, _A_a1); } 1816 1817 /** Triggers the emission of the signal (see emit()). */ 1818 result_type operator()(typename type_trait<T_arg1>::take _A_a1) const 1819 { return emit(_A_a1); } 1820 1821 /** Creates a functor that calls emit() on this signal. 1822 * @code 1823 * sigc::mem_fun(mysignal, &sigc::signal1::emit) 1824 * @endcode 1825 * yields the same result. 1826 * @return A functor that calls emit() on this signal. 1827 */ 1828 bound_const_mem_functor1<result_type, signal1, typename type_trait<T_arg1>::take> make_slot() const 1829 { return bound_const_mem_functor1<result_type, signal1, typename type_trait<T_arg1>::take>(this, &signal1::emit); } 1830 1831 /** Creates an STL-style interface for the signal's list of slots. 1832 * This interface supports iteration, insertion and removal of slots. 1833 * @return An STL-style interface for the signal's list of slots. 1834 */ 1835 slot_list_type slots() 1836 { return slot_list_type(impl()); } 1837 1838 /** Creates an STL-style interface for the signal's list of slots. 1839 * This interface supports iteration, insertion and removal of slots. 1840 * @return An STL-style interface for the signal's list of slots. 1841 */ 1842 const slot_list_type slots() const 1843 { return slot_list_type(const_cast<signal1*>(this)->impl()); } 1844 1845 signal1() {} 1846 1847 signal1(const signal1& src) 1848 : signal_base(src) {} 1849 }; 1850 1851 /** Signal declaration. 1852 * signal2 can be used to connect() slots that are invoked 1853 * during subsequent calls to emit(). Any functor or slot 1854 * can be passed into connect(). It is converted into a slot 1855 * implicitely. 1856 * 1857 * If you want to connect one signal to another, use make_slot() 1858 * to retrieve a functor that emits the signal when invoked. 1859 * 1860 * Be careful if you directly pass one signal into the connect() 1861 * method of another: a shallow copy of the signal is made and 1862 * the signal's slots are not disconnected until both the signal 1863 * and its clone are destroyed which is probably not what you want! 1864 * 1865 * An STL-style list interface for the signal's list of slots 1866 * can be retrieved with slots(). This interface supports 1867 * iteration, insertion and removal of slots. 1868 * 1869 * The following template arguments are used: 1870 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 1871 * - @e T_arg1 Argument type used in the definition of emit(). 1872 * - @e T_arg2 Argument type used in the definition of emit(). 1873 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used, i.e. signal emission returns the return value of the last slot invoked. 1874 * 1875 * You should use the more convenient unnumbered sigc::signal template. 1876 * 1877 * @ingroup signal 1878 */ 1879 template <class T_return, class T_arg1,class T_arg2, class T_accumulator=nil> 1880 class signal2 1881 : public signal_base 1882 { 1883 public: 1884 typedef internal::signal_emit2<T_return, T_arg1,T_arg2, T_accumulator> emitter_type; 1885 typedef typename emitter_type::result_type result_type; 1886 typedef slot<T_return, T_arg1,T_arg2> slot_type; 1887 typedef slot_list<slot_type> slot_list_type; 1888 typedef typename slot_list_type::iterator iterator; 1889 typedef typename slot_list_type::const_iterator const_iterator; 1890 typedef typename slot_list_type::reverse_iterator reverse_iterator; 1891 typedef typename slot_list_type::const_reverse_iterator const_reverse_iterator; 1892 1893 #ifdef SIGC_TYPEDEF_REDEFINE_ALLOWED 1894 /** This typedef is only for backwards-compatibility. 1895 * It is not available when using the SUN Forte compiler. 1896 * @deprecated slot_list_type; 1897 */ 1898 typedef slot_list_type slot_list; 1899 #endif 1900 1901 /** Add a slot to the list of slots. 1902 * Any functor or slot may be passed into connect(). 1903 * It will be converted into a slot implicitely. 1904 * The returned iterator may be stored for disconnection 1905 * of the slot at some later point. It stays valid until 1906 * the slot is removed from the list of slots. The iterator 1907 * can also be implicitely converted into a sigc::connection object 1908 * that may be used safely beyond the life time of the slot. 1909 * @param slot_ The slot to add to the list of slots. 1910 * @return An iterator pointing to the new slot in the list. 1911 */ 1912 iterator connect(const slot_type& slot_) 1913 { return iterator(signal_base::connect(static_cast<const slot_base&>(slot_))); } 1914 1915 /** Triggers the emission of the signal. 1916 * During signal emission all slots that have been connected 1917 * to the signal are invoked unless they are manually set into 1918 * a blocking state. The parameters are passed on to the slots. 1919 * If @e T_accumulated is not @p nil, an accumulator of this type 1920 * is used to process the return values of the slot invocations. 1921 * Otherwise, the return value of the last slot invoked is returned. 1922 * @param _A_a1 Argument to be passed on to the slots. 1923 * @param _A_a2 Argument to be passed on to the slots. 1924 * @return The accumulated return values of the slot invocations. 1925 */ 1926 result_type emit(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2) const 1927 { return emitter_type::emit(impl_, _A_a1,_A_a2); } 1928 1929 /** Triggers the emission of the signal (see emit()). */ 1930 result_type operator()(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2) const 1931 { return emit(_A_a1,_A_a2); } 1932 1933 /** Creates a functor that calls emit() on this signal. 1934 * @code 1935 * sigc::mem_fun(mysignal, &sigc::signal2::emit) 1936 * @endcode 1937 * yields the same result. 1938 * @return A functor that calls emit() on this signal. 1939 */ 1940 bound_const_mem_functor2<result_type, signal2, typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take> make_slot() const 1941 { return bound_const_mem_functor2<result_type, signal2, typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take>(this, &signal2::emit); } 1942 1943 /** Creates an STL-style interface for the signal's list of slots. 1944 * This interface supports iteration, insertion and removal of slots. 1945 * @return An STL-style interface for the signal's list of slots. 1946 */ 1947 slot_list_type slots() 1948 { return slot_list_type(impl()); } 1949 1950 /** Creates an STL-style interface for the signal's list of slots. 1951 * This interface supports iteration, insertion and removal of slots. 1952 * @return An STL-style interface for the signal's list of slots. 1953 */ 1954 const slot_list_type slots() const 1955 { return slot_list_type(const_cast<signal2*>(this)->impl()); } 1956 1957 signal2() {} 1958 1959 signal2(const signal2& src) 1960 : signal_base(src) {} 1961 }; 1962 1963 /** Signal declaration. 1964 * signal3 can be used to connect() slots that are invoked 1965 * during subsequent calls to emit(). Any functor or slot 1966 * can be passed into connect(). It is converted into a slot 1967 * implicitely. 1968 * 1969 * If you want to connect one signal to another, use make_slot() 1970 * to retrieve a functor that emits the signal when invoked. 1971 * 1972 * Be careful if you directly pass one signal into the connect() 1973 * method of another: a shallow copy of the signal is made and 1974 * the signal's slots are not disconnected until both the signal 1975 * and its clone are destroyed which is probably not what you want! 1976 * 1977 * An STL-style list interface for the signal's list of slots 1978 * can be retrieved with slots(). This interface supports 1979 * iteration, insertion and removal of slots. 1980 * 1981 * The following template arguments are used: 1982 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 1983 * - @e T_arg1 Argument type used in the definition of emit(). 1984 * - @e T_arg2 Argument type used in the definition of emit(). 1985 * - @e T_arg3 Argument type used in the definition of emit(). 1986 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used, i.e. signal emission returns the return value of the last slot invoked. 1987 * 1988 * You should use the more convenient unnumbered sigc::signal template. 1989 * 1990 * @ingroup signal 1991 */ 1992 template <class T_return, class T_arg1,class T_arg2,class T_arg3, class T_accumulator=nil> 1993 class signal3 1994 : public signal_base 1995 { 1996 public: 1997 typedef internal::signal_emit3<T_return, T_arg1,T_arg2,T_arg3, T_accumulator> emitter_type; 1998 typedef typename emitter_type::result_type result_type; 1999 typedef slot<T_return, T_arg1,T_arg2,T_arg3> slot_type; 2000 typedef slot_list<slot_type> slot_list_type; 2001 typedef typename slot_list_type::iterator iterator; 2002 typedef typename slot_list_type::const_iterator const_iterator; 2003 typedef typename slot_list_type::reverse_iterator reverse_iterator; 2004 typedef typename slot_list_type::const_reverse_iterator const_reverse_iterator; 2005 2006 #ifdef SIGC_TYPEDEF_REDEFINE_ALLOWED 2007 /** This typedef is only for backwards-compatibility. 2008 * It is not available when using the SUN Forte compiler. 2009 * @deprecated slot_list_type; 2010 */ 2011 typedef slot_list_type slot_list; 2012 #endif 2013 2014 /** Add a slot to the list of slots. 2015 * Any functor or slot may be passed into connect(). 2016 * It will be converted into a slot implicitely. 2017 * The returned iterator may be stored for disconnection 2018 * of the slot at some later point. It stays valid until 2019 * the slot is removed from the list of slots. The iterator 2020 * can also be implicitely converted into a sigc::connection object 2021 * that may be used safely beyond the life time of the slot. 2022 * @param slot_ The slot to add to the list of slots. 2023 * @return An iterator pointing to the new slot in the list. 2024 */ 2025 iterator connect(const slot_type& slot_) 2026 { return iterator(signal_base::connect(static_cast<const slot_base&>(slot_))); } 2027 2028 /** Triggers the emission of the signal. 2029 * During signal emission all slots that have been connected 2030 * to the signal are invoked unless they are manually set into 2031 * a blocking state. The parameters are passed on to the slots. 2032 * If @e T_accumulated is not @p nil, an accumulator of this type 2033 * is used to process the return values of the slot invocations. 2034 * Otherwise, the return value of the last slot invoked is returned. 2035 * @param _A_a1 Argument to be passed on to the slots. 2036 * @param _A_a2 Argument to be passed on to the slots. 2037 * @param _A_a3 Argument to be passed on to the slots. 2038 * @return The accumulated return values of the slot invocations. 2039 */ 2040 result_type emit(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3) const 2041 { return emitter_type::emit(impl_, _A_a1,_A_a2,_A_a3); } 2042 2043 /** Triggers the emission of the signal (see emit()). */ 2044 result_type operator()(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3) const 2045 { return emit(_A_a1,_A_a2,_A_a3); } 2046 2047 /** Creates a functor that calls emit() on this signal. 2048 * @code 2049 * sigc::mem_fun(mysignal, &sigc::signal3::emit) 2050 * @endcode 2051 * yields the same result. 2052 * @return A functor that calls emit() on this signal. 2053 */ 2054 bound_const_mem_functor3<result_type, signal3, typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take> make_slot() const 2055 { return bound_const_mem_functor3<result_type, signal3, typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take>(this, &signal3::emit); } 2056 2057 /** Creates an STL-style interface for the signal's list of slots. 2058 * This interface supports iteration, insertion and removal of slots. 2059 * @return An STL-style interface for the signal's list of slots. 2060 */ 2061 slot_list_type slots() 2062 { return slot_list_type(impl()); } 2063 2064 /** Creates an STL-style interface for the signal's list of slots. 2065 * This interface supports iteration, insertion and removal of slots. 2066 * @return An STL-style interface for the signal's list of slots. 2067 */ 2068 const slot_list_type slots() const 2069 { return slot_list_type(const_cast<signal3*>(this)->impl()); } 2070 2071 signal3() {} 2072 2073 signal3(const signal3& src) 2074 : signal_base(src) {} 2075 }; 2076 2077 /** Signal declaration. 2078 * signal4 can be used to connect() slots that are invoked 2079 * during subsequent calls to emit(). Any functor or slot 2080 * can be passed into connect(). It is converted into a slot 2081 * implicitely. 2082 * 2083 * If you want to connect one signal to another, use make_slot() 2084 * to retrieve a functor that emits the signal when invoked. 2085 * 2086 * Be careful if you directly pass one signal into the connect() 2087 * method of another: a shallow copy of the signal is made and 2088 * the signal's slots are not disconnected until both the signal 2089 * and its clone are destroyed which is probably not what you want! 2090 * 2091 * An STL-style list interface for the signal's list of slots 2092 * can be retrieved with slots(). This interface supports 2093 * iteration, insertion and removal of slots. 2094 * 2095 * The following template arguments are used: 2096 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 2097 * - @e T_arg1 Argument type used in the definition of emit(). 2098 * - @e T_arg2 Argument type used in the definition of emit(). 2099 * - @e T_arg3 Argument type used in the definition of emit(). 2100 * - @e T_arg4 Argument type used in the definition of emit(). 2101 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used, i.e. signal emission returns the return value of the last slot invoked. 2102 * 2103 * You should use the more convenient unnumbered sigc::signal template. 2104 * 2105 * @ingroup signal 2106 */ 2107 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4, class T_accumulator=nil> 2108 class signal4 2109 : public signal_base 2110 { 2111 public: 2112 typedef internal::signal_emit4<T_return, T_arg1,T_arg2,T_arg3,T_arg4, T_accumulator> emitter_type; 2113 typedef typename emitter_type::result_type result_type; 2114 typedef slot<T_return, T_arg1,T_arg2,T_arg3,T_arg4> slot_type; 2115 typedef slot_list<slot_type> slot_list_type; 2116 typedef typename slot_list_type::iterator iterator; 2117 typedef typename slot_list_type::const_iterator const_iterator; 2118 typedef typename slot_list_type::reverse_iterator reverse_iterator; 2119 typedef typename slot_list_type::const_reverse_iterator const_reverse_iterator; 2120 2121 #ifdef SIGC_TYPEDEF_REDEFINE_ALLOWED 2122 /** This typedef is only for backwards-compatibility. 2123 * It is not available when using the SUN Forte compiler. 2124 * @deprecated slot_list_type; 2125 */ 2126 typedef slot_list_type slot_list; 2127 #endif 2128 2129 /** Add a slot to the list of slots. 2130 * Any functor or slot may be passed into connect(). 2131 * It will be converted into a slot implicitely. 2132 * The returned iterator may be stored for disconnection 2133 * of the slot at some later point. It stays valid until 2134 * the slot is removed from the list of slots. The iterator 2135 * can also be implicitely converted into a sigc::connection object 2136 * that may be used safely beyond the life time of the slot. 2137 * @param slot_ The slot to add to the list of slots. 2138 * @return An iterator pointing to the new slot in the list. 2139 */ 2140 iterator connect(const slot_type& slot_) 2141 { return iterator(signal_base::connect(static_cast<const slot_base&>(slot_))); } 2142 2143 /** Triggers the emission of the signal. 2144 * During signal emission all slots that have been connected 2145 * to the signal are invoked unless they are manually set into 2146 * a blocking state. The parameters are passed on to the slots. 2147 * If @e T_accumulated is not @p nil, an accumulator of this type 2148 * is used to process the return values of the slot invocations. 2149 * Otherwise, the return value of the last slot invoked is returned. 2150 * @param _A_a1 Argument to be passed on to the slots. 2151 * @param _A_a2 Argument to be passed on to the slots. 2152 * @param _A_a3 Argument to be passed on to the slots. 2153 * @param _A_a4 Argument to be passed on to the slots. 2154 * @return The accumulated return values of the slot invocations. 2155 */ 2156 result_type emit(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4) const 2157 { return emitter_type::emit(impl_, _A_a1,_A_a2,_A_a3,_A_a4); } 2158 2159 /** Triggers the emission of the signal (see emit()). */ 2160 result_type operator()(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4) const 2161 { return emit(_A_a1,_A_a2,_A_a3,_A_a4); } 2162 2163 /** Creates a functor that calls emit() on this signal. 2164 * @code 2165 * sigc::mem_fun(mysignal, &sigc::signal4::emit) 2166 * @endcode 2167 * yields the same result. 2168 * @return A functor that calls emit() on this signal. 2169 */ 2170 bound_const_mem_functor4<result_type, signal4, typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take,typename type_trait<T_arg4>::take> make_slot() const 2171 { return bound_const_mem_functor4<result_type, signal4, typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take,typename type_trait<T_arg4>::take>(this, &signal4::emit); } 2172 2173 /** Creates an STL-style interface for the signal's list of slots. 2174 * This interface supports iteration, insertion and removal of slots. 2175 * @return An STL-style interface for the signal's list of slots. 2176 */ 2177 slot_list_type slots() 2178 { return slot_list_type(impl()); } 2179 2180 /** Creates an STL-style interface for the signal's list of slots. 2181 * This interface supports iteration, insertion and removal of slots. 2182 * @return An STL-style interface for the signal's list of slots. 2183 */ 2184 const slot_list_type slots() const 2185 { return slot_list_type(const_cast<signal4*>(this)->impl()); } 2186 2187 signal4() {} 2188 2189 signal4(const signal4& src) 2190 : signal_base(src) {} 2191 }; 2192 2193 /** Signal declaration. 2194 * signal5 can be used to connect() slots that are invoked 2195 * during subsequent calls to emit(). Any functor or slot 2196 * can be passed into connect(). It is converted into a slot 2197 * implicitely. 2198 * 2199 * If you want to connect one signal to another, use make_slot() 2200 * to retrieve a functor that emits the signal when invoked. 2201 * 2202 * Be careful if you directly pass one signal into the connect() 2203 * method of another: a shallow copy of the signal is made and 2204 * the signal's slots are not disconnected until both the signal 2205 * and its clone are destroyed which is probably not what you want! 2206 * 2207 * An STL-style list interface for the signal's list of slots 2208 * can be retrieved with slots(). This interface supports 2209 * iteration, insertion and removal of slots. 2210 * 2211 * The following template arguments are used: 2212 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 2213 * - @e T_arg1 Argument type used in the definition of emit(). 2214 * - @e T_arg2 Argument type used in the definition of emit(). 2215 * - @e T_arg3 Argument type used in the definition of emit(). 2216 * - @e T_arg4 Argument type used in the definition of emit(). 2217 * - @e T_arg5 Argument type used in the definition of emit(). 2218 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used, i.e. signal emission returns the return value of the last slot invoked. 2219 * 2220 * You should use the more convenient unnumbered sigc::signal template. 2221 * 2222 * @ingroup signal 2223 */ 2224 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5, class T_accumulator=nil> 2225 class signal5 2226 : public signal_base 2227 { 2228 public: 2229 typedef internal::signal_emit5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, T_accumulator> emitter_type; 2230 typedef typename emitter_type::result_type result_type; 2231 typedef slot<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5> slot_type; 2232 typedef slot_list<slot_type> slot_list_type; 2233 typedef typename slot_list_type::iterator iterator; 2234 typedef typename slot_list_type::const_iterator const_iterator; 2235 typedef typename slot_list_type::reverse_iterator reverse_iterator; 2236 typedef typename slot_list_type::const_reverse_iterator const_reverse_iterator; 2237 2238 #ifdef SIGC_TYPEDEF_REDEFINE_ALLOWED 2239 /** This typedef is only for backwards-compatibility. 2240 * It is not available when using the SUN Forte compiler. 2241 * @deprecated slot_list_type; 2242 */ 2243 typedef slot_list_type slot_list; 2244 #endif 2245 2246 /** Add a slot to the list of slots. 2247 * Any functor or slot may be passed into connect(). 2248 * It will be converted into a slot implicitely. 2249 * The returned iterator may be stored for disconnection 2250 * of the slot at some later point. It stays valid until 2251 * the slot is removed from the list of slots. The iterator 2252 * can also be implicitely converted into a sigc::connection object 2253 * that may be used safely beyond the life time of the slot. 2254 * @param slot_ The slot to add to the list of slots. 2255 * @return An iterator pointing to the new slot in the list. 2256 */ 2257 iterator connect(const slot_type& slot_) 2258 { return iterator(signal_base::connect(static_cast<const slot_base&>(slot_))); } 2259 2260 /** Triggers the emission of the signal. 2261 * During signal emission all slots that have been connected 2262 * to the signal are invoked unless they are manually set into 2263 * a blocking state. The parameters are passed on to the slots. 2264 * If @e T_accumulated is not @p nil, an accumulator of this type 2265 * is used to process the return values of the slot invocations. 2266 * Otherwise, the return value of the last slot invoked is returned. 2267 * @param _A_a1 Argument to be passed on to the slots. 2268 * @param _A_a2 Argument to be passed on to the slots. 2269 * @param _A_a3 Argument to be passed on to the slots. 2270 * @param _A_a4 Argument to be passed on to the slots. 2271 * @param _A_a5 Argument to be passed on to the slots. 2272 * @return The accumulated return values of the slot invocations. 2273 */ 2274 result_type emit(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5) const 2275 { return emitter_type::emit(impl_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5); } 2276 2277 /** Triggers the emission of the signal (see emit()). */ 2278 result_type operator()(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5) const 2279 { return emit(_A_a1,_A_a2,_A_a3,_A_a4,_A_a5); } 2280 2281 /** Creates a functor that calls emit() on this signal. 2282 * @code 2283 * sigc::mem_fun(mysignal, &sigc::signal5::emit) 2284 * @endcode 2285 * yields the same result. 2286 * @return A functor that calls emit() on this signal. 2287 */ 2288 bound_const_mem_functor5<result_type, signal5, typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take,typename type_trait<T_arg4>::take,typename type_trait<T_arg5>::take> make_slot() const 2289 { return bound_const_mem_functor5<result_type, signal5, typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take,typename type_trait<T_arg4>::take,typename type_trait<T_arg5>::take>(this, &signal5::emit); } 2290 2291 /** Creates an STL-style interface for the signal's list of slots. 2292 * This interface supports iteration, insertion and removal of slots. 2293 * @return An STL-style interface for the signal's list of slots. 2294 */ 2295 slot_list_type slots() 2296 { return slot_list_type(impl()); } 2297 2298 /** Creates an STL-style interface for the signal's list of slots. 2299 * This interface supports iteration, insertion and removal of slots. 2300 * @return An STL-style interface for the signal's list of slots. 2301 */ 2302 const slot_list_type slots() const 2303 { return slot_list_type(const_cast<signal5*>(this)->impl()); } 2304 2305 signal5() {} 2306 2307 signal5(const signal5& src) 2308 : signal_base(src) {} 2309 }; 2310 2311 /** Signal declaration. 2312 * signal6 can be used to connect() slots that are invoked 2313 * during subsequent calls to emit(). Any functor or slot 2314 * can be passed into connect(). It is converted into a slot 2315 * implicitely. 2316 * 2317 * If you want to connect one signal to another, use make_slot() 2318 * to retrieve a functor that emits the signal when invoked. 2319 * 2320 * Be careful if you directly pass one signal into the connect() 2321 * method of another: a shallow copy of the signal is made and 2322 * the signal's slots are not disconnected until both the signal 2323 * and its clone are destroyed which is probably not what you want! 2324 * 2325 * An STL-style list interface for the signal's list of slots 2326 * can be retrieved with slots(). This interface supports 2327 * iteration, insertion and removal of slots. 2328 * 2329 * The following template arguments are used: 2330 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 2331 * - @e T_arg1 Argument type used in the definition of emit(). 2332 * - @e T_arg2 Argument type used in the definition of emit(). 2333 * - @e T_arg3 Argument type used in the definition of emit(). 2334 * - @e T_arg4 Argument type used in the definition of emit(). 2335 * - @e T_arg5 Argument type used in the definition of emit(). 2336 * - @e T_arg6 Argument type used in the definition of emit(). 2337 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used, i.e. signal emission returns the return value of the last slot invoked. 2338 * 2339 * You should use the more convenient unnumbered sigc::signal template. 2340 * 2341 * @ingroup signal 2342 */ 2343 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6, class T_accumulator=nil> 2344 class signal6 2345 : public signal_base 2346 { 2347 public: 2348 typedef internal::signal_emit6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, T_accumulator> emitter_type; 2349 typedef typename emitter_type::result_type result_type; 2350 typedef slot<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6> slot_type; 2351 typedef slot_list<slot_type> slot_list_type; 2352 typedef typename slot_list_type::iterator iterator; 2353 typedef typename slot_list_type::const_iterator const_iterator; 2354 typedef typename slot_list_type::reverse_iterator reverse_iterator; 2355 typedef typename slot_list_type::const_reverse_iterator const_reverse_iterator; 2356 2357 #ifdef SIGC_TYPEDEF_REDEFINE_ALLOWED 2358 /** This typedef is only for backwards-compatibility. 2359 * It is not available when using the SUN Forte compiler. 2360 * @deprecated slot_list_type; 2361 */ 2362 typedef slot_list_type slot_list; 2363 #endif 2364 2365 /** Add a slot to the list of slots. 2366 * Any functor or slot may be passed into connect(). 2367 * It will be converted into a slot implicitely. 2368 * The returned iterator may be stored for disconnection 2369 * of the slot at some later point. It stays valid until 2370 * the slot is removed from the list of slots. The iterator 2371 * can also be implicitely converted into a sigc::connection object 2372 * that may be used safely beyond the life time of the slot. 2373 * @param slot_ The slot to add to the list of slots. 2374 * @return An iterator pointing to the new slot in the list. 2375 */ 2376 iterator connect(const slot_type& slot_) 2377 { return iterator(signal_base::connect(static_cast<const slot_base&>(slot_))); } 2378 2379 /** Triggers the emission of the signal. 2380 * During signal emission all slots that have been connected 2381 * to the signal are invoked unless they are manually set into 2382 * a blocking state. The parameters are passed on to the slots. 2383 * If @e T_accumulated is not @p nil, an accumulator of this type 2384 * is used to process the return values of the slot invocations. 2385 * Otherwise, the return value of the last slot invoked is returned. 2386 * @param _A_a1 Argument to be passed on to the slots. 2387 * @param _A_a2 Argument to be passed on to the slots. 2388 * @param _A_a3 Argument to be passed on to the slots. 2389 * @param _A_a4 Argument to be passed on to the slots. 2390 * @param _A_a5 Argument to be passed on to the slots. 2391 * @param _A_a6 Argument to be passed on to the slots. 2392 * @return The accumulated return values of the slot invocations. 2393 */ 2394 result_type emit(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5,typename type_trait<T_arg6>::take _A_a6) const 2395 { return emitter_type::emit(impl_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6); } 2396 2397 /** Triggers the emission of the signal (see emit()). */ 2398 result_type operator()(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5,typename type_trait<T_arg6>::take _A_a6) const 2399 { return emit(_A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6); } 2400 2401 /** Creates a functor that calls emit() on this signal. 2402 * @code 2403 * sigc::mem_fun(mysignal, &sigc::signal6::emit) 2404 * @endcode 2405 * yields the same result. 2406 * @return A functor that calls emit() on this signal. 2407 */ 2408 bound_const_mem_functor6<result_type, signal6, typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take,typename type_trait<T_arg4>::take,typename type_trait<T_arg5>::take,typename type_trait<T_arg6>::take> make_slot() const 2409 { return bound_const_mem_functor6<result_type, signal6, typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take,typename type_trait<T_arg4>::take,typename type_trait<T_arg5>::take,typename type_trait<T_arg6>::take>(this, &signal6::emit); } 2410 2411 /** Creates an STL-style interface for the signal's list of slots. 2412 * This interface supports iteration, insertion and removal of slots. 2413 * @return An STL-style interface for the signal's list of slots. 2414 */ 2415 slot_list_type slots() 2416 { return slot_list_type(impl()); } 2417 2418 /** Creates an STL-style interface for the signal's list of slots. 2419 * This interface supports iteration, insertion and removal of slots. 2420 * @return An STL-style interface for the signal's list of slots. 2421 */ 2422 const slot_list_type slots() const 2423 { return slot_list_type(const_cast<signal6*>(this)->impl()); } 2424 2425 signal6() {} 2426 2427 signal6(const signal6& src) 2428 : signal_base(src) {} 2429 }; 2430 2431 /** Signal declaration. 2432 * signal7 can be used to connect() slots that are invoked 2433 * during subsequent calls to emit(). Any functor or slot 2434 * can be passed into connect(). It is converted into a slot 2435 * implicitely. 2436 * 2437 * If you want to connect one signal to another, use make_slot() 2438 * to retrieve a functor that emits the signal when invoked. 2439 * 2440 * Be careful if you directly pass one signal into the connect() 2441 * method of another: a shallow copy of the signal is made and 2442 * the signal's slots are not disconnected until both the signal 2443 * and its clone are destroyed which is probably not what you want! 2444 * 2445 * An STL-style list interface for the signal's list of slots 2446 * can be retrieved with slots(). This interface supports 2447 * iteration, insertion and removal of slots. 2448 * 2449 * The following template arguments are used: 2450 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 2451 * - @e T_arg1 Argument type used in the definition of emit(). 2452 * - @e T_arg2 Argument type used in the definition of emit(). 2453 * - @e T_arg3 Argument type used in the definition of emit(). 2454 * - @e T_arg4 Argument type used in the definition of emit(). 2455 * - @e T_arg5 Argument type used in the definition of emit(). 2456 * - @e T_arg6 Argument type used in the definition of emit(). 2457 * - @e T_arg7 Argument type used in the definition of emit(). 2458 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used, i.e. signal emission returns the return value of the last slot invoked. 2459 * 2460 * You should use the more convenient unnumbered sigc::signal template. 2461 * 2462 * @ingroup signal 2463 */ 2464 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7, class T_accumulator=nil> 2465 class signal7 2466 : public signal_base 2467 { 2468 public: 2469 typedef internal::signal_emit7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, T_accumulator> emitter_type; 2470 typedef typename emitter_type::result_type result_type; 2471 typedef slot<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7> slot_type; 2472 typedef slot_list<slot_type> slot_list_type; 2473 typedef typename slot_list_type::iterator iterator; 2474 typedef typename slot_list_type::const_iterator const_iterator; 2475 typedef typename slot_list_type::reverse_iterator reverse_iterator; 2476 typedef typename slot_list_type::const_reverse_iterator const_reverse_iterator; 2477 2478 #ifdef SIGC_TYPEDEF_REDEFINE_ALLOWED 2479 /** This typedef is only for backwards-compatibility. 2480 * It is not available when using the SUN Forte compiler. 2481 * @deprecated slot_list_type; 2482 */ 2483 typedef slot_list_type slot_list; 2484 #endif 2485 2486 /** Add a slot to the list of slots. 2487 * Any functor or slot may be passed into connect(). 2488 * It will be converted into a slot implicitely. 2489 * The returned iterator may be stored for disconnection 2490 * of the slot at some later point. It stays valid until 2491 * the slot is removed from the list of slots. The iterator 2492 * can also be implicitely converted into a sigc::connection object 2493 * that may be used safely beyond the life time of the slot. 2494 * @param slot_ The slot to add to the list of slots. 2495 * @return An iterator pointing to the new slot in the list. 2496 */ 2497 iterator connect(const slot_type& slot_) 2498 { return iterator(signal_base::connect(static_cast<const slot_base&>(slot_))); } 2499 2500 /** Triggers the emission of the signal. 2501 * During signal emission all slots that have been connected 2502 * to the signal are invoked unless they are manually set into 2503 * a blocking state. The parameters are passed on to the slots. 2504 * If @e T_accumulated is not @p nil, an accumulator of this type 2505 * is used to process the return values of the slot invocations. 2506 * Otherwise, the return value of the last slot invoked is returned. 2507 * @param _A_a1 Argument to be passed on to the slots. 2508 * @param _A_a2 Argument to be passed on to the slots. 2509 * @param _A_a3 Argument to be passed on to the slots. 2510 * @param _A_a4 Argument to be passed on to the slots. 2511 * @param _A_a5 Argument to be passed on to the slots. 2512 * @param _A_a6 Argument to be passed on to the slots. 2513 * @param _A_a7 Argument to be passed on to the slots. 2514 * @return The accumulated return values of the slot invocations. 2515 */ 2516 result_type emit(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5,typename type_trait<T_arg6>::take _A_a6,typename type_trait<T_arg7>::take _A_a7) const 2517 { return emitter_type::emit(impl_, _A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6,_A_a7); } 2518 2519 /** Triggers the emission of the signal (see emit()). */ 2520 result_type operator()(typename type_trait<T_arg1>::take _A_a1,typename type_trait<T_arg2>::take _A_a2,typename type_trait<T_arg3>::take _A_a3,typename type_trait<T_arg4>::take _A_a4,typename type_trait<T_arg5>::take _A_a5,typename type_trait<T_arg6>::take _A_a6,typename type_trait<T_arg7>::take _A_a7) const 2521 { return emit(_A_a1,_A_a2,_A_a3,_A_a4,_A_a5,_A_a6,_A_a7); } 2522 2523 /** Creates a functor that calls emit() on this signal. 2524 * @code 2525 * sigc::mem_fun(mysignal, &sigc::signal7::emit) 2526 * @endcode 2527 * yields the same result. 2528 * @return A functor that calls emit() on this signal. 2529 */ 2530 bound_const_mem_functor7<result_type, signal7, typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take,typename type_trait<T_arg4>::take,typename type_trait<T_arg5>::take,typename type_trait<T_arg6>::take,typename type_trait<T_arg7>::take> make_slot() const 2531 { return bound_const_mem_functor7<result_type, signal7, typename type_trait<T_arg1>::take,typename type_trait<T_arg2>::take,typename type_trait<T_arg3>::take,typename type_trait<T_arg4>::take,typename type_trait<T_arg5>::take,typename type_trait<T_arg6>::take,typename type_trait<T_arg7>::take>(this, &signal7::emit); } 2532 2533 /** Creates an STL-style interface for the signal's list of slots. 2534 * This interface supports iteration, insertion and removal of slots. 2535 * @return An STL-style interface for the signal's list of slots. 2536 */ 2537 slot_list_type slots() 2538 { return slot_list_type(impl()); } 2539 2540 /** Creates an STL-style interface for the signal's list of slots. 2541 * This interface supports iteration, insertion and removal of slots. 2542 * @return An STL-style interface for the signal's list of slots. 2543 */ 2544 const slot_list_type slots() const 2545 { return slot_list_type(const_cast<signal7*>(this)->impl()); } 2546 2547 signal7() {} 2548 2549 signal7(const signal7& src) 2550 : signal_base(src) {} 2551 }; 2552 2553 2554 2555 /** Convenience wrapper for the numbered sigc::signal# templates. 2556 * signal can be used to connect() slots that are invoked 2557 * during subsequent calls to emit(). Any functor or slot 2558 * can be passed into connect(). It is converted into a slot 2559 * implicitly. 2560 * 2561 * If you want to connect one signal to another, use make_slot() 2562 * to retrieve a functor that emits the signal when invoked. 2563 * 2564 * Be careful if you directly pass one signal into the connect() 2565 * method of another: a shallow copy of the signal is made and 2566 * the signal's slots are not disconnected until both the signal 2567 * and its clone are destroyed which is probably not what you want! 2568 * 2569 * An STL-style list interface for the signal's list of slots 2570 * can be retrieved with slots(). This interface supports 2571 * iteration, insertion and removal of slots. 2572 * 2573 * The template arguments determine the function signature of 2574 * the emit() function: 2575 * - @e T_return The desired return type of the emit() function. 2576 * - @e T_arg1 Argument type used in the definition of emit(). The default @p nil means no argument. 2577 * - @e T_arg2 Argument type used in the definition of emit(). The default @p nil means no argument. 2578 * - @e T_arg3 Argument type used in the definition of emit(). The default @p nil means no argument. 2579 * - @e T_arg4 Argument type used in the definition of emit(). The default @p nil means no argument. 2580 * - @e T_arg5 Argument type used in the definition of emit(). The default @p nil means no argument. 2581 * - @e T_arg6 Argument type used in the definition of emit(). The default @p nil means no argument. 2582 * - @e T_arg7 Argument type used in the definition of emit(). The default @p nil means no argument. 2583 * 2584 * To specify an accumulator type the nested class signal::accumulated can be used. 2585 * 2586 * @par Example: 2587 * @code 2588 * void foo(int) {} 2589 * sigc::signal<void, long> sig; 2590 * sig.connect(sigc::ptr_fun(&foo)); 2591 * sig.emit(19); 2592 * @endcode 2593 * 2594 * @ingroup signal 2595 */ 2596 template <class T_return, class T_arg1 = nil,class T_arg2 = nil,class T_arg3 = nil,class T_arg4 = nil,class T_arg5 = nil,class T_arg6 = nil,class T_arg7 = nil> 2597 class signal 2598 : public signal7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, nil> 2599 { 2600 public: 2601 /** Convenience wrapper for the numbered sigc::signal# templates. 2602 * Like sigc::signal but the additional template parameter @e T_accumulator 2603 * defines the accumulator type that should be used. 2604 * 2605 * An accumulator is a functor that uses a pair of special iterators 2606 * to step through a list of slots and calculate a return value 2607 * from the results of the slot invokations. The iterators' operator*() 2608 * executes the slot. The return value is buffered, so that in an expression 2609 * like @code a = (*i) * (*i); @endcode the slot is executed only once. 2610 * The accumulator must define its return value as @p result_type. 2611 * 2612 * @par Example 1: 2613 * This accumulator calculates the arithmetic mean value: 2614 * @code 2615 * struct arithmetic_mean_accumulator 2616 * { 2617 * typedef double result_type; 2618 * template<typename T_iterator> 2619 * result_type operator()(T_iterator first, T_iterator last) const 2620 * { 2621 * result_type value_ = 0; 2622 * int n_ = 0; 2623 * for (; first != last; ++first, ++n_) 2624 * value_ += *first; 2625 * return value_ / n_; 2626 * } 2627 * }; 2628 * @endcode 2629 * 2630 * @par Example 2: 2631 * This accumulator stops signal emission when a slot returns zero: 2632 * @code 2633 * struct interruptable_accumulator 2634 * { 2635 * typedef bool result_type; 2636 * template<typename T_iterator> 2637 * result_type operator()(T_iterator first, T_iterator last) const 2638 * { 2639 * for (; first != last; ++first, ++n_) 2640 * if (!*first) return false; 2641 * return true; 2642 * } 2643 * }; 2644 * @endcode 2645 * 2646 * @ingroup signal 2647 */ 2648 template <class T_accumulator> 2649 class accumulated 2650 : public signal7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, T_accumulator> 2651 { 2652 public: 2653 accumulated() {} 2654 accumulated(const accumulated& src) 2655 : signal7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, T_accumulator>(src) {} 2656 }; 2657 2658 signal() {} 2659 signal(const signal& src) 2660 : signal7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, nil>(src) {} 2661 }; 2662 2663 2664 2665 /** Convenience wrapper for the numbered sigc::signal0 template. 2666 * See the base class for useful methods. 2667 * This is the template specialization of the unnumbered sigc::signal 2668 * template for 0 argument(s). 2669 */ 2670 template <class T_return> 2671 class signal <T_return, nil,nil,nil,nil,nil,nil,nil> 2672 : public signal0<T_return, nil> 2673 { 2674 public: 2675 2676 /** Convenience wrapper for the numbered sigc::signal0 template. 2677 * Like sigc::signal but the additional template parameter @e T_accumulator 2678 * defines the accumulator type that should be used. 2679 */ 2680 template <class T_accumulator> 2681 class accumulated 2682 : public signal0<T_return, T_accumulator> 2683 { 2684 public: 2685 accumulated() {} 2686 accumulated(const accumulated& src) 2687 : signal0<T_return, T_accumulator>(src) {} 2688 }; 2689 2690 signal() {} 2691 signal(const signal& src) 2692 : signal0<T_return, nil>(src) {} 2693 }; 2694 2695 2696 /** Convenience wrapper for the numbered sigc::signal1 template. 2697 * See the base class for useful methods. 2698 * This is the template specialization of the unnumbered sigc::signal 2699 * template for 1 argument(s). 2700 */ 2701 template <class T_return, class T_arg1> 2702 class signal <T_return, T_arg1, nil,nil,nil,nil,nil,nil> 2703 : public signal1<T_return, T_arg1, nil> 2704 { 2705 public: 2706 2707 /** Convenience wrapper for the numbered sigc::signal1 template. 2708 * Like sigc::signal but the additional template parameter @e T_accumulator 2709 * defines the accumulator type that should be used. 2710 */ 2711 template <class T_accumulator> 2712 class accumulated 2713 : public signal1<T_return, T_arg1, T_accumulator> 2714 { 2715 public: 2716 accumulated() {} 2717 accumulated(const accumulated& src) 2718 : signal1<T_return, T_arg1, T_accumulator>(src) {} 2719 }; 2720 2721 signal() {} 2722 signal(const signal& src) 2723 : signal1<T_return, T_arg1, nil>(src) {} 2724 }; 2725 2726 2727 /** Convenience wrapper for the numbered sigc::signal2 template. 2728 * See the base class for useful methods. 2729 * This is the template specialization of the unnumbered sigc::signal 2730 * template for 2 argument(s). 2731 */ 2732 template <class T_return, class T_arg1,class T_arg2> 2733 class signal <T_return, T_arg1,T_arg2, nil,nil,nil,nil,nil> 2734 : public signal2<T_return, T_arg1,T_arg2, nil> 2735 { 2736 public: 2737 2738 /** Convenience wrapper for the numbered sigc::signal2 template. 2739 * Like sigc::signal but the additional template parameter @e T_accumulator 2740 * defines the accumulator type that should be used. 2741 */ 2742 template <class T_accumulator> 2743 class accumulated 2744 : public signal2<T_return, T_arg1,T_arg2, T_accumulator> 2745 { 2746 public: 2747 accumulated() {} 2748 accumulated(const accumulated& src) 2749 : signal2<T_return, T_arg1,T_arg2, T_accumulator>(src) {} 2750 }; 2751 2752 signal() {} 2753 signal(const signal& src) 2754 : signal2<T_return, T_arg1,T_arg2, nil>(src) {} 2755 }; 2756 2757 2758 /** Convenience wrapper for the numbered sigc::signal3 template. 2759 * See the base class for useful methods. 2760 * This is the template specialization of the unnumbered sigc::signal 2761 * template for 3 argument(s). 2762 */ 2763 template <class T_return, class T_arg1,class T_arg2,class T_arg3> 2764 class signal <T_return, T_arg1,T_arg2,T_arg3, nil,nil,nil,nil> 2765 : public signal3<T_return, T_arg1,T_arg2,T_arg3, nil> 2766 { 2767 public: 2768 2769 /** Convenience wrapper for the numbered sigc::signal3 template. 2770 * Like sigc::signal but the additional template parameter @e T_accumulator 2771 * defines the accumulator type that should be used. 2772 */ 2773 template <class T_accumulator> 2774 class accumulated 2775 : public signal3<T_return, T_arg1,T_arg2,T_arg3, T_accumulator> 2776 { 2777 public: 2778 accumulated() {} 2779 accumulated(const accumulated& src) 2780 : signal3<T_return, T_arg1,T_arg2,T_arg3, T_accumulator>(src) {} 2781 }; 2782 2783 signal() {} 2784 signal(const signal& src) 2785 : signal3<T_return, T_arg1,T_arg2,T_arg3, nil>(src) {} 2786 }; 2787 2788 2789 /** Convenience wrapper for the numbered sigc::signal4 template. 2790 * See the base class for useful methods. 2791 * This is the template specialization of the unnumbered sigc::signal 2792 * template for 4 argument(s). 2793 */ 2794 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4> 2795 class signal <T_return, T_arg1,T_arg2,T_arg3,T_arg4, nil,nil,nil> 2796 : public signal4<T_return, T_arg1,T_arg2,T_arg3,T_arg4, nil> 2797 { 2798 public: 2799 2800 /** Convenience wrapper for the numbered sigc::signal4 template. 2801 * Like sigc::signal but the additional template parameter @e T_accumulator 2802 * defines the accumulator type that should be used. 2803 */ 2804 template <class T_accumulator> 2805 class accumulated 2806 : public signal4<T_return, T_arg1,T_arg2,T_arg3,T_arg4, T_accumulator> 2807 { 2808 public: 2809 accumulated() {} 2810 accumulated(const accumulated& src) 2811 : signal4<T_return, T_arg1,T_arg2,T_arg3,T_arg4, T_accumulator>(src) {} 2812 }; 2813 2814 signal() {} 2815 signal(const signal& src) 2816 : signal4<T_return, T_arg1,T_arg2,T_arg3,T_arg4, nil>(src) {} 2817 }; 2818 2819 2820 /** Convenience wrapper for the numbered sigc::signal5 template. 2821 * See the base class for useful methods. 2822 * This is the template specialization of the unnumbered sigc::signal 2823 * template for 5 argument(s). 2824 */ 2825 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5> 2826 class signal <T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, nil,nil> 2827 : public signal5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, nil> 2828 { 2829 public: 2830 2831 /** Convenience wrapper for the numbered sigc::signal5 template. 2832 * Like sigc::signal but the additional template parameter @e T_accumulator 2833 * defines the accumulator type that should be used. 2834 */ 2835 template <class T_accumulator> 2836 class accumulated 2837 : public signal5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, T_accumulator> 2838 { 2839 public: 2840 accumulated() {} 2841 accumulated(const accumulated& src) 2842 : signal5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, T_accumulator>(src) {} 2843 }; 2844 2845 signal() {} 2846 signal(const signal& src) 2847 : signal5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, nil>(src) {} 2848 }; 2849 2850 2851 /** Convenience wrapper for the numbered sigc::signal6 template. 2852 * See the base class for useful methods. 2853 * This is the template specialization of the unnumbered sigc::signal 2854 * template for 6 argument(s). 2855 */ 2856 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6> 2857 class signal <T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, nil> 2858 : public signal6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, nil> 2859 { 2860 public: 2861 2862 /** Convenience wrapper for the numbered sigc::signal6 template. 2863 * Like sigc::signal but the additional template parameter @e T_accumulator 2864 * defines the accumulator type that should be used. 2865 */ 2866 template <class T_accumulator> 2867 class accumulated 2868 : public signal6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, T_accumulator> 2869 { 2870 public: 2871 accumulated() {} 2872 accumulated(const accumulated& src) 2873 : signal6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, T_accumulator>(src) {} 2874 }; 2875 2876 signal() {} 2877 signal(const signal& src) 2878 : signal6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, nil>(src) {} 2879 }; 2880 2881 2882 2883 } /* namespace sigc */ 2884 2885 2886 #ifndef LIBSIGC_DISABLE_DEPRECATED 2887 2888 namespace SigC { 2889 2890 // SignalN 2891 /** Signal declaration. 2892 * Signal0 can be used to connect() slots that are invoked 2893 * during subsequent calls to emit(). Any functor or slot 2894 * can be passed into connect(). It is converted into a slot 2895 * implicitely. 2896 * 2897 * If you want to connect one signal to another, use slot() 2898 * to retrieve a functor that emits the signal when invoked. 2899 * 2900 * Be careful if you directly pass one signal into the connect() 2901 * method of another: a shallow copy of the signal is made and 2902 * the signal's slots are not disconnected until both the signal 2903 * and its clone are destroyed which is probably not what you want! 2904 * 2905 * An STL-style list interface for the signal's list of slots 2906 * can be retrieved with slots(). This interface supports 2907 * iteration, insertion and removal of slots. 2908 * 2909 * The following template arguments are used: 2910 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 2911 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used. Signal emission returns the return value of the last slot invoked. 2912 * 2913 * @deprecated Use the unnumbered template sigc::signal instead. 2914 * @ingroup compat 2915 */ 2916 template <class T_return, class T_accumulator=::sigc::nil> 2917 class Signal0 2918 : public ::sigc::signal0<T_return, T_accumulator> 2919 { 2920 public: 2921 typedef ::sigc::signal0<T_return, T_accumulator> parent_type; 2922 typedef typename parent_type::result_type result_type; 2923 typedef typename parent_type::slot_type slot_type; 2924 2925 Signal0() {} 2926 Signal0(const Signal0& src) 2927 : ::sigc::signal0<T_return, T_accumulator>(src) {} 2928 2929 /** Creates a functor that calls emit() on this signal. 2930 * @code 2931 * sigc::mem_fun(mysignal, &sigc::signal0::emit) 2932 * @endcode 2933 * yields the same result. 2934 * @return A functor that calls emit() on this signal. 2935 */ 2936 slot_type slot() const 2937 { return ::sigc::bound_const_mem_functor0<result_type, parent_type>(this, &parent_type::emit); } 2938 }; 2939 2940 /** Signal declaration. 2941 * Signal1 can be used to connect() slots that are invoked 2942 * during subsequent calls to emit(). Any functor or slot 2943 * can be passed into connect(). It is converted into a slot 2944 * implicitely. 2945 * 2946 * If you want to connect one signal to another, use slot() 2947 * to retrieve a functor that emits the signal when invoked. 2948 * 2949 * Be careful if you directly pass one signal into the connect() 2950 * method of another: a shallow copy of the signal is made and 2951 * the signal's slots are not disconnected until both the signal 2952 * and its clone are destroyed which is probably not what you want! 2953 * 2954 * An STL-style list interface for the signal's list of slots 2955 * can be retrieved with slots(). This interface supports 2956 * iteration, insertion and removal of slots. 2957 * 2958 * The following template arguments are used: 2959 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 2960 * - @e T_arg1 Argument type used in the definition of emit(). 2961 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used. Signal emission returns the return value of the last slot invoked. 2962 * 2963 * @deprecated Use the unnumbered template sigc::signal instead. 2964 * @ingroup compat 2965 */ 2966 template <class T_return, class T_arg1, class T_accumulator=::sigc::nil> 2967 class Signal1 2968 : public ::sigc::signal1<T_return, T_arg1, T_accumulator> 2969 { 2970 public: 2971 typedef ::sigc::signal1<T_return, T_arg1, T_accumulator> parent_type; 2972 typedef typename parent_type::result_type result_type; 2973 typedef typename parent_type::slot_type slot_type; 2974 2975 Signal1() {} 2976 Signal1(const Signal1& src) 2977 : ::sigc::signal1<T_return, T_arg1, T_accumulator>(src) {} 2978 2979 /** Creates a functor that calls emit() on this signal. 2980 * @code 2981 * sigc::mem_fun(mysignal, &sigc::signal1::emit) 2982 * @endcode 2983 * yields the same result. 2984 * @return A functor that calls emit() on this signal. 2985 */ 2986 slot_type slot() const 2987 { return ::sigc::bound_const_mem_functor1<result_type, parent_type, typename ::sigc::type_trait<T_arg1>::take>(this, &parent_type::emit); } 2988 }; 2989 2990 /** Signal declaration. 2991 * Signal2 can be used to connect() slots that are invoked 2992 * during subsequent calls to emit(). Any functor or slot 2993 * can be passed into connect(). It is converted into a slot 2994 * implicitely. 2995 * 2996 * If you want to connect one signal to another, use slot() 2997 * to retrieve a functor that emits the signal when invoked. 2998 * 2999 * Be careful if you directly pass one signal into the connect() 3000 * method of another: a shallow copy of the signal is made and 3001 * the signal's slots are not disconnected until both the signal 3002 * and its clone are destroyed which is probably not what you want! 3003 * 3004 * An STL-style list interface for the signal's list of slots 3005 * can be retrieved with slots(). This interface supports 3006 * iteration, insertion and removal of slots. 3007 * 3008 * The following template arguments are used: 3009 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 3010 * - @e T_arg1 Argument type used in the definition of emit(). 3011 * - @e T_arg2 Argument type used in the definition of emit(). 3012 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used. Signal emission returns the return value of the last slot invoked. 3013 * 3014 * @deprecated Use the unnumbered template sigc::signal instead. 3015 * @ingroup compat 3016 */ 3017 template <class T_return, class T_arg1,class T_arg2, class T_accumulator=::sigc::nil> 3018 class Signal2 3019 : public ::sigc::signal2<T_return, T_arg1,T_arg2, T_accumulator> 3020 { 3021 public: 3022 typedef ::sigc::signal2<T_return, T_arg1,T_arg2, T_accumulator> parent_type; 3023 typedef typename parent_type::result_type result_type; 3024 typedef typename parent_type::slot_type slot_type; 3025 3026 Signal2() {} 3027 Signal2(const Signal2& src) 3028 : ::sigc::signal2<T_return, T_arg1,T_arg2, T_accumulator>(src) {} 3029 3030 /** Creates a functor that calls emit() on this signal. 3031 * @code 3032 * sigc::mem_fun(mysignal, &sigc::signal2::emit) 3033 * @endcode 3034 * yields the same result. 3035 * @return A functor that calls emit() on this signal. 3036 */ 3037 slot_type slot() const 3038 { return ::sigc::bound_const_mem_functor2<result_type, parent_type, typename ::sigc::type_trait<T_arg1>::take,typename ::sigc::type_trait<T_arg2>::take>(this, &parent_type::emit); } 3039 }; 3040 3041 /** Signal declaration. 3042 * Signal3 can be used to connect() slots that are invoked 3043 * during subsequent calls to emit(). Any functor or slot 3044 * can be passed into connect(). It is converted into a slot 3045 * implicitely. 3046 * 3047 * If you want to connect one signal to another, use slot() 3048 * to retrieve a functor that emits the signal when invoked. 3049 * 3050 * Be careful if you directly pass one signal into the connect() 3051 * method of another: a shallow copy of the signal is made and 3052 * the signal's slots are not disconnected until both the signal 3053 * and its clone are destroyed which is probably not what you want! 3054 * 3055 * An STL-style list interface for the signal's list of slots 3056 * can be retrieved with slots(). This interface supports 3057 * iteration, insertion and removal of slots. 3058 * 3059 * The following template arguments are used: 3060 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 3061 * - @e T_arg1 Argument type used in the definition of emit(). 3062 * - @e T_arg2 Argument type used in the definition of emit(). 3063 * - @e T_arg3 Argument type used in the definition of emit(). 3064 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used. Signal emission returns the return value of the last slot invoked. 3065 * 3066 * @deprecated Use the unnumbered template sigc::signal instead. 3067 * @ingroup compat 3068 */ 3069 template <class T_return, class T_arg1,class T_arg2,class T_arg3, class T_accumulator=::sigc::nil> 3070 class Signal3 3071 : public ::sigc::signal3<T_return, T_arg1,T_arg2,T_arg3, T_accumulator> 3072 { 3073 public: 3074 typedef ::sigc::signal3<T_return, T_arg1,T_arg2,T_arg3, T_accumulator> parent_type; 3075 typedef typename parent_type::result_type result_type; 3076 typedef typename parent_type::slot_type slot_type; 3077 3078 Signal3() {} 3079 Signal3(const Signal3& src) 3080 : ::sigc::signal3<T_return, T_arg1,T_arg2,T_arg3, T_accumulator>(src) {} 3081 3082 /** Creates a functor that calls emit() on this signal. 3083 * @code 3084 * sigc::mem_fun(mysignal, &sigc::signal3::emit) 3085 * @endcode 3086 * yields the same result. 3087 * @return A functor that calls emit() on this signal. 3088 */ 3089 slot_type slot() const 3090 { return ::sigc::bound_const_mem_functor3<result_type, parent_type, typename ::sigc::type_trait<T_arg1>::take,typename ::sigc::type_trait<T_arg2>::take,typename ::sigc::type_trait<T_arg3>::take>(this, &parent_type::emit); } 3091 }; 3092 3093 /** Signal declaration. 3094 * Signal4 can be used to connect() slots that are invoked 3095 * during subsequent calls to emit(). Any functor or slot 3096 * can be passed into connect(). It is converted into a slot 3097 * implicitely. 3098 * 3099 * If you want to connect one signal to another, use slot() 3100 * to retrieve a functor that emits the signal when invoked. 3101 * 3102 * Be careful if you directly pass one signal into the connect() 3103 * method of another: a shallow copy of the signal is made and 3104 * the signal's slots are not disconnected until both the signal 3105 * and its clone are destroyed which is probably not what you want! 3106 * 3107 * An STL-style list interface for the signal's list of slots 3108 * can be retrieved with slots(). This interface supports 3109 * iteration, insertion and removal of slots. 3110 * 3111 * The following template arguments are used: 3112 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 3113 * - @e T_arg1 Argument type used in the definition of emit(). 3114 * - @e T_arg2 Argument type used in the definition of emit(). 3115 * - @e T_arg3 Argument type used in the definition of emit(). 3116 * - @e T_arg4 Argument type used in the definition of emit(). 3117 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used. Signal emission returns the return value of the last slot invoked. 3118 * 3119 * @deprecated Use the unnumbered template sigc::signal instead. 3120 * @ingroup compat 3121 */ 3122 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4, class T_accumulator=::sigc::nil> 3123 class Signal4 3124 : public ::sigc::signal4<T_return, T_arg1,T_arg2,T_arg3,T_arg4, T_accumulator> 3125 { 3126 public: 3127 typedef ::sigc::signal4<T_return, T_arg1,T_arg2,T_arg3,T_arg4, T_accumulator> parent_type; 3128 typedef typename parent_type::result_type result_type; 3129 typedef typename parent_type::slot_type slot_type; 3130 3131 Signal4() {} 3132 Signal4(const Signal4& src) 3133 : ::sigc::signal4<T_return, T_arg1,T_arg2,T_arg3,T_arg4, T_accumulator>(src) {} 3134 3135 /** Creates a functor that calls emit() on this signal. 3136 * @code 3137 * sigc::mem_fun(mysignal, &sigc::signal4::emit) 3138 * @endcode 3139 * yields the same result. 3140 * @return A functor that calls emit() on this signal. 3141 */ 3142 slot_type slot() const 3143 { return ::sigc::bound_const_mem_functor4<result_type, parent_type, typename ::sigc::type_trait<T_arg1>::take,typename ::sigc::type_trait<T_arg2>::take,typename ::sigc::type_trait<T_arg3>::take,typename ::sigc::type_trait<T_arg4>::take>(this, &parent_type::emit); } 3144 }; 3145 3146 /** Signal declaration. 3147 * Signal5 can be used to connect() slots that are invoked 3148 * during subsequent calls to emit(). Any functor or slot 3149 * can be passed into connect(). It is converted into a slot 3150 * implicitely. 3151 * 3152 * If you want to connect one signal to another, use slot() 3153 * to retrieve a functor that emits the signal when invoked. 3154 * 3155 * Be careful if you directly pass one signal into the connect() 3156 * method of another: a shallow copy of the signal is made and 3157 * the signal's slots are not disconnected until both the signal 3158 * and its clone are destroyed which is probably not what you want! 3159 * 3160 * An STL-style list interface for the signal's list of slots 3161 * can be retrieved with slots(). This interface supports 3162 * iteration, insertion and removal of slots. 3163 * 3164 * The following template arguments are used: 3165 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 3166 * - @e T_arg1 Argument type used in the definition of emit(). 3167 * - @e T_arg2 Argument type used in the definition of emit(). 3168 * - @e T_arg3 Argument type used in the definition of emit(). 3169 * - @e T_arg4 Argument type used in the definition of emit(). 3170 * - @e T_arg5 Argument type used in the definition of emit(). 3171 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used. Signal emission returns the return value of the last slot invoked. 3172 * 3173 * @deprecated Use the unnumbered template sigc::signal instead. 3174 * @ingroup compat 3175 */ 3176 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5, class T_accumulator=::sigc::nil> 3177 class Signal5 3178 : public ::sigc::signal5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, T_accumulator> 3179 { 3180 public: 3181 typedef ::sigc::signal5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, T_accumulator> parent_type; 3182 typedef typename parent_type::result_type result_type; 3183 typedef typename parent_type::slot_type slot_type; 3184 3185 Signal5() {} 3186 Signal5(const Signal5& src) 3187 : ::sigc::signal5<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5, T_accumulator>(src) {} 3188 3189 /** Creates a functor that calls emit() on this signal. 3190 * @code 3191 * sigc::mem_fun(mysignal, &sigc::signal5::emit) 3192 * @endcode 3193 * yields the same result. 3194 * @return A functor that calls emit() on this signal. 3195 */ 3196 slot_type slot() const 3197 { return ::sigc::bound_const_mem_functor5<result_type, parent_type, typename ::sigc::type_trait<T_arg1>::take,typename ::sigc::type_trait<T_arg2>::take,typename ::sigc::type_trait<T_arg3>::take,typename ::sigc::type_trait<T_arg4>::take,typename ::sigc::type_trait<T_arg5>::take>(this, &parent_type::emit); } 3198 }; 3199 3200 /** Signal declaration. 3201 * Signal6 can be used to connect() slots that are invoked 3202 * during subsequent calls to emit(). Any functor or slot 3203 * can be passed into connect(). It is converted into a slot 3204 * implicitely. 3205 * 3206 * If you want to connect one signal to another, use slot() 3207 * to retrieve a functor that emits the signal when invoked. 3208 * 3209 * Be careful if you directly pass one signal into the connect() 3210 * method of another: a shallow copy of the signal is made and 3211 * the signal's slots are not disconnected until both the signal 3212 * and its clone are destroyed which is probably not what you want! 3213 * 3214 * An STL-style list interface for the signal's list of slots 3215 * can be retrieved with slots(). This interface supports 3216 * iteration, insertion and removal of slots. 3217 * 3218 * The following template arguments are used: 3219 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 3220 * - @e T_arg1 Argument type used in the definition of emit(). 3221 * - @e T_arg2 Argument type used in the definition of emit(). 3222 * - @e T_arg3 Argument type used in the definition of emit(). 3223 * - @e T_arg4 Argument type used in the definition of emit(). 3224 * - @e T_arg5 Argument type used in the definition of emit(). 3225 * - @e T_arg6 Argument type used in the definition of emit(). 3226 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used. Signal emission returns the return value of the last slot invoked. 3227 * 3228 * @deprecated Use the unnumbered template sigc::signal instead. 3229 * @ingroup compat 3230 */ 3231 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6, class T_accumulator=::sigc::nil> 3232 class Signal6 3233 : public ::sigc::signal6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, T_accumulator> 3234 { 3235 public: 3236 typedef ::sigc::signal6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, T_accumulator> parent_type; 3237 typedef typename parent_type::result_type result_type; 3238 typedef typename parent_type::slot_type slot_type; 3239 3240 Signal6() {} 3241 Signal6(const Signal6& src) 3242 : ::sigc::signal6<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6, T_accumulator>(src) {} 3243 3244 /** Creates a functor that calls emit() on this signal. 3245 * @code 3246 * sigc::mem_fun(mysignal, &sigc::signal6::emit) 3247 * @endcode 3248 * yields the same result. 3249 * @return A functor that calls emit() on this signal. 3250 */ 3251 slot_type slot() const 3252 { return ::sigc::bound_const_mem_functor6<result_type, parent_type, typename ::sigc::type_trait<T_arg1>::take,typename ::sigc::type_trait<T_arg2>::take,typename ::sigc::type_trait<T_arg3>::take,typename ::sigc::type_trait<T_arg4>::take,typename ::sigc::type_trait<T_arg5>::take,typename ::sigc::type_trait<T_arg6>::take>(this, &parent_type::emit); } 3253 }; 3254 3255 /** Signal declaration. 3256 * Signal7 can be used to connect() slots that are invoked 3257 * during subsequent calls to emit(). Any functor or slot 3258 * can be passed into connect(). It is converted into a slot 3259 * implicitely. 3260 * 3261 * If you want to connect one signal to another, use slot() 3262 * to retrieve a functor that emits the signal when invoked. 3263 * 3264 * Be careful if you directly pass one signal into the connect() 3265 * method of another: a shallow copy of the signal is made and 3266 * the signal's slots are not disconnected until both the signal 3267 * and its clone are destroyed which is probably not what you want! 3268 * 3269 * An STL-style list interface for the signal's list of slots 3270 * can be retrieved with slots(). This interface supports 3271 * iteration, insertion and removal of slots. 3272 * 3273 * The following template arguments are used: 3274 * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). 3275 * - @e T_arg1 Argument type used in the definition of emit(). 3276 * - @e T_arg2 Argument type used in the definition of emit(). 3277 * - @e T_arg3 Argument type used in the definition of emit(). 3278 * - @e T_arg4 Argument type used in the definition of emit(). 3279 * - @e T_arg5 Argument type used in the definition of emit(). 3280 * - @e T_arg6 Argument type used in the definition of emit(). 3281 * - @e T_arg7 Argument type used in the definition of emit(). 3282 * - @e T_accumulator The accumulator type used for emission. The default @p nil means that no accumulator should be used. Signal emission returns the return value of the last slot invoked. 3283 * 3284 * @deprecated Use the unnumbered template sigc::signal instead. 3285 * @ingroup compat 3286 */ 3287 template <class T_return, class T_arg1,class T_arg2,class T_arg3,class T_arg4,class T_arg5,class T_arg6,class T_arg7, class T_accumulator=::sigc::nil> 3288 class Signal7 3289 : public ::sigc::signal7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, T_accumulator> 3290 { 3291 public: 3292 typedef ::sigc::signal7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, T_accumulator> parent_type; 3293 typedef typename parent_type::result_type result_type; 3294 typedef typename parent_type::slot_type slot_type; 3295 3296 Signal7() {} 3297 Signal7(const Signal7& src) 3298 : ::sigc::signal7<T_return, T_arg1,T_arg2,T_arg3,T_arg4,T_arg5,T_arg6,T_arg7, T_accumulator>(src) {} 3299 3300 /** Creates a functor that calls emit() on this signal. 3301 * @code 3302 * sigc::mem_fun(mysignal, &sigc::signal7::emit) 3303 * @endcode 3304 * yields the same result. 3305 * @return A functor that calls emit() on this signal. 3306 */ 3307 slot_type slot() const 3308 { return ::sigc::bound_const_mem_functor7<result_type, parent_type, typename ::sigc::type_trait<T_arg1>::take,typename ::sigc::type_trait<T_arg2>::take,typename ::sigc::type_trait<T_arg3>::take,typename ::sigc::type_trait<T_arg4>::take,typename ::sigc::type_trait<T_arg5>::take,typename ::sigc::type_trait<T_arg6>::take,typename ::sigc::type_trait<T_arg7>::take>(this, &parent_type::emit); } 3309 }; 3310 3311 3312 } 3313 3314 #endif /* LIBSIGC_DISABLE_DEPRECATED */ 3315 3316 #endif /* _SIGC_SIGNAL_H_ */ 3317