sigx++  2.0.1
signal_source_threadprivate.h
Go to the documentation of this file.
1 #ifndef _SIGX_SIGNAL_SOURCE_THREADPRIVATE_HPP_
2 #define _SIGX_SIGNAL_SOURCE_THREADPRIVATE_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 <glibmm/thread.h> // Glib::Private
24 #include <sigxconfig.h>
26 
27 
28 namespace sigx
29 {
30 
34 template<typename T_threadpriv, typename T_signal>
36 {
38  typedef T_signal T_threadpriv::*typed_signal_ptr;
39 
40  signal_source_threadprivate(Glib::Private<T_threadpriv>& _A_priv, typed_signal_ptr _A_sig):
41  signal_source_base(reinterpret_cast<hook>(&self_type::get_signal)),
42  m_threadpriv(_A_priv),
43  m_sig(_A_sig)
44  {}
45 
46  static T_signal get_signal(signal_source_ptr base)
47  {
48  self_type* this_ = static_cast<self_type*>(base);
49  const typed_signal_ptr sig = this_->m_sig;
50  return this_->m_threadpriv.get()->*sig;
51  }
52 
53  Glib::Private<T_threadpriv>& m_threadpriv;
55 };
56 
57 
58 } // namespace sigx
59 
60 
61 #endif // _SIGX_SIGNAL_SOURCE_THREADPRIVATE_HPP_
static T_signal get_signal(signal_source_ptr base)
Definition: signal_source_threadprivate.h:46
signal source is a signal of type T_signal from a thread private data object's member.
Definition: signal_source_threadprivate.h:35
T_signal T_threadpriv::* typed_signal_ptr
Definition: signal_source_threadprivate.h:38
Represents a source for any type of signal.
Definition: signal_source_base.h:38
typed_signal_ptr m_sig
Definition: signal_source_threadprivate.h:54
signal_source_threadprivate< T_threadpriv, T_signal > self_type
Definition: signal_source_threadprivate.h:37
void(* hook)()
An untyped function pointer.
Definition: signal_source_base.h:42
signal_source_threadprivate(Glib::Private< T_threadpriv > &_A_priv, typed_signal_ptr _A_sig)
Definition: signal_source_threadprivate.h:40
Glib::Private< T_threadpriv > & m_threadpriv
Definition: signal_source_threadprivate.h:53