fw4spl
AutoBind.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 #ifndef __FWCOM_UTIL_AUTOBIND_HPP__
7 #define __FWCOM_UTIL_AUTOBIND_HPP__
8 
9 #include "fwCom/util/convert_function_type.hpp"
10 
11 #include <functional>
12 
16 namespace fwCom
17 {
18 
22 namespace util
23 {
24 
32 template< typename F, int PLACEHOLDERS_NB >
33 struct AutoBind;
34 
36 template< typename F >
37 struct AutoBind< F, 0 >
38 {
39  typedef typename convert_function_type< F >::type FunctionType;
40 
41  template< typename W, typename ... A >
42  static std::function< FunctionType > wrap( W f, A ... a );
43 
44 };
45 
47 template< typename F >
48 struct AutoBind< F, 1 >
49 {
50  typedef typename convert_function_type< F >::type FunctionType;
51 
52  template< typename W, typename ... A >
53  static std::function< FunctionType > wrap( W f, A ... a );
54 };
55 
57 template< typename F >
58 struct AutoBind< F, 2 >
59 {
60  typedef typename convert_function_type< F >::type FunctionType;
61 
62  template< typename W, typename ... A >
63  static std::function< FunctionType > wrap( W f, A ... a );
64 };
65 
67 template< typename F >
68 struct AutoBind< F, 3 >
69 {
70  typedef typename convert_function_type< F >::type FunctionType;
71 
72  template< typename W, typename ... A >
73  static std::function< FunctionType > wrap( W f, A ... a );
74 };
75 
77 template< typename F >
78 struct AutoBind< F, 4 >
79 {
80  typedef typename convert_function_type< F >::type FunctionType;
81 
82  template< typename W, typename ... A >
83  static std::function< FunctionType > wrap( W f, A ... a );
84 };
85 
87 template< typename F >
88 struct AutoBind< F, 5 >
89 {
90  typedef typename convert_function_type< F >::type FunctionType;
91 
92  template< typename W, typename ... A >
93  static std::function< FunctionType > wrap( W f, A ... a );
94 };
95 
97 template< typename F >
98 struct AutoBind< F, 6 >
99 {
100  typedef typename convert_function_type< F >::type FunctionType;
101 
102  template< typename W, typename ... A >
103  static std::function< FunctionType > wrap( W f, A ... a );
104 };
105 
107 template< typename F >
108 struct AutoBind< F, 7 >
109 {
110  typedef typename convert_function_type< F >::type FunctionType;
111 
112  template< typename W, typename ... A >
113  static std::function< FunctionType > wrap( W f, A ... a );
114 };
115 
117 template< typename F >
118 struct AutoBind< F, 8 >
119 {
120  typedef typename convert_function_type< F >::type FunctionType;
121 
122  template< typename W, typename ... A >
123  static std::function< FunctionType > wrap( W f, A ... a );
124 };
125 
127 template< typename F >
128 struct AutoBind< F, 9 >
129 {
130  typedef typename convert_function_type< F >::type FunctionType;
131 
132  template< typename W, typename ... A >
133  static std::function< FunctionType > wrap( W f, A ... a );
134 };
135 
144 template <typename F, typename ... A >
145 std::function< typename convert_function_type< F >::type > autobind(F f, A ... a);
146 
147 } //namespace util
148 
149 } //namespace fwCom
150 
151 #endif /* __FWCOM_UTIL_AUTOBIND_HPP__ */
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
Automatic binding class. This class allow to bind automatically a function/method with the right numb...
Definition: AutoBind.hpp:33
std::function< typename convert_function_type< F >::type > autobind(F f, A...a)
Automatic bind of given function.
Definition: AutoBind.hxx:119