MACE  1.0.0
 All Classes Namespaces Files Functions Variables Enumerations Defines
libs/rpc/include/mace/rpc/json/detail/call_methods.hpp
00001 #ifndef BOOST_PP_IS_ITERATING
00002 
00003 #        ifndef BOOST_CALL_IMPL_SIZE
00004 #           define BOOST_CALL_IMPL_SIZE 8
00005 #        endif
00006 
00007     #define PARAM_NAME(z,n,type)         BOOST_PP_CAT(a,n)
00008     #define PARAM_TYPE_NAME(z,n,type)   BOOST_PP_CAT(typename A,n)
00009     #define PARAM_TYPE(z,n,type)   BOOST_PP_CAT(A,n)
00010     #define PARAM_ARG(z,n,type)     PARAM_TYPE(z,n,type) PARAM_NAME(z,n,type)
00011 
00012 #       include <boost/preprocessor/iteration/iterate.hpp>
00013 #       define BOOST_PP_ITERATION_LIMITS (0, BOOST_CALL_IMPL_SIZE -1 )
00014 #       define BOOST_PP_FILENAME_1 <mace/rpc/json/detail/call_methods.hpp>
00015 #       include BOOST_PP_ITERATE()
00016 
00017 #undef PARAM_NAME
00018 #undef PARAM_ARG
00019 #undef PARAM_TYPE_NAME
00020 #undef PARAM_TYPE
00021 
00022 
00023 #else // BOOST_PP_IS_ITERATING
00024 
00025     #define n BOOST_PP_ITERATION()
00026     #define PARAM_NAMES          BOOST_PP_ENUM(n,PARAM_NAME,A) // name_N
00027     #define PARAM_ARGS           BOOST_PP_ENUM(n,PARAM_ARG,A) // TYPE_N name_N
00028     #define PARAM_TYPE_NAMES     BOOST_PP_ENUM(n,PARAM_TYPE_NAME,A) // typename TYPE_N
00029     #define PARAM_TYPES          BOOST_PP_ENUM(n,PARAM_TYPE,A) // TYPE_N
00030 
00031 
00032     #if n > 0
00033       template<PARAM_TYPE_NAMES>
00034       mace::cmt::future<rpc::json::value> call( const std::string& method_name, PARAM_ARGS ) {
00035         return call_fused<rpc::json::value>( method_name, boost::fusion::make_vector( PARAM_NAMES ) );
00036       }
00037       template<typename R,PARAM_TYPE_NAMES>
00038       mace::cmt::future<R> call( const std::string& method_name, PARAM_ARGS ) {
00039         return call_fused<R>( method_name, boost::fusion::make_vector( PARAM_NAMES ) );
00040       }
00041    #else
00042       mace::cmt::future<rpc::json::value> call( const std::string& method_name ) {
00043         return call_fused<rpc::json::value>( method_name, boost::fusion::make_vector( ) );
00044       }
00045       template<typename R>
00046       mace::cmt::future<R> call( const std::string& method_name ) {
00047         return call_fused<R>( method_name, boost::fusion::make_vector( ) );
00048       }
00049    #endif
00050 
00051 
00052 #undef PARAM_TYPE_NAMES 
00053 #undef PARAM_NAMES         
00054 #undef PARAM_ARGS        
00055 #undef PARAM_TYPES
00056 
00057 #endif