sigx++ 2.0.1
|
00001 // -*- c++ -*- 00002 /* Do not edit! -- generated file */ 00003 00004 00005 #ifndef _SIGXMACROS_SIGNAL_WRAPPER_H_ 00006 #define _SIGXMACROS_SIGNAL_WRAPPER_H_ 00007 00008 00009 /* 00010 * Copyright 2007 Klaus Triendl 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Library General Public 00014 * License as published by the Free Software Foundation; either 00015 * version 2 of the License, or (at your option) any later version. 00016 * 00017 * This library is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 * Library General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU Library General Public 00023 * License along with this library; if not, write to the Free 00024 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00025 */ 00026 00027 #include <tr1/memory> // std::tr1::shared_ptr, std::auto_ptr 00028 #include <sigc++/sigc++.h> 00029 #include <glibmm/main.h> // glibmm signals 00030 #include <sigx/types.h> 00031 #include <sigx/internal_types.h> 00032 #include <sigx/signal_traits.h> 00033 #include <sigx/signal_wrapper_base.h> 00034 #include <sigx/signal_source_base.h> 00035 #include <sigx/tunnel_functor.h> 00036 #include <sigx/connection_handler.h> 00037 #include <sigx/connection_wrapper.h> 00038 00039 00046 namespace sigx 00047 { 00048 00049 namespace internal 00050 { 00051 00054 template<typename T_signal> 00055 struct count_signal_arguments 00056 { 00057 static const int value = -1; 00058 static const int tspec = -1; 00059 }; 00060 00061 00064 template<typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4, typename T_arg5, typename T_arg6, typename T_arg7> 00065 struct count_signal_arguments<sigc::signal<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7> > 00066 { 00067 // forward to count_arguments and not to count_signal_arguments, otherwise 00068 // we would get a false count if there is a another signal as the first 00069 // argument of a signal, like: sigc::signal<void, sigc::signal<void> > 00070 static const int value = count_arguments<T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7>::value; 00071 static const int tspec = value; 00072 }; 00073 00076 template<typename T_return, typename T_accumulator> 00077 struct count_signal_arguments<sigc::signal0<T_return, T_accumulator> > 00078 { 00079 static const int value = 0; 00080 // template specialization for argument count needed 00081 static const int tspec = value; 00082 }; 00083 00086 template<typename T_return, typename T_arg1, typename T_accumulator> 00087 struct count_signal_arguments<sigc::signal1<T_return, T_arg1, T_accumulator> > 00088 { 00089 static const int value = 1; 00090 // template specialization for argument count needed 00091 static const int tspec = value; 00092 }; 00093 00096 template<typename T_return, typename T_arg1, typename T_arg2, typename T_accumulator> 00097 struct count_signal_arguments<sigc::signal2<T_return, T_arg1, T_arg2, T_accumulator> > 00098 { 00099 static const int value = 2; 00100 // template specialization for argument count needed 00101 static const int tspec = value; 00102 }; 00103 00106 template<typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_accumulator> 00107 struct count_signal_arguments<sigc::signal3<T_return, T_arg1, T_arg2, T_arg3, T_accumulator> > 00108 { 00109 static const int value = 3; 00110 // template specialization for argument count needed 00111 static const int tspec = value; 00112 }; 00113 00116 template<typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4, typename T_accumulator> 00117 struct count_signal_arguments<sigc::signal4<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_accumulator> > 00118 { 00119 static const int value = 4; 00120 // template specialization for argument count needed 00121 static const int tspec = value; 00122 }; 00123 00126 template<typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4, typename T_arg5, typename T_accumulator> 00127 struct count_signal_arguments<sigc::signal5<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_accumulator> > 00128 { 00129 static const int value = 5; 00130 // template specialization for argument count needed 00131 static const int tspec = value; 00132 }; 00133 00136 template<typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4, typename T_arg5, typename T_arg6, typename T_accumulator> 00137 struct count_signal_arguments<sigc::signal6<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_accumulator> > 00138 { 00139 static const int value = 6; 00140 // template specialization for argument count needed 00141 static const int tspec = value; 00142 }; 00143 00146 template<typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4, typename T_arg5, typename T_arg6, typename T_arg7, typename T_accumulator> 00147 struct count_signal_arguments<sigc::signal7<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6, T_arg7, T_accumulator> > 00148 { 00149 static const int value = 7; 00150 // template specialization for argument count needed 00151 static const int tspec = value; 00152 }; 00153 00154 00157 template<typename T_return> 00158 struct count_signal_arguments<Glib::SignalProxy0<T_return> > 00159 { 00160 static const int value = 0; 00161 // template specialization for argument count not needed; 00162 // this allows us to group all SignProxyN signals together in one template 00163 // class 00164 static const int tspec = -1; 00165 }; 00166 00169 template<typename T_return, typename T_arg1> 00170 struct count_signal_arguments<Glib::SignalProxy1<T_return, T_arg1> > 00171 { 00172 static const int value = 1; 00173 // template specialization for argument count not needed; 00174 // this allows us to group all SignProxyN signals together in one template 00175 // class 00176 static const int tspec = -1; 00177 }; 00178 00181 template<typename T_return, typename T_arg1, typename T_arg2> 00182 struct count_signal_arguments<Glib::SignalProxy2<T_return, T_arg1, T_arg2> > 00183 { 00184 static const int value = 2; 00185 // template specialization for argument count not needed; 00186 // this allows us to group all SignProxyN signals together in one template 00187 // class 00188 static const int tspec = -1; 00189 }; 00190 00193 template<typename T_return, typename T_arg1, typename T_arg2, typename T_arg3> 00194 struct count_signal_arguments<Glib::SignalProxy3<T_return, T_arg1, T_arg2, T_arg3> > 00195 { 00196 static const int value = 3; 00197 // template specialization for argument count not needed; 00198 // this allows us to group all SignProxyN signals together in one template 00199 // class 00200 static const int tspec = -1; 00201 }; 00202 00205 template<typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4> 00206 struct count_signal_arguments<Glib::SignalProxy4<T_return, T_arg1, T_arg2, T_arg3, T_arg4> > 00207 { 00208 static const int value = 4; 00209 // template specialization for argument count not needed; 00210 // this allows us to group all SignProxyN signals together in one template 00211 // class 00212 static const int tspec = -1; 00213 }; 00214 00217 template<typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4, typename T_arg5> 00218 struct count_signal_arguments<Glib::SignalProxy5<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5> > 00219 { 00220 static const int value = 5; 00221 // template specialization for argument count not needed; 00222 // this allows us to group all SignProxyN signals together in one template 00223 // class 00224 static const int tspec = -1; 00225 }; 00226 00229 template<typename T_return, typename T_arg1, typename T_arg2, typename T_arg3, typename T_arg4, typename T_arg5, typename T_arg6> 00230 struct count_signal_arguments<Glib::SignalProxy6<T_return, T_arg1, T_arg2, T_arg3, T_arg4, T_arg5, T_arg6> > 00231 { 00232 static const int value = 6; 00233 // template specialization for argument count not needed; 00234 // this allows us to group all SignProxyN signals together in one template 00235 // class 00236 static const int tspec = -1; 00237 }; 00238 00239 00240 00243 template<> 00244 struct count_signal_arguments<Glib::SignalIdle> 00245 { 00246 static const int value = 0; 00247 static const int tspec = value; 00248 }; 00249 00252 template<> 00253 struct count_signal_arguments<Glib::SignalTimeout> 00254 { 00255 static const int value = 0; 00256 static const int tspec = value; 00257 }; 00258 00261 template<> 00262 struct count_signal_arguments<Glib::SignalIO> 00263 { 00264 static const int value = 1; 00265 static const int tspec = value; 00266 }; 00267 00270 template<> 00271 struct count_signal_arguments<Glib::SignalChildWatch> 00272 { 00273 static const int value = 2; 00274 static const int tspec = value; 00275 }; 00276 00277 00278 } // namespace internal 00279 00280 00289 template<typename T_signal, internal::signal_group I_oneof = internal::signal_type_trait<T_signal>::type, int I_arg_count = internal::count_signal_arguments<T_signal>::tspec> 00290 class signal_wrapper; 00291 00296 template<typename T_signal> 00297 class signal_wrapper<T_signal, internal::SIGGROUP_SIGC, 0>: public signal_wrapper_base 00298 { 00299 public: 00300 //BOOST_STATIC_ASSERT((internal::count_signal_arguments<T_signal>::value == 0)); 00301 static const int argument_count = 0; 00302 static const internal::signal_group signal_group = internal::SIGGROUP_SIGC; 00303 typedef T_signal signal_type; 00304 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 00305 typedef typename signal_type::slot_type slot_type; 00306 typedef typename signal_type::result_type result_type; 00307 00308 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 00309 00310 protected: 00311 typedef sigc::bound_const_mem_functor0<signal_source_base::hook, signal_source_base> make_slot_f1; 00312 typedef sigc::retype_return_functor<fp_sig_getter_type, make_slot_f1> make_slot_f2; 00313 typedef sigc::const_mem_functor0<signal_source_ptr, std::tr1::shared_ptr<signal_source_base> > make_slot_f3; 00314 typedef sigc::bind_functor<-1, make_slot_f3, std::tr1::shared_ptr<signal_source_base> > make_slot_f4; 00315 typedef sigc::compose1_functor<make_slot_f2, make_slot_f4> make_slot_composed1_functor_type; 00316 typedef sigc::const_mem_functor0<result_type, signal_type> make_slot_emit_functor_type; 00317 typedef sigc::compose1_functor<make_slot_emit_functor_type, make_slot_composed1_functor_type> make_slot_composed2_functor_type; 00318 typedef SIGX_DISPATCH_WITH_FUNCTOR(make_slot_composed2_functor_type) make_slot_functor_type; 00319 00320 00321 public: 00325 signal_wrapper(): signal_wrapper_base() 00326 {} 00327 00333 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource) throw(): 00334 signal_wrapper_base(_A_disp, _A_sigsource) 00335 {} 00336 00363 template<typename T_functor> 00364 connection_wrapper connect(const T_functor& _A_func) const 00365 { 00366 return signal_wrapper_base::connect( 00367 _A_func, 00368 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect) 00369 ); 00370 } 00371 00374 template<sync_type I_sync> 00375 result_type emit() const 00376 { 00377 return open_tunnel_with<I_sync>( 00378 // calls T_signal::*emit 00379 sigc::compose( 00380 sigc::mem_fun(&signal_type::emit), 00381 // getter for the T_signal 00382 sigc::compose( 00383 sigc::retype_return<fp_sig_getter_type>( 00384 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 00385 ), 00386 // this makes a copy of the shared signal source and thus 00387 // shares it within the tunnel functor ensuring the lifetime 00388 // of the shared signal source 00389 sigc::bind( 00390 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 00391 m_sigsource 00392 ) 00393 ) 00394 ), 00395 m_disp 00396 )(); 00397 } 00398 00401 result_type emit() const 00402 { 00403 return emit<ASYNC>(); 00404 } 00405 00408 result_type emit_sync() const 00409 { 00410 return emit<SYNC>(); 00411 } 00412 00415 result_type operator()() const 00416 { 00417 return emit<ASYNC>(); 00418 } 00419 00420 00423 template<sync_type I_sync> 00424 tunnel_functor<I_sync, make_slot_functor_type> make_slot() const 00425 { 00426 typedef tunnel_functor<I_sync, make_slot_functor_type> tunnel_funtor_type; 00427 return tunnel_funtor_type( 00428 dispatch_with( 00429 // calls T_signal::*emit 00430 sigc::compose( 00431 &signal_type::emit, 00432 // getter for the T_signal 00433 sigc::compose( 00434 sigc::retype_return<fp_sig_getter_type>( 00435 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 00436 ), 00437 sigc::bind( 00438 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 00439 m_sigsource 00440 ) 00441 ) 00442 ), 00443 m_disp 00444 )); 00445 } 00446 00450 tunnel_functor<ASYNC, make_slot_functor_type> make_slot() const 00451 { 00452 return make_slot<ASYNC>(); 00453 } 00454 00458 tunnel_functor<SYNC, make_slot_functor_type> make_slot_sync() const 00459 { 00460 return make_slot<SYNC>(); 00461 } 00462 }; 00463 00468 template<typename T_signal> 00469 class signal_wrapper<T_signal, internal::SIGGROUP_SIGC, 1>: public signal_wrapper_base 00470 { 00471 public: 00472 //BOOST_STATIC_ASSERT((internal::count_signal_arguments<T_signal>::value == 1)); 00473 static const int argument_count = 1; 00474 static const internal::signal_group signal_group = internal::SIGGROUP_SIGC; 00475 typedef T_signal signal_type; 00476 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 00477 typedef typename signal_type::slot_type slot_type; 00478 typedef typename signal_type::result_type result_type; 00479 typedef typename slot_type::arg1_type_ arg1_type_; 00480 00481 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 00482 00483 protected: 00484 typedef sigc::bound_const_mem_functor0<signal_source_base::hook, signal_source_base> make_slot_f1; 00485 typedef sigc::retype_return_functor<fp_sig_getter_type, make_slot_f1> make_slot_f2; 00486 typedef sigc::const_mem_functor0<signal_source_ptr, std::tr1::shared_ptr<signal_source_base> > make_slot_f3; 00487 typedef sigc::bind_functor<-1, make_slot_f3, std::tr1::shared_ptr<signal_source_base> > make_slot_f4; 00488 typedef sigc::compose1_functor<make_slot_f2, make_slot_f4> make_slot_composed1_functor_type; 00489 typedef sigc::const_mem_functor1<result_type, signal_type, arg1_type_> make_slot_emit_functor_type; 00490 typedef sigc::compose1_functor<make_slot_emit_functor_type, make_slot_composed1_functor_type> make_slot_composed2_functor_type; 00491 typedef SIGX_DISPATCH_WITH_FUNCTOR(make_slot_composed2_functor_type) make_slot_functor_type; 00492 00493 00494 public: 00498 signal_wrapper(): signal_wrapper_base() 00499 {} 00500 00506 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource) throw(): 00507 signal_wrapper_base(_A_disp, _A_sigsource) 00508 {} 00509 00536 template<typename T_functor> 00537 connection_wrapper connect(const T_functor& _A_func) const 00538 { 00539 return signal_wrapper_base::connect( 00540 _A_func, 00541 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect) 00542 ); 00543 } 00544 00547 template<sync_type I_sync> 00548 result_type emit(arg1_type_ _A_a1) const 00549 { 00550 return open_tunnel_with<I_sync>( 00551 // calls T_signal::*emit 00552 sigc::compose( 00553 sigc::mem_fun(&signal_type::emit), 00554 // getter for the T_signal 00555 sigc::compose( 00556 sigc::retype_return<fp_sig_getter_type>( 00557 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 00558 ), 00559 // this makes a copy of the shared signal source and thus 00560 // shares it within the tunnel functor ensuring the lifetime 00561 // of the shared signal source 00562 sigc::bind( 00563 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 00564 m_sigsource 00565 ) 00566 ) 00567 ), 00568 m_disp 00569 )(_A_a1); 00570 } 00571 00574 result_type emit(arg1_type_ _A_a1) const 00575 { 00576 return emit<ASYNC>(_A_a1); 00577 } 00578 00581 result_type emit_sync(arg1_type_ _A_a1) const 00582 { 00583 return emit<SYNC>(_A_a1); 00584 } 00585 00588 result_type operator()(arg1_type_ _A_a1) const 00589 { 00590 return emit<ASYNC>(_A_a1); 00591 } 00592 00593 00596 template<sync_type I_sync> 00597 tunnel_functor<I_sync, make_slot_functor_type> make_slot() const 00598 { 00599 typedef tunnel_functor<I_sync, make_slot_functor_type> tunnel_funtor_type; 00600 return tunnel_funtor_type( 00601 dispatch_with( 00602 // calls T_signal::*emit 00603 sigc::compose( 00604 &signal_type::emit, 00605 // getter for the T_signal 00606 sigc::compose( 00607 sigc::retype_return<fp_sig_getter_type>( 00608 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 00609 ), 00610 sigc::bind( 00611 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 00612 m_sigsource 00613 ) 00614 ) 00615 ), 00616 m_disp 00617 )); 00618 } 00619 00623 tunnel_functor<ASYNC, make_slot_functor_type> make_slot() const 00624 { 00625 return make_slot<ASYNC>(); 00626 } 00627 00631 tunnel_functor<SYNC, make_slot_functor_type> make_slot_sync() const 00632 { 00633 return make_slot<SYNC>(); 00634 } 00635 }; 00636 00641 template<typename T_signal> 00642 class signal_wrapper<T_signal, internal::SIGGROUP_SIGC, 2>: public signal_wrapper_base 00643 { 00644 public: 00645 //BOOST_STATIC_ASSERT((internal::count_signal_arguments<T_signal>::value == 2)); 00646 static const int argument_count = 2; 00647 static const internal::signal_group signal_group = internal::SIGGROUP_SIGC; 00648 typedef T_signal signal_type; 00649 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 00650 typedef typename signal_type::slot_type slot_type; 00651 typedef typename signal_type::result_type result_type; 00652 typedef typename slot_type::arg1_type_ arg1_type_; 00653 typedef typename slot_type::arg2_type_ arg2_type_; 00654 00655 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 00656 00657 protected: 00658 typedef sigc::bound_const_mem_functor0<signal_source_base::hook, signal_source_base> make_slot_f1; 00659 typedef sigc::retype_return_functor<fp_sig_getter_type, make_slot_f1> make_slot_f2; 00660 typedef sigc::const_mem_functor0<signal_source_ptr, std::tr1::shared_ptr<signal_source_base> > make_slot_f3; 00661 typedef sigc::bind_functor<-1, make_slot_f3, std::tr1::shared_ptr<signal_source_base> > make_slot_f4; 00662 typedef sigc::compose1_functor<make_slot_f2, make_slot_f4> make_slot_composed1_functor_type; 00663 typedef sigc::const_mem_functor2<result_type, signal_type, arg1_type_, arg2_type_> make_slot_emit_functor_type; 00664 typedef sigc::compose1_functor<make_slot_emit_functor_type, make_slot_composed1_functor_type> make_slot_composed2_functor_type; 00665 typedef SIGX_DISPATCH_WITH_FUNCTOR(make_slot_composed2_functor_type) make_slot_functor_type; 00666 00667 00668 public: 00672 signal_wrapper(): signal_wrapper_base() 00673 {} 00674 00680 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource) throw(): 00681 signal_wrapper_base(_A_disp, _A_sigsource) 00682 {} 00683 00710 template<typename T_functor> 00711 connection_wrapper connect(const T_functor& _A_func) const 00712 { 00713 return signal_wrapper_base::connect( 00714 _A_func, 00715 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect) 00716 ); 00717 } 00718 00721 template<sync_type I_sync> 00722 result_type emit(arg1_type_ _A_a1, arg2_type_ _A_a2) const 00723 { 00724 return open_tunnel_with<I_sync>( 00725 // calls T_signal::*emit 00726 sigc::compose( 00727 sigc::mem_fun(&signal_type::emit), 00728 // getter for the T_signal 00729 sigc::compose( 00730 sigc::retype_return<fp_sig_getter_type>( 00731 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 00732 ), 00733 // this makes a copy of the shared signal source and thus 00734 // shares it within the tunnel functor ensuring the lifetime 00735 // of the shared signal source 00736 sigc::bind( 00737 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 00738 m_sigsource 00739 ) 00740 ) 00741 ), 00742 m_disp 00743 )(_A_a1, _A_a2); 00744 } 00745 00748 result_type emit(arg1_type_ _A_a1, arg2_type_ _A_a2) const 00749 { 00750 return emit<ASYNC>(_A_a1, _A_a2); 00751 } 00752 00755 result_type emit_sync(arg1_type_ _A_a1, arg2_type_ _A_a2) const 00756 { 00757 return emit<SYNC>(_A_a1, _A_a2); 00758 } 00759 00762 result_type operator()(arg1_type_ _A_a1, arg2_type_ _A_a2) const 00763 { 00764 return emit<ASYNC>(_A_a1, _A_a2); 00765 } 00766 00767 00770 template<sync_type I_sync> 00771 tunnel_functor<I_sync, make_slot_functor_type> make_slot() const 00772 { 00773 typedef tunnel_functor<I_sync, make_slot_functor_type> tunnel_funtor_type; 00774 return tunnel_funtor_type( 00775 dispatch_with( 00776 // calls T_signal::*emit 00777 sigc::compose( 00778 &signal_type::emit, 00779 // getter for the T_signal 00780 sigc::compose( 00781 sigc::retype_return<fp_sig_getter_type>( 00782 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 00783 ), 00784 sigc::bind( 00785 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 00786 m_sigsource 00787 ) 00788 ) 00789 ), 00790 m_disp 00791 )); 00792 } 00793 00797 tunnel_functor<ASYNC, make_slot_functor_type> make_slot() const 00798 { 00799 return make_slot<ASYNC>(); 00800 } 00801 00805 tunnel_functor<SYNC, make_slot_functor_type> make_slot_sync() const 00806 { 00807 return make_slot<SYNC>(); 00808 } 00809 }; 00810 00815 template<typename T_signal> 00816 class signal_wrapper<T_signal, internal::SIGGROUP_SIGC, 3>: public signal_wrapper_base 00817 { 00818 public: 00819 //BOOST_STATIC_ASSERT((internal::count_signal_arguments<T_signal>::value == 3)); 00820 static const int argument_count = 3; 00821 static const internal::signal_group signal_group = internal::SIGGROUP_SIGC; 00822 typedef T_signal signal_type; 00823 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 00824 typedef typename signal_type::slot_type slot_type; 00825 typedef typename signal_type::result_type result_type; 00826 typedef typename slot_type::arg1_type_ arg1_type_; 00827 typedef typename slot_type::arg2_type_ arg2_type_; 00828 typedef typename slot_type::arg3_type_ arg3_type_; 00829 00830 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 00831 00832 protected: 00833 typedef sigc::bound_const_mem_functor0<signal_source_base::hook, signal_source_base> make_slot_f1; 00834 typedef sigc::retype_return_functor<fp_sig_getter_type, make_slot_f1> make_slot_f2; 00835 typedef sigc::const_mem_functor0<signal_source_ptr, std::tr1::shared_ptr<signal_source_base> > make_slot_f3; 00836 typedef sigc::bind_functor<-1, make_slot_f3, std::tr1::shared_ptr<signal_source_base> > make_slot_f4; 00837 typedef sigc::compose1_functor<make_slot_f2, make_slot_f4> make_slot_composed1_functor_type; 00838 typedef sigc::const_mem_functor3<result_type, signal_type, arg1_type_, arg2_type_, arg3_type_> make_slot_emit_functor_type; 00839 typedef sigc::compose1_functor<make_slot_emit_functor_type, make_slot_composed1_functor_type> make_slot_composed2_functor_type; 00840 typedef SIGX_DISPATCH_WITH_FUNCTOR(make_slot_composed2_functor_type) make_slot_functor_type; 00841 00842 00843 public: 00847 signal_wrapper(): signal_wrapper_base() 00848 {} 00849 00855 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource) throw(): 00856 signal_wrapper_base(_A_disp, _A_sigsource) 00857 {} 00858 00885 template<typename T_functor> 00886 connection_wrapper connect(const T_functor& _A_func) const 00887 { 00888 return signal_wrapper_base::connect( 00889 _A_func, 00890 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect) 00891 ); 00892 } 00893 00896 template<sync_type I_sync> 00897 result_type emit(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3) const 00898 { 00899 return open_tunnel_with<I_sync>( 00900 // calls T_signal::*emit 00901 sigc::compose( 00902 sigc::mem_fun(&signal_type::emit), 00903 // getter for the T_signal 00904 sigc::compose( 00905 sigc::retype_return<fp_sig_getter_type>( 00906 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 00907 ), 00908 // this makes a copy of the shared signal source and thus 00909 // shares it within the tunnel functor ensuring the lifetime 00910 // of the shared signal source 00911 sigc::bind( 00912 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 00913 m_sigsource 00914 ) 00915 ) 00916 ), 00917 m_disp 00918 )(_A_a1, _A_a2, _A_a3); 00919 } 00920 00923 result_type emit(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3) const 00924 { 00925 return emit<ASYNC>(_A_a1, _A_a2, _A_a3); 00926 } 00927 00930 result_type emit_sync(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3) const 00931 { 00932 return emit<SYNC>(_A_a1, _A_a2, _A_a3); 00933 } 00934 00937 result_type operator()(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3) const 00938 { 00939 return emit<ASYNC>(_A_a1, _A_a2, _A_a3); 00940 } 00941 00942 00945 template<sync_type I_sync> 00946 tunnel_functor<I_sync, make_slot_functor_type> make_slot() const 00947 { 00948 typedef tunnel_functor<I_sync, make_slot_functor_type> tunnel_funtor_type; 00949 return tunnel_funtor_type( 00950 dispatch_with( 00951 // calls T_signal::*emit 00952 sigc::compose( 00953 &signal_type::emit, 00954 // getter for the T_signal 00955 sigc::compose( 00956 sigc::retype_return<fp_sig_getter_type>( 00957 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 00958 ), 00959 sigc::bind( 00960 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 00961 m_sigsource 00962 ) 00963 ) 00964 ), 00965 m_disp 00966 )); 00967 } 00968 00972 tunnel_functor<ASYNC, make_slot_functor_type> make_slot() const 00973 { 00974 return make_slot<ASYNC>(); 00975 } 00976 00980 tunnel_functor<SYNC, make_slot_functor_type> make_slot_sync() const 00981 { 00982 return make_slot<SYNC>(); 00983 } 00984 }; 00985 00990 template<typename T_signal> 00991 class signal_wrapper<T_signal, internal::SIGGROUP_SIGC, 4>: public signal_wrapper_base 00992 { 00993 public: 00994 //BOOST_STATIC_ASSERT((internal::count_signal_arguments<T_signal>::value == 4)); 00995 static const int argument_count = 4; 00996 static const internal::signal_group signal_group = internal::SIGGROUP_SIGC; 00997 typedef T_signal signal_type; 00998 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 00999 typedef typename signal_type::slot_type slot_type; 01000 typedef typename signal_type::result_type result_type; 01001 typedef typename slot_type::arg1_type_ arg1_type_; 01002 typedef typename slot_type::arg2_type_ arg2_type_; 01003 typedef typename slot_type::arg3_type_ arg3_type_; 01004 typedef typename slot_type::arg4_type_ arg4_type_; 01005 01006 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 01007 01008 protected: 01009 typedef sigc::bound_const_mem_functor0<signal_source_base::hook, signal_source_base> make_slot_f1; 01010 typedef sigc::retype_return_functor<fp_sig_getter_type, make_slot_f1> make_slot_f2; 01011 typedef sigc::const_mem_functor0<signal_source_ptr, std::tr1::shared_ptr<signal_source_base> > make_slot_f3; 01012 typedef sigc::bind_functor<-1, make_slot_f3, std::tr1::shared_ptr<signal_source_base> > make_slot_f4; 01013 typedef sigc::compose1_functor<make_slot_f2, make_slot_f4> make_slot_composed1_functor_type; 01014 typedef sigc::const_mem_functor4<result_type, signal_type, arg1_type_, arg2_type_, arg3_type_, arg4_type_> make_slot_emit_functor_type; 01015 typedef sigc::compose1_functor<make_slot_emit_functor_type, make_slot_composed1_functor_type> make_slot_composed2_functor_type; 01016 typedef SIGX_DISPATCH_WITH_FUNCTOR(make_slot_composed2_functor_type) make_slot_functor_type; 01017 01018 01019 public: 01023 signal_wrapper(): signal_wrapper_base() 01024 {} 01025 01031 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource) throw(): 01032 signal_wrapper_base(_A_disp, _A_sigsource) 01033 {} 01034 01061 template<typename T_functor> 01062 connection_wrapper connect(const T_functor& _A_func) const 01063 { 01064 return signal_wrapper_base::connect( 01065 _A_func, 01066 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect) 01067 ); 01068 } 01069 01072 template<sync_type I_sync> 01073 result_type emit(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4) const 01074 { 01075 return open_tunnel_with<I_sync>( 01076 // calls T_signal::*emit 01077 sigc::compose( 01078 sigc::mem_fun(&signal_type::emit), 01079 // getter for the T_signal 01080 sigc::compose( 01081 sigc::retype_return<fp_sig_getter_type>( 01082 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 01083 ), 01084 // this makes a copy of the shared signal source and thus 01085 // shares it within the tunnel functor ensuring the lifetime 01086 // of the shared signal source 01087 sigc::bind( 01088 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 01089 m_sigsource 01090 ) 01091 ) 01092 ), 01093 m_disp 01094 )(_A_a1, _A_a2, _A_a3, _A_a4); 01095 } 01096 01099 result_type emit(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4) const 01100 { 01101 return emit<ASYNC>(_A_a1, _A_a2, _A_a3, _A_a4); 01102 } 01103 01106 result_type emit_sync(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4) const 01107 { 01108 return emit<SYNC>(_A_a1, _A_a2, _A_a3, _A_a4); 01109 } 01110 01113 result_type operator()(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4) const 01114 { 01115 return emit<ASYNC>(_A_a1, _A_a2, _A_a3, _A_a4); 01116 } 01117 01118 01121 template<sync_type I_sync> 01122 tunnel_functor<I_sync, make_slot_functor_type> make_slot() const 01123 { 01124 typedef tunnel_functor<I_sync, make_slot_functor_type> tunnel_funtor_type; 01125 return tunnel_funtor_type( 01126 dispatch_with( 01127 // calls T_signal::*emit 01128 sigc::compose( 01129 &signal_type::emit, 01130 // getter for the T_signal 01131 sigc::compose( 01132 sigc::retype_return<fp_sig_getter_type>( 01133 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 01134 ), 01135 sigc::bind( 01136 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 01137 m_sigsource 01138 ) 01139 ) 01140 ), 01141 m_disp 01142 )); 01143 } 01144 01148 tunnel_functor<ASYNC, make_slot_functor_type> make_slot() const 01149 { 01150 return make_slot<ASYNC>(); 01151 } 01152 01156 tunnel_functor<SYNC, make_slot_functor_type> make_slot_sync() const 01157 { 01158 return make_slot<SYNC>(); 01159 } 01160 }; 01161 01166 template<typename T_signal> 01167 class signal_wrapper<T_signal, internal::SIGGROUP_SIGC, 5>: public signal_wrapper_base 01168 { 01169 public: 01170 //BOOST_STATIC_ASSERT((internal::count_signal_arguments<T_signal>::value == 5)); 01171 static const int argument_count = 5; 01172 static const internal::signal_group signal_group = internal::SIGGROUP_SIGC; 01173 typedef T_signal signal_type; 01174 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 01175 typedef typename signal_type::slot_type slot_type; 01176 typedef typename signal_type::result_type result_type; 01177 typedef typename slot_type::arg1_type_ arg1_type_; 01178 typedef typename slot_type::arg2_type_ arg2_type_; 01179 typedef typename slot_type::arg3_type_ arg3_type_; 01180 typedef typename slot_type::arg4_type_ arg4_type_; 01181 typedef typename slot_type::arg5_type_ arg5_type_; 01182 01183 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 01184 01185 protected: 01186 typedef sigc::bound_const_mem_functor0<signal_source_base::hook, signal_source_base> make_slot_f1; 01187 typedef sigc::retype_return_functor<fp_sig_getter_type, make_slot_f1> make_slot_f2; 01188 typedef sigc::const_mem_functor0<signal_source_ptr, std::tr1::shared_ptr<signal_source_base> > make_slot_f3; 01189 typedef sigc::bind_functor<-1, make_slot_f3, std::tr1::shared_ptr<signal_source_base> > make_slot_f4; 01190 typedef sigc::compose1_functor<make_slot_f2, make_slot_f4> make_slot_composed1_functor_type; 01191 typedef sigc::const_mem_functor5<result_type, signal_type, arg1_type_, arg2_type_, arg3_type_, arg4_type_, arg5_type_> make_slot_emit_functor_type; 01192 typedef sigc::compose1_functor<make_slot_emit_functor_type, make_slot_composed1_functor_type> make_slot_composed2_functor_type; 01193 typedef SIGX_DISPATCH_WITH_FUNCTOR(make_slot_composed2_functor_type) make_slot_functor_type; 01194 01195 01196 public: 01200 signal_wrapper(): signal_wrapper_base() 01201 {} 01202 01208 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource) throw(): 01209 signal_wrapper_base(_A_disp, _A_sigsource) 01210 {} 01211 01238 template<typename T_functor> 01239 connection_wrapper connect(const T_functor& _A_func) const 01240 { 01241 return signal_wrapper_base::connect( 01242 _A_func, 01243 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect) 01244 ); 01245 } 01246 01249 template<sync_type I_sync> 01250 result_type emit(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5) const 01251 { 01252 return open_tunnel_with<I_sync>( 01253 // calls T_signal::*emit 01254 sigc::compose( 01255 sigc::mem_fun(&signal_type::emit), 01256 // getter for the T_signal 01257 sigc::compose( 01258 sigc::retype_return<fp_sig_getter_type>( 01259 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 01260 ), 01261 // this makes a copy of the shared signal source and thus 01262 // shares it within the tunnel functor ensuring the lifetime 01263 // of the shared signal source 01264 sigc::bind( 01265 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 01266 m_sigsource 01267 ) 01268 ) 01269 ), 01270 m_disp 01271 )(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5); 01272 } 01273 01276 result_type emit(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5) const 01277 { 01278 return emit<ASYNC>(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5); 01279 } 01280 01283 result_type emit_sync(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5) const 01284 { 01285 return emit<SYNC>(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5); 01286 } 01287 01290 result_type operator()(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5) const 01291 { 01292 return emit<ASYNC>(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5); 01293 } 01294 01295 01298 template<sync_type I_sync> 01299 tunnel_functor<I_sync, make_slot_functor_type> make_slot() const 01300 { 01301 typedef tunnel_functor<I_sync, make_slot_functor_type> tunnel_funtor_type; 01302 return tunnel_funtor_type( 01303 dispatch_with( 01304 // calls T_signal::*emit 01305 sigc::compose( 01306 &signal_type::emit, 01307 // getter for the T_signal 01308 sigc::compose( 01309 sigc::retype_return<fp_sig_getter_type>( 01310 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 01311 ), 01312 sigc::bind( 01313 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 01314 m_sigsource 01315 ) 01316 ) 01317 ), 01318 m_disp 01319 )); 01320 } 01321 01325 tunnel_functor<ASYNC, make_slot_functor_type> make_slot() const 01326 { 01327 return make_slot<ASYNC>(); 01328 } 01329 01333 tunnel_functor<SYNC, make_slot_functor_type> make_slot_sync() const 01334 { 01335 return make_slot<SYNC>(); 01336 } 01337 }; 01338 01343 template<typename T_signal> 01344 class signal_wrapper<T_signal, internal::SIGGROUP_SIGC, 6>: public signal_wrapper_base 01345 { 01346 public: 01347 //BOOST_STATIC_ASSERT((internal::count_signal_arguments<T_signal>::value == 6)); 01348 static const int argument_count = 6; 01349 static const internal::signal_group signal_group = internal::SIGGROUP_SIGC; 01350 typedef T_signal signal_type; 01351 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 01352 typedef typename signal_type::slot_type slot_type; 01353 typedef typename signal_type::result_type result_type; 01354 typedef typename slot_type::arg1_type_ arg1_type_; 01355 typedef typename slot_type::arg2_type_ arg2_type_; 01356 typedef typename slot_type::arg3_type_ arg3_type_; 01357 typedef typename slot_type::arg4_type_ arg4_type_; 01358 typedef typename slot_type::arg5_type_ arg5_type_; 01359 typedef typename slot_type::arg6_type_ arg6_type_; 01360 01361 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 01362 01363 protected: 01364 typedef sigc::bound_const_mem_functor0<signal_source_base::hook, signal_source_base> make_slot_f1; 01365 typedef sigc::retype_return_functor<fp_sig_getter_type, make_slot_f1> make_slot_f2; 01366 typedef sigc::const_mem_functor0<signal_source_ptr, std::tr1::shared_ptr<signal_source_base> > make_slot_f3; 01367 typedef sigc::bind_functor<-1, make_slot_f3, std::tr1::shared_ptr<signal_source_base> > make_slot_f4; 01368 typedef sigc::compose1_functor<make_slot_f2, make_slot_f4> make_slot_composed1_functor_type; 01369 typedef sigc::const_mem_functor6<result_type, signal_type, arg1_type_, arg2_type_, arg3_type_, arg4_type_, arg5_type_, arg6_type_> make_slot_emit_functor_type; 01370 typedef sigc::compose1_functor<make_slot_emit_functor_type, make_slot_composed1_functor_type> make_slot_composed2_functor_type; 01371 typedef SIGX_DISPATCH_WITH_FUNCTOR(make_slot_composed2_functor_type) make_slot_functor_type; 01372 01373 01374 public: 01378 signal_wrapper(): signal_wrapper_base() 01379 {} 01380 01386 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource) throw(): 01387 signal_wrapper_base(_A_disp, _A_sigsource) 01388 {} 01389 01416 template<typename T_functor> 01417 connection_wrapper connect(const T_functor& _A_func) const 01418 { 01419 return signal_wrapper_base::connect( 01420 _A_func, 01421 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect) 01422 ); 01423 } 01424 01427 template<sync_type I_sync> 01428 result_type emit(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5, arg6_type_ _A_a6) const 01429 { 01430 return open_tunnel_with<I_sync>( 01431 // calls T_signal::*emit 01432 sigc::compose( 01433 sigc::mem_fun(&signal_type::emit), 01434 // getter for the T_signal 01435 sigc::compose( 01436 sigc::retype_return<fp_sig_getter_type>( 01437 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 01438 ), 01439 // this makes a copy of the shared signal source and thus 01440 // shares it within the tunnel functor ensuring the lifetime 01441 // of the shared signal source 01442 sigc::bind( 01443 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 01444 m_sigsource 01445 ) 01446 ) 01447 ), 01448 m_disp 01449 )(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6); 01450 } 01451 01454 result_type emit(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5, arg6_type_ _A_a6) const 01455 { 01456 return emit<ASYNC>(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6); 01457 } 01458 01461 result_type emit_sync(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5, arg6_type_ _A_a6) const 01462 { 01463 return emit<SYNC>(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6); 01464 } 01465 01468 result_type operator()(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5, arg6_type_ _A_a6) const 01469 { 01470 return emit<ASYNC>(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6); 01471 } 01472 01473 01476 template<sync_type I_sync> 01477 tunnel_functor<I_sync, make_slot_functor_type> make_slot() const 01478 { 01479 typedef tunnel_functor<I_sync, make_slot_functor_type> tunnel_funtor_type; 01480 return tunnel_funtor_type( 01481 dispatch_with( 01482 // calls T_signal::*emit 01483 sigc::compose( 01484 &signal_type::emit, 01485 // getter for the T_signal 01486 sigc::compose( 01487 sigc::retype_return<fp_sig_getter_type>( 01488 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 01489 ), 01490 sigc::bind( 01491 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 01492 m_sigsource 01493 ) 01494 ) 01495 ), 01496 m_disp 01497 )); 01498 } 01499 01503 tunnel_functor<ASYNC, make_slot_functor_type> make_slot() const 01504 { 01505 return make_slot<ASYNC>(); 01506 } 01507 01511 tunnel_functor<SYNC, make_slot_functor_type> make_slot_sync() const 01512 { 01513 return make_slot<SYNC>(); 01514 } 01515 }; 01516 01521 template<typename T_signal> 01522 class signal_wrapper<T_signal, internal::SIGGROUP_SIGC, 7>: public signal_wrapper_base 01523 { 01524 public: 01525 //BOOST_STATIC_ASSERT((internal::count_signal_arguments<T_signal>::value == 7)); 01526 static const int argument_count = 7; 01527 static const internal::signal_group signal_group = internal::SIGGROUP_SIGC; 01528 typedef T_signal signal_type; 01529 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 01530 typedef typename signal_type::slot_type slot_type; 01531 typedef typename signal_type::result_type result_type; 01532 typedef typename slot_type::arg1_type_ arg1_type_; 01533 typedef typename slot_type::arg2_type_ arg2_type_; 01534 typedef typename slot_type::arg3_type_ arg3_type_; 01535 typedef typename slot_type::arg4_type_ arg4_type_; 01536 typedef typename slot_type::arg5_type_ arg5_type_; 01537 typedef typename slot_type::arg6_type_ arg6_type_; 01538 typedef typename slot_type::arg7_type_ arg7_type_; 01539 01540 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 01541 01542 protected: 01543 typedef sigc::bound_const_mem_functor0<signal_source_base::hook, signal_source_base> make_slot_f1; 01544 typedef sigc::retype_return_functor<fp_sig_getter_type, make_slot_f1> make_slot_f2; 01545 typedef sigc::const_mem_functor0<signal_source_ptr, std::tr1::shared_ptr<signal_source_base> > make_slot_f3; 01546 typedef sigc::bind_functor<-1, make_slot_f3, std::tr1::shared_ptr<signal_source_base> > make_slot_f4; 01547 typedef sigc::compose1_functor<make_slot_f2, make_slot_f4> make_slot_composed1_functor_type; 01548 typedef sigc::const_mem_functor7<result_type, signal_type, arg1_type_, arg2_type_, arg3_type_, arg4_type_, arg5_type_, arg6_type_, arg7_type_> make_slot_emit_functor_type; 01549 typedef sigc::compose1_functor<make_slot_emit_functor_type, make_slot_composed1_functor_type> make_slot_composed2_functor_type; 01550 typedef SIGX_DISPATCH_WITH_FUNCTOR(make_slot_composed2_functor_type) make_slot_functor_type; 01551 01552 01553 public: 01557 signal_wrapper(): signal_wrapper_base() 01558 {} 01559 01565 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource) throw(): 01566 signal_wrapper_base(_A_disp, _A_sigsource) 01567 {} 01568 01595 template<typename T_functor> 01596 connection_wrapper connect(const T_functor& _A_func) const 01597 { 01598 return signal_wrapper_base::connect( 01599 _A_func, 01600 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect) 01601 ); 01602 } 01603 01606 template<sync_type I_sync> 01607 result_type emit(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5, arg6_type_ _A_a6, arg7_type_ _A_a7) const 01608 { 01609 return open_tunnel_with<I_sync>( 01610 // calls T_signal::*emit 01611 sigc::compose( 01612 sigc::mem_fun(&signal_type::emit), 01613 // getter for the T_signal 01614 sigc::compose( 01615 sigc::retype_return<fp_sig_getter_type>( 01616 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 01617 ), 01618 // this makes a copy of the shared signal source and thus 01619 // shares it within the tunnel functor ensuring the lifetime 01620 // of the shared signal source 01621 sigc::bind( 01622 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 01623 m_sigsource 01624 ) 01625 ) 01626 ), 01627 m_disp 01628 )(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6, _A_a7); 01629 } 01630 01633 result_type emit(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5, arg6_type_ _A_a6, arg7_type_ _A_a7) const 01634 { 01635 return emit<ASYNC>(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6, _A_a7); 01636 } 01637 01640 result_type emit_sync(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5, arg6_type_ _A_a6, arg7_type_ _A_a7) const 01641 { 01642 return emit<SYNC>(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6, _A_a7); 01643 } 01644 01647 result_type operator()(arg1_type_ _A_a1, arg2_type_ _A_a2, arg3_type_ _A_a3, arg4_type_ _A_a4, arg5_type_ _A_a5, arg6_type_ _A_a6, arg7_type_ _A_a7) const 01648 { 01649 return emit<ASYNC>(_A_a1, _A_a2, _A_a3, _A_a4, _A_a5, _A_a6, _A_a7); 01650 } 01651 01652 01655 template<sync_type I_sync> 01656 tunnel_functor<I_sync, make_slot_functor_type> make_slot() const 01657 { 01658 typedef tunnel_functor<I_sync, make_slot_functor_type> tunnel_funtor_type; 01659 return tunnel_funtor_type( 01660 dispatch_with( 01661 // calls T_signal::*emit 01662 sigc::compose( 01663 &signal_type::emit, 01664 // getter for the T_signal 01665 sigc::compose( 01666 sigc::retype_return<fp_sig_getter_type>( 01667 sigc::mem_fun(m_sigsource.get(), &signal_source_base::getter) 01668 ), 01669 sigc::bind( 01670 sigc::mem_fun(&std::tr1::shared_ptr<signal_source_base>::operator *), 01671 m_sigsource 01672 ) 01673 ) 01674 ), 01675 m_disp 01676 )); 01677 } 01678 01682 tunnel_functor<ASYNC, make_slot_functor_type> make_slot() const 01683 { 01684 return make_slot<ASYNC>(); 01685 } 01686 01690 tunnel_functor<SYNC, make_slot_functor_type> make_slot_sync() const 01691 { 01692 return make_slot<SYNC>(); 01693 } 01694 }; 01695 01696 01697 01698 01702 template<typename T_signal> 01703 // have to specialize the argument count explicitly because template arguments 01704 // can't be involved as template parameters in further template arguments 01705 class signal_wrapper<T_signal, internal::SIGGROUP_GLIB_PROXY, -1>: public signal_wrapper_base 01706 { 01707 public: 01708 static const int argument_count = internal::count_signal_arguments<T_signal>::value; 01709 static const internal::signal_group signal_group = internal::SIGGROUP_GLIB_PROXY; 01710 typedef T_signal signal_type; 01711 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 01712 typedef typename signal_type::SlotType slot_type; 01713 typedef typename signal_type::VoidSlotType void_slot_type; 01714 typedef typename slot_type::result_type result_type; 01715 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 01716 01717 01721 signal_wrapper(): signal_wrapper_base() 01722 {} 01723 01729 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource): 01730 signal_wrapper_base(_A_disp, _A_sigsource) 01731 {} 01732 01759 template<typename T_functor> 01760 connection_wrapper connect(const T_functor& _A_func, bool after = true) const 01761 { 01762 return signal_wrapper_base::connect( 01763 _A_func, 01764 sigc::bind( 01765 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect), 01766 after 01767 ) 01768 ); 01769 } 01770 01775 template<typename T_functor> 01776 connection_wrapper connect_notify(const T_functor& _A_func, bool after = false) const 01777 { 01778 return signal_wrapper_base::connect( 01779 _A_func, 01780 sigc::bind( 01781 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect_notify), 01782 after 01783 ) 01784 ); 01785 } 01786 }; 01787 01788 01792 template<> 01793 class signal_wrapper<Glib::SignalIdle>: public signal_wrapper_base 01794 { 01795 public: 01796 static const int argument_count = internal::count_signal_arguments<Glib::SignalIdle>::value; 01797 static const internal::signal_group signal_group = internal::SIGGROUP_IRRELEVANT; 01798 typedef Glib::SignalIdle signal_type; 01799 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 01800 typedef bool result_type; 01801 typedef sigc::slot<bool> slot_type; 01802 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 01803 01804 01808 signal_wrapper(): signal_wrapper_base() 01809 {} 01810 01816 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource): 01817 signal_wrapper_base(_A_disp, _A_sigsource) 01818 {} 01819 01846 template<typename T_functor> 01847 connection_wrapper connect(const T_functor& _A_func, int priority = Glib::PRIORITY_DEFAULT_IDLE) const 01848 { 01849 return signal_wrapper_base::connect( 01850 _A_func, 01851 sigc::bind( 01852 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect), 01853 priority 01854 ) 01855 ); 01856 } 01857 }; 01858 01859 01863 template<> 01864 class signal_wrapper<Glib::SignalTimeout>: public signal_wrapper_base 01865 { 01866 public: 01867 static const int argument_count = internal::count_signal_arguments<Glib::SignalTimeout>::value; 01868 static const internal::signal_group signal_group = internal::SIGGROUP_IRRELEVANT; 01869 typedef Glib::SignalTimeout signal_type; 01870 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 01871 typedef bool result_type; 01872 typedef sigc::slot<bool> slot_type; 01873 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 01874 01875 01879 signal_wrapper(): signal_wrapper_base() 01880 {} 01881 01887 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource): 01888 signal_wrapper_base(_A_disp, _A_sigsource) 01889 {} 01890 01917 template<typename T_functor> 01918 connection_wrapper connect(const T_functor& _A_func, unsigned int interval, 01919 int priority = Glib::PRIORITY_DEFAULT) const 01920 { 01921 return signal_wrapper_base::connect( 01922 _A_func, 01923 sigc::bind( 01924 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect), 01925 interval, priority 01926 ) 01927 ); 01928 } 01929 }; 01930 01931 01935 template<> 01936 class signal_wrapper<Glib::SignalIO>: public signal_wrapper_base 01937 { 01938 public: 01939 static const int argument_count = internal::count_signal_arguments<Glib::SignalIO>::value; 01940 static const internal::signal_group signal_group = internal::SIGGROUP_IRRELEVANT; 01941 typedef Glib::SignalIO signal_type; 01942 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 01943 typedef bool result_type; 01944 typedef sigc::slot<bool, Glib::IOCondition> slot_type; 01945 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 01946 01947 01951 signal_wrapper(): signal_wrapper_base() 01952 {} 01953 01959 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource): 01960 signal_wrapper_base(_A_disp, _A_sigsource) 01961 {} 01962 01989 template<typename T_functor> 01990 connection_wrapper connect(const T_functor& _A_func, Glib::IOCondition condition, 01991 int priority = Glib::PRIORITY_DEFAULT) const 01992 { 01993 return signal_wrapper_base::connect( 01994 _A_func, 01995 sigc::bind( 01996 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect), 01997 condition, priority 01998 ) 01999 ); 02000 } 02001 }; 02002 02003 02007 template<> 02008 class signal_wrapper<Glib::SignalChildWatch>: public signal_wrapper_base 02009 { 02010 public: 02011 static const int argument_count = internal::count_signal_arguments<Glib::SignalChildWatch>::value; 02012 static const internal::signal_group signal_group = internal::SIGGROUP_IRRELEVANT; 02013 typedef Glib::SignalChildWatch signal_type; 02014 typedef signal_wrapper<signal_type, signal_group, argument_count> this_type; 02015 typedef bool result_type; 02016 typedef sigc::slot<bool, GPid, int> slot_type; 02017 typedef signal_type (*fp_sig_getter_type)(signal_source_ptr); 02018 02019 02023 signal_wrapper(): signal_wrapper_base() 02024 {} 02025 02031 signal_wrapper(const shared_dispatchable& _A_disp, const std::tr1::shared_ptr<signal_source_base>& _A_sigsource): 02032 signal_wrapper_base(_A_disp, _A_sigsource) 02033 {} 02034 02061 template<typename T_functor> 02062 connection_wrapper connect(const T_functor& _A_func, GPid pid, 02063 int priority = Glib::PRIORITY_DEFAULT) const 02064 { 02065 return signal_wrapper_base::connect( 02066 _A_func, 02067 sigc::bind( 02068 sigc::ptr_fun(&typed_connection_handler<signal_type, signal_group>::connect), 02069 pid, priority 02070 ) 02071 ); 02072 } 02073 }; 02074 02075 02076 typedef signal_wrapper<Glib::SignalIdle> glib_signal_idle; 02077 typedef signal_wrapper<Glib::SignalTimeout> glib_signal_timeout; 02078 typedef signal_wrapper<Glib::SignalIO> glib_signal_io; 02079 typedef signal_wrapper<Glib::SignalChildWatch> glib_ignal_childwatch; 02080 02081 02082 } // namespace sigx 02083 02084 02085 #endif /* _SIGXMACROS_SIGNAL_WRAPPER_H_ */