sigx++  2.0.1
auto_tunneler.h
Go to the documentation of this file.
1 #ifndef _SIGX_AUTO_TUNNELER_HPP_
2 #define _SIGX_AUTO_TUNNELER_HPP_
3 
4 /*
5  * Copyright 2005 Tim Mayberry
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 <sigxconfig.h>
24 #include <sigx/internal_types.h>
25 #include <sigx/tunnel_functor.h>
26 
27 
28 namespace sigx
29 {
30 
31  namespace internal
32  {
33 
39 template<typename T_functor,
40  bool I_istunneled = is_functor_tunneled<T_functor>::value>
42 {
43  static const bool is_tunneled = false;
45  static functor_type auto_open_tunnel(const T_functor& _A_func)
46  {
47  return open_tunnel(_A_func);
48  }
49 };
50 
55 template<typename T_functor>
56 struct auto_tunneler<T_functor, true>
57 {
58  static const bool is_tunneled = true;
59  typedef T_functor functor_type;
60  static const functor_type& auto_open_tunnel(const T_functor& _A_func)
61  {
62  return _A_func;
63  }
64 };
65 
66 
67  } // namespace internal
68 
69 } // namespace sigx
70 
71 
72 #endif // end file guard
finds out whether T_functor is tunneled, i.e. whether the functor chain contains a functor derived fr...
Definition: internal_types.h:99
static const functor_type & auto_open_tunnel(const T_functor &_A_func)
Definition: auto_tunneler.h:60
creates a tunnel on the given functor.
Definition: tunnel_functor.h:82
static functor_type auto_open_tunnel(const T_functor &_A_func)
Definition: auto_tunneler.h:45
Automatic creation of a tunnel functor if T_functor is not yet tunneled.
Definition: auto_tunneler.h:41
static const bool is_tunneled
Definition: auto_tunneler.h:43
tunnel_functor< ASYNC, T_functor > functor_type
Definition: auto_tunneler.h:44
Definition: auto_dispatchable.h:27
tunnel_functor< ASYNC, T_functor > open_tunnel(const T_functor &_A_func)
Opens an asynchronous tunnel on the specified functor.
Definition: tunnel_functor.h:529
T_functor functor_type
Definition: auto_tunneler.h:59