Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:43:29

0001 // Copyright Daniel Wallin 2005. Use, modification and distribution is
0002 // subject to the Boost Software License, Version 1.0. (See accompanying
0003 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0004 
0005 #include <boost/preprocessor/cat.hpp>
0006 #include <boost/preprocessor/dec.hpp>
0007 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
0008 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
0009 
0010 #define N BOOST_PP_ITERATION()
0011 
0012 #define BOOST_PARAMETER_PY_ARG_TYPES(z, n, _) \
0013     typedef typename mpl::next< \
0014         BOOST_PP_CAT(iter,BOOST_PP_DEC(n)) \
0015     >::type BOOST_PP_CAT(iter,n); \
0016     \
0017     typedef typename mpl::deref<BOOST_PP_CAT(iter,n)>::type BOOST_PP_CAT(spec,n); \
0018     typedef typename mpl::if_< \
0019         mpl::and_< \
0020             mpl::not_<typename BOOST_PP_CAT(spec,n)::required> \
0021           , typename BOOST_PP_CAT(spec,n)::optimized_default \
0022         > \
0023       , parameter::aux::maybe<typename BOOST_PP_CAT(spec,n)::type> \
0024       , typename BOOST_PP_CAT(spec,n)::type \
0025     >::type BOOST_PP_CAT(arg,n); \
0026     typedef typename BOOST_PP_CAT(spec,n)::keyword BOOST_PP_CAT(kw,n);
0027 
0028 #if BOOST_PP_ITERATION_FLAGS() == 1
0029 template <class M, class R, class Args>
0030 struct invoker<N, M, R, Args>
0031 #elif BOOST_PP_ITERATION_FLAGS() == 2
0032 template <class T, class R, class Args>
0033 struct call_invoker<N, T, R, Args>
0034 #elif BOOST_PP_ITERATION_FLAGS() == 3
0035 template <class T, class Args>
0036 struct init_invoker<N, T, Args>
0037 #elif BOOST_PP_ITERATION_FLAGS() == 4
0038 template <class M, class R, class T, class Args>
0039 struct member_invoker<N, M, R, T, Args>
0040 #endif
0041 {
0042     typedef typename mpl::begin<Args>::type iter0;
0043     typedef typename mpl::deref<iter0>::type spec0;
0044     typedef typename mpl::if_<
0045         mpl::and_<
0046             mpl::not_<typename spec0::required>
0047           , typename spec0::optimized_default
0048         >
0049       , parameter::aux::maybe<typename spec0::type>
0050       , typename spec0::type
0051     >::type arg0;
0052     typedef typename spec0::keyword kw0;
0053 
0054     BOOST_PP_REPEAT_FROM_TO(1, N, BOOST_PARAMETER_PY_ARG_TYPES, ~)
0055 
0056     static
0057 #if BOOST_PP_ITERATION_FLAGS() == 3
0058     T*
0059 #else
0060     R
0061 #endif 
0062     execute(
0063 #if BOOST_PP_ITERATION_FLAGS() == 2 || BOOST_PP_ITERATION_FLAGS() == 4
0064         T& self
0065       ,
0066 #endif
0067         BOOST_PP_ENUM_BINARY_PARAMS(N, arg, a)
0068     )
0069     {
0070         return
0071 #if BOOST_PP_ITERATION_FLAGS() == 1 || BOOST_PP_ITERATION_FLAGS() == 4
0072          M()(
0073               boost::type<R>()
0074 # if BOOST_PP_ITERATION_FLAGS() == 4
0075             , self
0076 # endif
0077             , BOOST_PP_ENUM_BINARY_PARAMS(N, parameter::keyword<kw, >::get() = a)
0078          );
0079 #elif BOOST_PP_ITERATION_FLAGS() == 2
0080          self(
0081             BOOST_PP_ENUM_BINARY_PARAMS(N, parameter::keyword<kw, >::get() = a)
0082          );
0083 #elif BOOST_PP_ITERATION_FLAGS() == 3
0084          new T(
0085              BOOST_PP_ENUM_BINARY_PARAMS(N, parameter::keyword<kw, >::get() = a)
0086          );
0087 #endif
0088     }
0089 };
0090 
0091 #undef BOOST_PARAMETER_PY_ARG_TYPES
0092 #undef N
0093