Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/parameter/aux_/python/invoker.hpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 3.0 KB
Line 
1// Copyright Daniel Wallin 2005. Use, modification and distribution is
2// subject to the Boost Software License, Version 1.0. (See accompanying
3// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5#ifndef BOOST_PARAMETER_INVOKER_051210_HPP
6# define BOOST_PARAMETER_INVOKER_051210_HPP
7
8# include <boost/mpl/begin.hpp>
9# include <boost/mpl/next.hpp>
10# include <boost/mpl/deref.hpp>
11# include <boost/parameter/keyword.hpp>
12# include <boost/preprocessor/iteration/iterate.hpp>
13
14namespace boost { namespace parameter { namespace python { namespace aux {
15
16template <long Arity, class M, class R, class Args>
17struct invoker;
18
19template <class M, class R>
20struct make_invoker
21{
22    template <class Args>
23    struct apply
24    {
25        typedef invoker<
26            mpl::size<Args>::value, M, R, Args
27        > type;
28    };
29};
30
31template <long Arity, class M, class R, class T, class Args>
32struct member_invoker;
33
34template <class M, class R, class T>
35struct make_member_invoker
36{
37    template <class Args>
38    struct apply
39    {
40        typedef member_invoker<
41            mpl::size<Args>::value, M, R, T, Args
42        > type;
43    };
44};
45
46template <long Arity, class T, class R, class Args>
47struct call_invoker;
48
49template <class T, class R>
50struct make_call_invoker
51{
52    template <class Args>
53    struct apply
54    {
55        typedef call_invoker<
56            mpl::size<Args>::value, T, R, Args
57        > type;
58    };
59};
60
61template <long Arity, class T, class Args>
62struct init_invoker;
63
64template <class T>
65struct make_init_invoker
66{
67    template <class Args>
68    struct apply
69    {
70        typedef init_invoker<
71            mpl::size<Args>::value, T, Args
72        > type;
73    };
74};
75
76template <class M, class R, class Args>
77struct invoker<0, M, R, Args>
78{
79    static R execute()
80    {
81        return M()(boost::type<R>());
82    }
83};
84
85template <class M, class R, class T, class Args>
86struct member_invoker<0, M, R, T, Args>
87{
88    static R execute(T& self)
89    {
90        return M()(boost::type<R>(), self);
91    }
92};
93
94template <class T, class R, class Args>
95struct call_invoker<0, T, R, Args>
96{
97    static R execute(T& self)
98    {
99        return self();
100    }
101};
102
103template <class T, class Args>
104struct init_invoker<0, T, Args>
105{
106    static T* execute(T& self)
107    {
108        return new T;
109    }
110};
111
112# define BOOST_PP_ITERATION_PARAMS_1 (4, \
113    (1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 1))
114# include BOOST_PP_ITERATE()
115
116# define BOOST_PP_ITERATION_PARAMS_1 (4, \
117    (1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 2))
118# include BOOST_PP_ITERATE()
119
120# define BOOST_PP_ITERATION_PARAMS_1 (4, \
121    (1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 3))
122# include BOOST_PP_ITERATE()
123
124# define BOOST_PP_ITERATION_PARAMS_1 (4, \
125    (1, BOOST_PARAMETER_MAX_ARITY, <boost/parameter/aux_/python/invoker_iterate.hpp>, 4))
126# include BOOST_PP_ITERATE()
127
128}}}} // namespace boost::parameter::python::aux
129
130#endif // BOOST_PARAMETER_INVOKER_051210_HPP
131
Note: See TracBrowser for help on using the repository browser.