Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
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