Orocos Real-Time Toolkit  2.5.0
Return.hpp
00001 /***************************************************************************
00002   tag: The SourceWorks  Tue Sep 7 00:55:18 CEST 2010  Return.hpp
00003 
00004                         Return.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_RETURN_HPP
00040 #define ORO_RETURN_HPP
00041 
00042 #include "Collect.hpp"
00043 
00044 namespace RTT
00045 {
00046     namespace internal
00047     {
00052         template<int, class F, class BaseImpl>
00053         struct ReturnImpl;
00054 
00055         template<class F, class BaseImpl>
00056         struct Return
00057             : public ReturnImpl<boost::function_traits<F>::arity,F,BaseImpl>
00058         {};
00059 
00060 
00061         template<class F, class BaseImpl>
00062         struct ReturnImpl<0,F, BaseImpl>
00063             : public Collect<F,BaseImpl>
00064         {
00065             virtual ~ReturnImpl() {}
00066 
00067         };
00068 
00069         template<class F, class BaseImpl>
00070         struct ReturnImpl<1,F,BaseImpl>
00071             : public Collect<F,BaseImpl>
00072         {
00073             typedef typename boost::function<F>::result_type result_type;
00074             typedef typename boost::function<F>::arg1_type arg1_type;
00075             virtual ~ReturnImpl() {}
00076 
00077         };
00078 
00079         template<class F, class BaseImpl>
00080         struct ReturnImpl<2,F,BaseImpl>
00081             : public Collect<F,BaseImpl>
00082         {
00083             typedef typename boost::function<F>::arg1_type arg1_type;
00084             typedef typename boost::function<F>::arg2_type arg2_type;
00085             virtual ~ReturnImpl() {}
00086 
00087         };
00088 
00089         template<class F, class BaseImpl>
00090         struct ReturnImpl<3,F,BaseImpl>
00091             : public Collect<F,BaseImpl>
00092         {
00093             typedef typename boost::function<F>::arg1_type arg1_type;
00094             typedef typename boost::function<F>::arg2_type arg2_type;
00095             typedef typename boost::function<F>::arg3_type arg3_type;
00096             virtual ~ReturnImpl() {}
00097 
00098         };
00099 
00100         template<class F, class BaseImpl>
00101         struct ReturnImpl<4,F,BaseImpl>
00102             : public Collect<F,BaseImpl>
00103         {
00104             typedef typename boost::function<F>::arg1_type arg1_type;
00105             typedef typename boost::function<F>::arg2_type arg2_type;
00106             typedef typename boost::function<F>::arg3_type arg3_type;
00107             typedef typename boost::function<F>::arg4_type arg4_type;
00108             virtual ~ReturnImpl() {}
00109 
00110         };
00111 
00112         template<class F, class BaseImpl>
00113         struct ReturnImpl<5,F,BaseImpl>
00114             : public Collect<F,BaseImpl>
00115         {
00116             typedef typename boost::function<F>::arg1_type arg1_type;
00117             typedef typename boost::function<F>::arg2_type arg2_type;
00118             typedef typename boost::function<F>::arg3_type arg3_type;
00119             typedef typename boost::function<F>::arg4_type arg4_type;
00120             typedef typename boost::function<F>::arg5_type arg5_type;
00121             virtual ~ReturnImpl() {}
00122 
00123         };
00124 
00125         template<class F, class BaseImpl>
00126         struct ReturnImpl<6,F,BaseImpl>
00127             : public Collect<F,BaseImpl>
00128         {
00129             typedef typename boost::function<F>::arg1_type arg1_type;
00130             typedef typename boost::function<F>::arg2_type arg2_type;
00131             typedef typename boost::function<F>::arg3_type arg3_type;
00132             typedef typename boost::function<F>::arg4_type arg4_type;
00133             typedef typename boost::function<F>::arg5_type arg5_type;
00134             typedef typename boost::function<F>::arg6_type arg6_type;
00135             virtual ~ReturnImpl() {}
00136 
00137         };
00138 
00139         template<class F, class BaseImpl>
00140         struct ReturnImpl<7,F,BaseImpl>
00141             : public Collect<F,BaseImpl>
00142         {
00143             typedef typename boost::function<F>::arg1_type arg1_type;
00144             typedef typename boost::function<F>::arg2_type arg2_type;
00145             typedef typename boost::function<F>::arg3_type arg3_type;
00146             typedef typename boost::function<F>::arg4_type arg4_type;
00147             typedef typename boost::function<F>::arg5_type arg5_type;
00148             typedef typename boost::function<F>::arg6_type arg6_type;
00149             typedef typename boost::function<F>::arg7_type arg7_type;
00150             virtual ~ReturnImpl() {}
00151 
00152         };
00153     }
00154 }
00155 #endif