sigx++  2.0.1
signal_source_func.h
Go to the documentation of this file.
1 #ifndef _SIGX_SIGNAL_SOURCE_FUNC_HPP_
2 #define _SIGX_SIGNAL_SOURCE_FUNC_HPP_
3 
4 /*
5  * Copyright 2005 Klaus Triendl
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the Free
19  * Software Foundation, 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #include <sigc++/functors/functor_trait.h>
24 #include <sigxconfig.h>
26 
27 
28 namespace sigx
29 {
30 
40 template<typename T_functor, typename T_signal>
42 {
44  typedef typename sigc::functor_trait<T_functor>::functor_type functor_type;
45 
46  signal_source_func(const T_functor& _A_func):
47  signal_source_base(reinterpret_cast<hook>(&self_type::get_signal)),
48  m_func(_A_func)
49  {}
50 
51  static T_signal get_signal(signal_source_ptr base)
52  {
53  self_type* const this_ = static_cast<self_type*>(base);
54  return this_->m_func();
55  }
56 
57 
59 };
60 
61 
62 } // namespace sigx
63 
64 
65 #endif // _SIGX_SIGNAL_SOURCE_FUNC_HPP_
signal_source_func< T_functor, T_signal > self_type
Definition: signal_source_func.h:43
static T_signal get_signal(signal_source_ptr base)
Definition: signal_source_func.h:51
signal_source_func(const T_functor &_A_func)
Definition: signal_source_func.h:46
Represents a source for any type of signal.
Definition: signal_source_base.h:38
functor_type m_func
Definition: signal_source_func.h:58
signal source is a signal of type T_signal returned by a functor.
Definition: signal_source_func.h:41
sigc::functor_trait< T_functor >::functor_type functor_type
Definition: signal_source_func.h:44
void(* hook)()
An untyped function pointer.
Definition: signal_source_base.h:42