CollectBase.hpp
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: The SourceWorks  Tue Sep 7 00:55:18 CEST 2010  CollectBase.hpp
00003 
00004                         CollectBase.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_COLLECT_BASE_HPP
00040 #define ORO_COLLECT_BASE_HPP
00041 
00042 #include "CollectSignature.hpp"
00043 #include "../SendStatus.hpp"
00044 #include "ReturnBase.hpp"
00045 #include <boost/function.hpp>
00046 
00047 namespace RTT
00048 {
00049     namespace internal
00050     {
00059         template<int, class Ft>
00060         struct CollectBaseImpl;
00061 
00068         template<class F>
00069         struct CollectBase
00070             : public CollectBaseImpl< boost::function_traits<typename CollectType<F>::Ft>::arity, typename CollectType<F>::Ft >,
00071               public ReturnBaseImpl< boost::function_traits<F>::arity, F>
00072         {
00073             typedef boost::shared_ptr<CollectBase<F> > shared_ptr;
00074         };
00075 
00076         template<class Ft>
00077         struct CollectBaseImpl<0,Ft>
00078         {
00079             virtual ~CollectBaseImpl() {}
00080 
00085             virtual SendStatus collect() = 0;
00086 
00087             virtual SendStatus collectIfDone() = 0;
00088         };
00089 
00090         template<class Ft>
00091         struct CollectBaseImpl<1,Ft>
00092         {
00093             typedef typename boost::function<Ft>::result_type result_type;
00094             typedef typename boost::function<Ft>::arg1_type arg1_type;
00095             virtual ~CollectBaseImpl() {}
00096 
00101             virtual SendStatus collect() = 0;
00102 
00108             virtual SendStatus collect(arg1_type a1) = 0;
00109 
00110             virtual SendStatus collectIfDone(arg1_type a1) = 0;
00111         };
00112 
00113         template<class Ft>
00114         struct CollectBaseImpl<2,Ft>
00115         {
00116             typedef typename boost::function<Ft>::arg1_type arg1_type;
00117             typedef typename boost::function<Ft>::arg2_type arg2_type;
00118             virtual ~CollectBaseImpl() {}
00119 
00124             virtual SendStatus collect() = 0;
00130             virtual SendStatus collect(arg1_type a1, arg2_type a2) = 0;
00131             virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2) = 0;
00132         };
00133 
00134         template<class Ft>
00135         struct CollectBaseImpl<3,Ft>
00136         {
00137             typedef typename boost::function<Ft>::arg1_type arg1_type;
00138             typedef typename boost::function<Ft>::arg2_type arg2_type;
00139             typedef typename boost::function<Ft>::arg3_type arg3_type;
00140             virtual ~CollectBaseImpl() {}
00141 
00146             virtual SendStatus collect() = 0;
00152             virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3) = 0;
00153             virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3) = 0;
00154         };
00155 
00156         template<class Ft>
00157         struct CollectBaseImpl<4,Ft>
00158         {
00159             typedef typename boost::function<Ft>::arg1_type arg1_type;
00160             typedef typename boost::function<Ft>::arg2_type arg2_type;
00161             typedef typename boost::function<Ft>::arg3_type arg3_type;
00162             typedef typename boost::function<Ft>::arg4_type arg4_type;
00163             virtual ~CollectBaseImpl() {}
00164 
00169             virtual SendStatus collect() = 0;
00175             virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) = 0;
00176             virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) = 0;
00177         };
00178 
00179         template<class Ft>
00180         struct CollectBaseImpl<5,Ft>
00181         {
00182             typedef typename boost::function<Ft>::arg1_type arg1_type;
00183             typedef typename boost::function<Ft>::arg2_type arg2_type;
00184             typedef typename boost::function<Ft>::arg3_type arg3_type;
00185             typedef typename boost::function<Ft>::arg4_type arg4_type;
00186             typedef typename boost::function<Ft>::arg5_type arg5_type;
00187             virtual ~CollectBaseImpl() {}
00188 
00193             virtual SendStatus collect() = 0;
00199             virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) = 0;
00200             virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) = 0;
00201         };
00202 
00203         template<class Ft>
00204         struct CollectBaseImpl<6,Ft>
00205         {
00206             typedef typename boost::function<Ft>::arg1_type arg1_type;
00207             typedef typename boost::function<Ft>::arg2_type arg2_type;
00208             typedef typename boost::function<Ft>::arg3_type arg3_type;
00209             typedef typename boost::function<Ft>::arg4_type arg4_type;
00210             typedef typename boost::function<Ft>::arg5_type arg5_type;
00211             typedef typename boost::function<Ft>::arg6_type arg6_type;
00212             virtual ~CollectBaseImpl() {}
00213 
00218             virtual SendStatus collect() = 0;
00224             virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) = 0;
00225             virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) = 0;
00226         };
00227     }
00228 }
00229 #endif


rtt
Author(s): RTT Developers
autogenerated on Fri Sep 9 2016 04:01:50