4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at
9 // http://senf.berlios.de/license.html
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on,
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
15 // Software distributed under the License is distributed on an "AS IS" basis,
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
17 // for the specific language governing rights and limitations under the License.
19 // The Original Code is Fraunhofer FOKUS code.
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V.
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
26 // Stefan Bund <g0dil@berlios.de>
29 \brief Callback public header */
31 #ifndef HH_SENF_PPI_detail_Callback_
32 #define HH_SENF_PPI_detail_Callback_ 1
35 #include <boost/function.hpp>
37 //#include "Callback.mpp"
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
44 /** \brief Provide callbacks with a single optional argument
46 This helper implements callbacks with an optional single argument. In addition to
47 boost::function, this helper provides the following functionality:
49 \li It allows the callback to ignore the argument: A callable with no argument may be used
51 \li It allows to use member function pointers as callbacks. These will be automatically
52 bound to the \a owner argument of \ref make().
54 The callbacks follow the same restrictions as <a href="">Boost.Function</a>: They must be
55 either function, member function pointers or callable objects defining the appropriate
58 template <class Arg=void>
61 typedef boost::function<void (Arg)> type;
63 template <class Owner, class FnClass>
64 static type make(void (FnClass::* memfn )(), Owner & owner);
65 template <class Owner, class FnClass, class FnArg>
66 static type make(void (FnClass::* memfn )(FnArg arg), Owner & owner);
67 template <class Owner>
68 static type make(type callable, Owner &);
69 template <class Owner>
70 static type make(boost::function<void()> callable, Owner &);
78 typedef boost::function<void ()> type;
80 template <class Owner, class FnClass>
81 static type make(void (FnClass::* memfn )(), Owner & owner);
82 template <class Owner>
83 static type make(type callable, Owner &);
90 //-/////////////////////////////////////////////////////////////////////////////////////////////////
91 //#include "Callback.cci"
92 //#include "Callback.ct"
93 #include "Callback.cti"
100 // comment-column: 40
101 // c-file-style: "senf"
102 // indent-tabs-mode: nil
103 // ispell-local-dictionary: "american"
104 // compile-command: "scons -u ../test"