Callback.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 
17 #ifndef HH_SENF_PPI_detail_Callback_
18 #define HH_SENF_PPI_detail_Callback_ 1
19 
20 // Custom includes
21 #include <boost/function.hpp>
22 
23 //#include "Callback.mpp"
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 
26 namespace senf {
27 namespace ppi {
28 namespace detail {
29 
44  template <class Arg=void>
45  struct Callback
46  {
47  typedef boost::function<void (Arg)> type;
48 
49  template <class Owner, class FnClass>
50  static type make(void (FnClass::* memfn )(), Owner & owner);
51  template <class Owner, class FnClass, class FnArg>
52  static type make(void (FnClass::* memfn )(FnArg arg), Owner & owner);
53  template <class Owner>
54  static type make(type callable, Owner &);
55  template <class Owner>
56  static type make(boost::function<void()> callable, Owner &);
57  };
58 
59 #ifndef DOXYGEN
60 
61  template <>
62  struct Callback<void>
63  {
64  typedef boost::function<void ()> type;
65 
66  template <class Owner, class FnClass>
67  static type make(void (FnClass::* memfn )(), Owner & owner);
68  template <class Owner>
69  static type make(type callable, Owner &);
70  };
71 
72 #endif
73 
74 }}}
75 
76 //-/////////////////////////////////////////////////////////////////////////////////////////////////
77 //#include "Callback.cci"
78 //#include "Callback.ct"
79 #include "Callback.cti"
80 #endif
81 
82 
83 // Local Variables:
84 // mode: c++
85 // fill-column: 100
86 // comment-column: 40
87 // c-file-style: "senf"
88 // indent-tabs-mode: nil
89 // ispell-local-dictionary: "american"
90 // compile-command: "scons -u ../test"
91 // End:
Provide callbacks with a single optional argument.
Definition: Callback.hh:45
boost::function< void(Arg)> type
Definition: Callback.hh:47
static type make(void(FnClass::*memfn)(), Owner &owner)