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_HPP
00040 #define ORO_COLLECT_HPP
00041 
00042 #include "CollectSignature.hpp"
00043 #include "../SendStatus.hpp"
00044 #include <boost/function.hpp>
00045 #include <boost/type_traits.hpp>
00046 
00047 namespace RTT
00048 {
00049     namespace internal
00050     {
00051         template<int, class Ft, class BaseImpl>
00052         struct CollectImpl;
00053 
00059         template<class F, class BaseImpl>
00060         struct Collect
00061             : public CollectImpl< boost::function_traits< typename CollectType<F>::Ft >::arity, typename CollectType<F>::Ft, BaseImpl >
00062         {
00063             typedef typename boost::function_traits< F >::result_type result_type;
00064             using CollectImpl< boost::function_traits< typename CollectType<F>::Ft >::arity, typename CollectType<F>::Ft, BaseImpl >::collectIfDone;
00065 
00066                 SendStatus collect()
00067                 {
00068                     return BaseImpl::collect_impl();
00069                 }
00070 
00071                 SendStatus collectIfDone()
00072                 {
00073                     return BaseImpl::collectIfDone_impl();
00074                 }
00075 
00076             result_type ret()
00077             {
00078                 return BaseImpl::ret_impl();
00079             }
00080 
00081         };
00082 
00083         template<class Ft, class BaseImpl>
00084         struct CollectImpl<0,Ft,BaseImpl>
00085             : public BaseImpl
00086         {
00087             virtual ~CollectImpl() {}
00088         };
00089 
00090         template<class Ft, class BaseImpl>
00091         struct CollectImpl<1,Ft,BaseImpl>
00092         : public BaseImpl
00093         {
00094             typedef typename boost::function<Ft>::arg1_type arg1_type;
00095             virtual ~CollectImpl() {}
00096 
00101             virtual SendStatus collect()
00102             {
00103                 return BaseImpl::collect_impl();
00104             }
00110             virtual SendStatus collect(arg1_type a1)
00111             {
00112                 return BaseImpl::collect_impl(a1);
00113             }
00114             virtual SendStatus collectIfDone(arg1_type a1)
00115             {
00116                 return BaseImpl::collectIfDone_impl(a1);
00117             }
00118         };
00119 
00120         template<class Ft, class BaseImpl>
00121         struct CollectImpl<2,Ft,BaseImpl>
00122         : public BaseImpl
00123         {
00124             typedef typename boost::function<Ft>::arg1_type arg1_type;
00125             typedef typename boost::function<Ft>::arg2_type arg2_type;
00126             virtual ~CollectImpl() {}
00127 
00132             virtual SendStatus collect()
00133             {
00134                 return BaseImpl::collect_impl();
00135             }
00141             virtual SendStatus collect(arg1_type a1, arg2_type a2)
00142             {
00143                 return BaseImpl::collect_impl(a1,a2);
00144             }
00145             virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2)
00146             {
00147                 return BaseImpl::collectIfDone_impl(a1,a2);
00148             }
00149         };
00150 
00151         template<class Ft, class BaseImpl>
00152         struct CollectImpl<3,Ft,BaseImpl>
00153         : public BaseImpl
00154         {
00155             typedef typename boost::function<Ft>::arg1_type arg1_type;
00156             typedef typename boost::function<Ft>::arg2_type arg2_type;
00157             typedef typename boost::function<Ft>::arg3_type arg3_type;
00158             virtual ~CollectImpl() {}
00159 
00164             virtual SendStatus collect()
00165             {
00166                 return BaseImpl::collect_impl();
00167             }
00173             virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3)
00174             {
00175                 return BaseImpl::collect_impl(a1,a2,a3);
00176             }
00177             virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3)
00178             {
00179                 return BaseImpl::collectIfDone_impl(a1,a2,a3);
00180             }
00181         };
00182 
00183         template<class Ft, class BaseImpl>
00184         struct CollectImpl<4,Ft,BaseImpl>
00185         : public BaseImpl
00186         {
00187             typedef typename boost::function<Ft>::arg1_type arg1_type;
00188             typedef typename boost::function<Ft>::arg2_type arg2_type;
00189             typedef typename boost::function<Ft>::arg3_type arg3_type;
00190             typedef typename boost::function<Ft>::arg4_type arg4_type;
00191             virtual ~CollectImpl() {}
00192 
00197             virtual SendStatus collect()
00198             {
00199                 return BaseImpl::collect_impl();
00200             }
00206             virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
00207             {
00208                 return BaseImpl::collect_impl(a1,a2,a3,a4);
00209             }
00210             virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
00211             {
00212                 return BaseImpl::collectIfDone_impl(a1,a2,a3,a4);
00213             }
00214         };
00215 
00216         template<class Ft, class BaseImpl>
00217         struct CollectImpl<6,Ft,BaseImpl>
00218         : public BaseImpl
00219         {
00220             typedef typename boost::function<Ft>::arg1_type arg1_type;
00221             typedef typename boost::function<Ft>::arg2_type arg2_type;
00222             typedef typename boost::function<Ft>::arg3_type arg3_type;
00223             typedef typename boost::function<Ft>::arg4_type arg4_type;
00224             typedef typename boost::function<Ft>::arg5_type arg5_type;
00225             typedef typename boost::function<Ft>::arg6_type arg6_type;
00226             virtual ~CollectImpl() {}
00227 
00232             virtual SendStatus collect()
00233             {
00234                 return BaseImpl::collect_impl();
00235             }
00241             virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6)
00242             {
00243                 return BaseImpl::collect_impl(a1,a2,a3,a4,a5,a6);
00244             }
00245             virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6)
00246             {
00247                 return BaseImpl::collectIfDone_impl(a1,a2,a3,a4,a5,a6);
00248             }
00249         };
00250 
00251         template<class Ft, class BaseImpl>
00252         struct CollectImpl<5,Ft,BaseImpl>
00253         : public BaseImpl
00254         {
00255             typedef typename boost::function<Ft>::arg1_type arg1_type;
00256             typedef typename boost::function<Ft>::arg2_type arg2_type;
00257             typedef typename boost::function<Ft>::arg3_type arg3_type;
00258             typedef typename boost::function<Ft>::arg4_type arg4_type;
00259             typedef typename boost::function<Ft>::arg5_type arg5_type;
00260             virtual ~CollectImpl() {}
00261 
00266             virtual SendStatus collect()
00267             {
00268                 return BaseImpl::collect_impl();
00269             }
00275             virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5)
00276             {
00277                 return BaseImpl::collect_impl(a1,a2,a3,a4,a5);
00278             }
00279             virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5)
00280             {
00281                 return BaseImpl::collectIfDone_impl(a1,a2,a3,a4,a5);
00282             }
00283         };
00284 
00285     }
00286 }
00287 #endif