membind.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
41 #ifndef HH_SENF_Utils_membind_
42 #define HH_SENF_Utils_membind_ 1
43 
44 // Custom includes
45 #include <boost/bind.hpp>
46 #include <boost/function.hpp>
47 #include <senf/config.hh>
48 
49 //-/////////////////////////////////////////////////////////////////////////////////////////////////
50 
71 #define SENF_FNP(ret, fn, args) \
72  static_cast<ret (*) args>(& fn)
73 
100 #define SENF_MEMFNP(ret, cls, fn, args) \
101  static_cast<ret (cls::*) args>(& cls :: fn)
102 
137 #define SENF_MEMBINDFNP(ret, cls, fn, args) \
138  senf::membind(SENF_MEMFNP(ret, cls, fn, args), this)
139 
140 namespace senf {
141 
142 #define scOBTYPE *
143 #include <senf/Utils/impl/membind.hh>
144 #undef scOBTYPE
145 
146 #define scOBTYPE &
147 #include <senf/Utils/impl/membind.hh>
148 #undef scOBTYPE
149 
150 #ifdef DOXYGEN
151 
153  //\{
154 
165  template <typename R, typename T, typename Args>
166  boost::function<R (Args)> membind(R (T::* fn)( Args ), T * ob);
167 
168  //\}
169 
170 #endif
171 
172 }
173 
174 //-/////////////////////////////////////////////////////////////////////////////////////////////////
175 //#include "membind.cci"
176 //#include "membind.ct"
177 //#include "membind.cti"
178 #endif
179 
180 
181 // Local Variables:
182 // mode: c++
183 // fill-column: 100
184 // c-file-style: "senf"
185 // indent-tabs-mode: nil
186 // ispell-local-dictionary: "american"
187 // compile-command: "scons -u test"
188 // comment-column: 40
189 // End:
boost::function< R(Args)> membind(R(T::*fn)(Args), T *ob)
Build bound member function object.