OperationCallerBinder.hpp
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: FMTC  do nov 2 13:06:12 CET 2006  BindStorage.hpp
00003 
00004                         BindStorage.hpp -  description
00005                            -------------------
00006     begin                : do november 02 2006
00007     copyright            : (C) 2006 FMTC
00008     email                : peter.soetens@fmtc.be
00009 
00010  ***************************************************************************
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU General Public                   *
00013  *   License as published by the Free Software Foundation;                 *
00014  *   version 2 of the License.                                             *
00015  *                                                                         *
00016  *   As a special exception, you may use this file as part of a free       *
00017  *   software library without restriction.  Specifically, if other files   *
00018  *   instantiate templates or use macros or inline functions from this     *
00019  *   file, or you compile this file and link it with other files to        *
00020  *   produce an executable, this file does not by itself cause the         *
00021  *   resulting executable to be covered by the GNU General Public          *
00022  *   License.  This exception does not however invalidate any other        *
00023  *   reasons why the executable file might be covered by the GNU General   *
00024  *   Public License.                                                       *
00025  *                                                                         *
00026  *   This library is distributed in the hope that it will be useful,       *
00027  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00028  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00029  *   Lesser General Public License for more details.                       *
00030  *                                                                         *
00031  *   You should have received a copy of the GNU General Public             *
00032  *   License along with this library; if not, write to the Free Software   *
00033  *   Foundation, Inc., 59 Temple Place,                                    *
00034  *   Suite 330, Boston, MA  02111-1307  USA                                *
00035  *                                                                         *
00036  ***************************************************************************/
00037 
00038 
00039 #ifndef ORO_TASK_METHOD_BINDER_HPP
00040 #define ORO_TASK_METHOD_BINDER_HPP
00041 
00042 #include <boost/function.hpp>
00043 #include <boost/type_traits/function_traits.hpp>
00044 #include <boost/bind.hpp>
00045 #include <boost/mem_fn.hpp>
00046 
00047 namespace RTT
00048 {
00049     namespace internal
00050     {
00051         template<int, class F>
00052         struct OperationCallerBinderImpl;
00053 
00054         template<class F>
00055         struct OperationCallerBinderImpl<0,F>
00056         {
00057             template<class M, class O>
00058             boost::function<F> operator()(M m, O o) {
00059                 return boost::bind( boost::mem_fn(m), o );
00060             }
00061         };
00062 
00063         template<class F>
00064         struct OperationCallerBinderImpl<1,F>
00065         {
00066             template<class M, class O>
00067             boost::function<F> operator()(M m, O o) {
00068                 return boost::bind( boost::mem_fn(m), o, ::_1 );
00069             }
00070         };
00071 
00072         template<class F>
00073         struct OperationCallerBinderImpl<2,F>
00074         {
00075             template<class M, class O>
00076             boost::function<F> operator()(M m, O o) {
00077                 return boost::bind( boost::mem_fn(m), o, ::_1, ::_2 );
00078             }
00079         };
00080 
00081         template<class F>
00082         struct OperationCallerBinderImpl<3,F>
00083         {
00084             template<class M, class O>
00085             boost::function<F> operator()(M m, O o) {
00086                 return boost::bind( boost::mem_fn(m), o, ::_1, ::_2, ::_3 );
00087             }
00088         };
00089 
00090         template<class F>
00091         struct OperationCallerBinderImpl<4,F>
00092         {
00093             template<class M, class O>
00094             boost::function<F> operator()(M m, O o) {
00095                 return boost::bind( boost::mem_fn(m), o, ::_1, ::_2, ::_3, ::_4 );
00096             }
00097         };
00098 
00099         template<class F>
00100         struct OperationCallerBinderImpl<5,F>
00101         {
00102             template<class M, class O>
00103             boost::function<F> operator()(M m, O o) {
00104                 return boost::bind( boost::mem_fn(m), o, ::_1, ::_2, ::_3, ::_4, ::_5 );
00105             }
00106         };
00107 
00108         template<class F>
00109         struct OperationCallerBinderImpl<6,F>
00110         {
00111             template<class M, class O>
00112             boost::function<F> operator()(M m, O o) {
00113                 return boost::bind( boost::mem_fn(m), o, ::_1, ::_2, ::_3, ::_4, ::_5, ::_6 );
00114             }
00115         };
00116 
00117         template<class F>
00118         struct OperationCallerBinderImpl<7,F>
00119         {
00120             template<class M, class O>
00121             boost::function<F> operator()(M m, O o) {
00122                 return boost::bind( boost::mem_fn(m), o, ::_1, ::_2, ::_3, ::_4, ::_5, ::_6, ::_7 );
00123             }
00124         };
00125 
00126         template<class F>
00127         struct OperationCallerBinderImpl<8,F>
00128         {
00129             template<class M, class O>
00130             boost::function<F> operator()(M m, O o) {
00131                 return boost::bind( boost::mem_fn(m), o, ::_1, ::_2, ::_3, ::_4, ::_5, ::_6, ::_7, ::_8 );
00132             }
00133         };
00134 
00135         template<class F>
00136         struct OperationCallerBinderImpl<9,F>
00137         {
00138             template<class M, class O>
00139             boost::function<F> operator()(M m, O o) {
00140                 return boost::bind( boost::mem_fn(m), o, ::_1, ::_2, ::_3, ::_4, ::_5, ::_6, ::_7, ::_8, ::_9 );
00141             }
00142         };
00143 
00155         template<class F>
00156         struct OperationCallerBinder
00157             : public OperationCallerBinderImpl<boost::function_traits<F>::arity, F>
00158         {};
00159     }
00160 }
00161 #endif


rtt
Author(s): RTT Developers
autogenerated on Sat Jun 8 2019 18:46:16