signal_f.h

Go to the documentation of this file.
00001 #ifndef _SIGX_SIGNAL_F_HPP_
00002 #define _SIGX_SIGNAL_F_HPP_
00003 
00004 /*
00005  * Copyright 2006 Klaus Triendl
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public
00018  * License along with this library; if not, write to the Free 
00019  * Software Foundation, 51 Franklin Street, Fifth Floor, 
00020  * Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #include <sigc++/signal.h>
00024 #include <sigxconfig.h>
00025 #include <sigx/fwddecl.h>
00026 #include <sigx/tunnel_functor.h>
00027 #include <sigx/connection_handler.h>
00028 #include <sigx/signal_source_base.h>
00029 #include <sigx/signal_source_threadprivate.h>
00030 #include <sigx/signal_source_obj_mem.h>
00031 #include <sigx/signal_source_func.h>
00032 #include <sigx/signal_wrapper.h>
00033 #include <sigx/signal_f_base.h>
00034 
00035 
00036 namespace sigx
00037 {
00038 
00120 template<typename T_signal>
00121 class signal_f: protected signal_f_base
00122 {
00123 public:
00124     typedef T_signal signal_type;
00125     typedef signal_f<signal_type> self_type;
00126 
00133     template<typename T_threadpriv>
00134     signal_f(const shared_dispatchable& _A_disp, Glib::Private<T_threadpriv>& _A_priv, signal_type T_threadpriv::*_A_sig): 
00135         signal_f_base(_A_disp, 
00136             new signal_source_threadprivate<T_threadpriv, T_signal>(_A_priv, _A_sig))
00137     {}
00138 
00145     template<typename T_dispatchable>
00146     signal_f(T_dispatchable& _A_obj, signal_type T_dispatchable::*_A_sig): 
00147         signal_f_base(_A_obj, 
00148             new signal_source_obj_mem<T_dispatchable, signal_type>(&_A_obj, _A_sig))
00149     {}
00150 
00157     template<typename T_obj>
00158     signal_f(const shared_dispatchable& _A_disp, T_obj& _A_obj, signal_type T_obj::*_A_sig): 
00159         signal_f_base(_A_disp, 
00160             new signal_source_obj_mem<T_obj, signal_type>(&_A_obj, _A_sig))
00161     {}
00162 
00170     template<typename T_obj>
00171     signal_f(const shared_dispatchable& _A_disp, sigc::const_reference_wrapper<T_obj*> _A_obj, signal_type T_obj::*_A_sig): 
00172         signal_f_base(_A_disp, 
00173             new signal_source_obj_mem<const T_obj, signal_type>(sigc::unwrap(_A_obj), _A_sig))
00174     {}
00175     template<typename T_obj>
00176     signal_f(const shared_dispatchable& _A_disp, sigc::reference_wrapper<T_obj*> _A_obj, signal_type T_obj::*_A_sig): 
00177         signal_f_base(_A_disp, 
00178             new signal_source_obj_mem<T_obj, signal_type>(sigc::unwrap(_A_obj), _A_sig))
00179     {}
00180 
00190     template<typename T_obj, typename T_functor>
00191     signal_f(const shared_dispatchable& _A_disp, sigc::const_reference_wrapper<T_obj*> _A_obj, const T_functor& _A_sig_func): 
00192         signal_f_base(_A_disp, 
00193             new signal_source_pobj_mem_fun<const T_obj, T_functor, signal_type>(sigc::unwrap(_A_obj), _A_sig_func))
00194     {}
00195     template<typename T_obj, typename T_functor>
00196     signal_f(const shared_dispatchable& _A_disp, sigc::reference_wrapper<T_obj*> _A_obj, const T_functor& _A_sig_func): 
00197         signal_f_base(_A_disp, 
00198             new signal_source_pobj_mem_fun<T_obj, T_functor, signal_type>(sigc::unwrap(_A_obj), _A_sig_func))
00199     {}
00200 
00206     template<typename T_functor>
00207     signal_f(const shared_dispatchable& _A_disp, const T_functor& _A_sig_func): 
00208         signal_f_base(_A_disp, 
00209             new signal_source_func<T_functor, signal_type>(_A_sig_func))
00210     {}
00211 
00218     template<typename T_functor>
00219     explicit signal_f(const T_functor& _A_sig_func): 
00220         signal_f_base(internal::dispatchable_constraint<T_functor>::find_dispatchable(_A_sig_func), 
00221             new signal_source_func<T_functor, signal_type>(_A_sig_func))
00222     {}
00223 
00227     signal_wrapper<signal_type> operator ()() const
00228     {
00229         return signal_wrapper<signal_type>(m_disp, m_sigsource);
00230     }
00231 };
00232 
00233 
00234 } // namespace sigx
00235 
00236 
00237 #endif // end file guard

Generated on Mon Aug 3 17:35:08 2009 for sigx++ by  doxygen 1.5.9