InvokerBase.hpp
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: The SourceWorks  Tue Sep 7 00:55:18 CEST 2010  InvokerBase.hpp
00003 
00004                         InvokerBase.hpp -  description
00005                            -------------------
00006     begin                : Tue September 07 2010
00007     copyright            : (C) 2010 The SourceWorks
00008     email                : peter@thesourceworks.com
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_INVOKER_BASE_HPP
00040 #define ORO_INVOKER_BASE_HPP
00041 
00042 #include <boost/function.hpp>
00043 #include <boost/function_types/function_type.hpp>
00044 #include <boost/type_traits.hpp>
00045 #include "NA.hpp"
00046 #include "../SendHandle.hpp"
00047 #include "../rtt-fwd.hpp"
00048 
00049 namespace RTT
00050 {
00051     namespace internal
00052     {
00058         template<int, class F>
00059         struct InvokerBaseImpl;
00060 
00068         template<class F>
00069         struct InvokerBase
00070             : public InvokerBaseImpl<boost::function_traits<F>::arity, F>
00071         {};
00072 
00073         template<class F>
00074         struct InvokerBaseImpl<0,F>
00075         {
00076             typedef typename boost::function_traits<F>::result_type result_type;
00077             typedef typename boost::function_traits<F>::result_type result_reference;
00078             virtual ~InvokerBaseImpl() {}
00079             virtual SendHandle<F> send() = 0;
00080             virtual result_type call() = 0;
00081         };
00082 
00083         template<class F>
00084         struct InvokerBaseImpl<1,F>
00085         {
00086             typedef typename boost::function_traits<F>::result_type result_type;
00087             typedef typename boost::function<F>::arg1_type arg1_type;
00088             virtual ~InvokerBaseImpl() {}
00089             virtual result_type call(arg1_type a1) = 0;
00090             virtual SendHandle<F> send(arg1_type a1) = 0;
00091         };
00092 
00093         template<class F>
00094         struct InvokerBaseImpl<2,F>
00095         {
00096             typedef typename boost::function_traits<F>::result_type result_type;
00097             typedef typename boost::function<F>::arg1_type arg1_type;
00098             typedef typename boost::function<F>::arg2_type arg2_type;
00099             virtual ~InvokerBaseImpl() {}
00100             virtual result_type call(arg1_type a1, arg2_type a2) = 0;
00101             virtual SendHandle<F> send(arg1_type a1, arg2_type a2) = 0;
00102         };
00103 
00104         template<class F>
00105         struct InvokerBaseImpl<3,F>
00106         {
00107             typedef typename boost::function_traits<F>::result_type result_type;
00108             typedef typename boost::function<F>::arg1_type arg1_type;
00109             typedef typename boost::function<F>::arg2_type arg2_type;
00110             typedef typename boost::function<F>::arg3_type arg3_type;
00111             virtual ~InvokerBaseImpl() {}
00112             virtual result_type call(arg1_type a1, arg2_type a2, arg3_type a3) = 0;
00113             virtual SendHandle<F> send(arg1_type a1, arg2_type a2, arg3_type a3) = 0;
00114         };
00115 
00116         template<class F>
00117         struct InvokerBaseImpl<4,F>
00118         {
00119             typedef typename boost::function_traits<F>::result_type result_type;
00120             typedef typename boost::function<F>::arg1_type arg1_type;
00121             typedef typename boost::function<F>::arg2_type arg2_type;
00122             typedef typename boost::function<F>::arg3_type arg3_type;
00123             typedef typename boost::function<F>::arg4_type arg4_type;
00124             virtual ~InvokerBaseImpl() {}
00125             virtual result_type call(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) = 0;
00126             virtual SendHandle<F> send(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) = 0;
00127         };
00128 
00129         template<class F>
00130         struct InvokerBaseImpl<5,F>
00131         {
00132             typedef typename boost::function_traits<F>::result_type result_type;
00133             typedef typename boost::function<F>::arg1_type arg1_type;
00134             typedef typename boost::function<F>::arg2_type arg2_type;
00135             typedef typename boost::function<F>::arg3_type arg3_type;
00136             typedef typename boost::function<F>::arg4_type arg4_type;
00137             typedef typename boost::function<F>::arg5_type arg5_type;
00138             virtual ~InvokerBaseImpl() {}
00139             virtual result_type call(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) = 0;
00140             virtual SendHandle<F> send(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) = 0;
00141         };
00142 
00143         template<class F>
00144         struct InvokerBaseImpl<6,F>
00145         {
00146             typedef typename boost::function_traits<F>::result_type result_type;
00147             typedef typename boost::function<F>::arg1_type arg1_type;
00148             typedef typename boost::function<F>::arg2_type arg2_type;
00149             typedef typename boost::function<F>::arg3_type arg3_type;
00150             typedef typename boost::function<F>::arg4_type arg4_type;
00151             typedef typename boost::function<F>::arg5_type arg5_type;
00152             typedef typename boost::function<F>::arg6_type arg6_type;
00153             virtual ~InvokerBaseImpl() {}
00154             virtual result_type call(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) = 0;
00155             virtual SendHandle<F> send(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) = 0;
00156         };
00157 
00158         template<class F>
00159         struct InvokerBaseImpl<7,F>
00160         {
00161             typedef typename boost::function_traits<F>::result_type result_type;
00162             typedef typename boost::function<F>::arg1_type arg1_type;
00163             typedef typename boost::function<F>::arg2_type arg2_type;
00164             typedef typename boost::function<F>::arg3_type arg3_type;
00165             typedef typename boost::function<F>::arg4_type arg4_type;
00166             typedef typename boost::function<F>::arg5_type arg5_type;
00167             typedef typename boost::function<F>::arg6_type arg6_type;
00168             typedef typename boost::function<F>::arg7_type arg7_type;
00169             virtual ~InvokerBaseImpl() {}
00170             virtual result_type call(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6, arg7_type a7) = 0;
00171             virtual SendHandle<F> send(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6, arg7_type a7) = 0;
00172         };
00173    }
00174 }
00175 #endif


rtt
Author(s): RTT Developers
autogenerated on Mon Oct 6 2014 03:13:36