SAGA Adaptor CPI v.1.0
task_impl.hpp
Go to the documentation of this file.
00001 //  Copyright (c) 2005-2009 Hartmut Kaiser
00002 //  Copyright (c) 2005-2006 Stephan Hirmer (shirmer@cct.lsu.edu)
00003 // 
00004 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
00005 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00006 
00007 #if !defined(BOOST_PP_IS_ITERATING)
00008 
00009 #if !defined(SAGA_ADAPTOR_TASK_IMPL_IMPLEMENTATION_HPP)
00010 #define SAGA_ADAPTOR_TASK_IMPL_IMPLEMENTATION_HPP
00011 
00012 #include <saga/impl/config.hpp>
00013 
00014 #include <boost/preprocessor/iterate.hpp>
00015 #include <boost/preprocessor/repetition/enum_params.hpp>
00016 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
00017 
00018 #define BOOST_PP_ITERATION_PARAMS_1                                           \
00019     (3, (1, SAGA_ARGUMENT_LIMIT,                                              \
00020     "saga/saga/adaptors/task_impl.hpp"))                                      \
00021     
00022 
00023 #include BOOST_PP_ITERATE()
00024 
00025 #endif // SAGA_ADAPTOR_TASK_IMPL_IMPLEMENTATION_HPP
00026 
00028 //
00029 //  Preprocessor vertical repetition code
00030 //
00032 #else // defined(BOOST_PP_IS_ITERATING)
00033 
00034 #define P BOOST_PP_ITERATION()
00035 
00036 #define GET_TEMP_ARG(z, M, _) BOOST_PP_COMMA_IF(M) FuncArg ## M, Arg ## M
00037 
00042     template<
00043         typename Cpi, typename Base, typename RetVal, 
00044         BOOST_PP_ENUM_PARAMS (P, typename FuncArg),
00045         BOOST_PP_ENUM_PARAMS (P, typename Arg)
00046     >
00047     inline saga::impl::task<
00048         Cpi, Base, RetVal, BOOST_PP_REPEAT(P, GET_TEMP_ARG, _)>*
00049     task::create_task(
00050         char const *func_name, TR1::shared_ptr<Cpi> cpi, impl::proxy* prxy, 
00051         void (Base::*sync)(RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg)),
00052         BOOST_PP_ENUM_BINARY_PARAMS (P, Arg, const& arg),
00053         bool (Base::*prep)(RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), 
00054             saga::uuid))
00055     {
00056         return new saga::impl::task<
00057             Cpi, Base, RetVal, BOOST_PP_REPEAT(P, GET_TEMP_ARG, _)>(
00058                 func_name, cpi, prxy, sync, BOOST_PP_ENUM_PARAMS(P, arg), prep);
00059     }
00060 
00071     template<typename Cpi, typename Base, typename RetVal,
00072         BOOST_PP_ENUM_PARAMS(P, typename FuncArg),
00073         BOOST_PP_ENUM_PARAMS(P, typename Arg)
00074     >
00075     inline saga::impl::wrapper_task <
00076         Cpi, Base, RetVal, BOOST_PP_REPEAT(P, GET_TEMP_ARG, _)>*
00077     task::create_task(
00078         char const *func_name, TR1::shared_ptr<Cpi> cpi, impl::proxy* prxy, 
00079         void (Base::*sync)(RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), saga::uuid),
00080         BOOST_PP_ENUM_BINARY_PARAMS (P, Arg, const& arg),
00081         bool (Base::*prep)(
00082             RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), saga::uuid))
00083     {
00084         return new saga::impl::wrapper_task<
00085             Cpi, Base, RetVal, BOOST_PP_REPEAT(P, GET_TEMP_ARG, _)>(
00086                 func_name, cpi, prxy, sync, BOOST_PP_ENUM_PARAMS(P, arg), prep);
00087     }
00088 
00089 #undef GET_TEMP_ARG
00090 
00101     template<
00102         typename Cpi, typename Base, typename RetVal,
00103         BOOST_PP_ENUM_PARAMS (P, typename FuncArg),
00104         BOOST_PP_ENUM_PARAMS (P, typename Arg)
00105     >
00106     inline task::task (
00107             char const *func_name, TR1::shared_ptr<Cpi> cpi, impl::proxy* prxy, 
00108             void (Base::*sync)(RetVal&, BOOST_PP_ENUM_PARAMS (P, FuncArg)),
00109             BOOST_PP_ENUM_BINARY_PARAMS (P, Arg, const& arg),
00110             bool (Base::*prep)(
00111                 RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), saga::uuid))
00112       : base_type (
00113           create_task(func_name, cpi, prxy, sync, BOOST_PP_ENUM_PARAMS(P, arg), prep))
00114     {
00115     }
00116 
00117     template<
00118         typename Cpi, typename Base, typename RetVal,
00119         BOOST_PP_ENUM_PARAMS (P, typename FuncArg),
00120         BOOST_PP_ENUM_PARAMS (P, typename Arg)
00121     >
00122     inline task::task (
00123             char const *func_name, TR1::shared_ptr<Cpi> cpi, 
00124             void (Base::*sync)(RetVal&, BOOST_PP_ENUM_PARAMS (P, FuncArg)),
00125             BOOST_PP_ENUM_BINARY_PARAMS (P, Arg, const& arg),
00126             bool (Base::*prep)(
00127                 RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), saga::uuid))
00128       : base_type (create_task(func_name, cpi, cpi->get_proxy(), sync, 
00129             BOOST_PP_ENUM_PARAMS(P, arg), prep))
00130     {
00131     }
00132 
00145     template<
00146         typename Cpi, typename Base, typename RetVal,
00147         BOOST_PP_ENUM_PARAMS (P, typename FuncArg),
00148         BOOST_PP_ENUM_PARAMS (P, typename Arg)
00149     >
00150     inline task::task (
00151             char const *func_name, TR1::shared_ptr<Cpi> cpi, impl::proxy* prxy, 
00152             void (Base::*sync)(RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), saga::uuid),
00153             BOOST_PP_ENUM_BINARY_PARAMS (P, Arg, const& arg),
00154             bool (Base::*prep)(
00155                 RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), saga::uuid))
00156       : base_type(
00157           create_task(func_name, cpi, prxy, sync, BOOST_PP_ENUM_PARAMS(P, arg), prep)) 
00158     {
00159     }
00160 
00161     template<
00162         typename Cpi, typename Base, typename RetVal,
00163         BOOST_PP_ENUM_PARAMS (P, typename FuncArg),
00164         BOOST_PP_ENUM_PARAMS (P, typename Arg)
00165     >
00166     inline task::task (
00167             char const *func_name, TR1::shared_ptr<Cpi> cpi, 
00168             void (Base::*sync)(RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), saga::uuid),
00169             BOOST_PP_ENUM_BINARY_PARAMS (P, Arg, const& arg),
00170             bool (Base::*prep)(
00171                 RetVal&, BOOST_PP_ENUM_PARAMS(P, FuncArg), saga::uuid))
00172       : base_type(create_task(func_name, cpi, cpi->get_proxy(), sync, 
00173             BOOST_PP_ENUM_PARAMS(P, arg), prep)) 
00174     {
00175     }
00176 
00177 #undef P
00178 
00179 #endif // defined(BOOST_PP_IS_ITERATING)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines