File indexing completed on 2025-01-18 09:50:38
0001 #if !defined(BOOST_PP_IS_ITERATING)
0002
0003
0004
0005
0006
0007
0008 # ifndef SIGNATURE_DWA20021121_HPP
0009 # define SIGNATURE_DWA20021121_HPP
0010
0011 # include <boost/python/type_id.hpp>
0012
0013 # include <boost/python/detail/preprocessor.hpp>
0014 # include <boost/python/detail/indirect_traits.hpp>
0015 # include <boost/python/converter/pytype_function.hpp>
0016
0017 # include <boost/preprocessor/iterate.hpp>
0018 # include <boost/preprocessor/iteration/local.hpp>
0019
0020 # include <boost/mpl/at.hpp>
0021 # include <boost/mpl/size.hpp>
0022
0023 namespace boost { namespace python { namespace detail {
0024
0025 struct signature_element
0026 {
0027 char const* basename;
0028 converter::pytype_function pytype_f;
0029 bool lvalue;
0030 };
0031
0032 struct py_func_sig_info
0033 {
0034 signature_element const *signature;
0035 signature_element const *ret;
0036 };
0037
0038 template <unsigned> struct signature_arity;
0039
0040 # define BOOST_PP_ITERATION_PARAMS_1 \
0041 (3, (0, BOOST_PYTHON_MAX_ARITY + 1, <boost/python/detail/signature.hpp>))
0042 # include BOOST_PP_ITERATE()
0043
0044
0045
0046
0047
0048 template <class Sig>
0049 struct signature_base_select
0050 {
0051 enum { arity = mpl::size<Sig>::value - 1 };
0052 typedef typename signature_arity<arity>::template impl<Sig> type;
0053 };
0054
0055 template <class Sig>
0056 struct signature
0057 : signature_base_select<Sig>::type
0058 {
0059 };
0060
0061 }}}
0062
0063 # endif
0064
0065 #else
0066
0067 # define N BOOST_PP_ITERATION()
0068
0069 template <>
0070 struct signature_arity<N>
0071 {
0072 template <class Sig>
0073 struct impl
0074 {
0075 static signature_element const* elements()
0076 {
0077 static signature_element const result[N+2] = {
0078
0079 #ifndef BOOST_PYTHON_NO_PY_SIGNATURES
0080 # define BOOST_PP_LOCAL_MACRO(i) \
0081 { \
0082 type_id<BOOST_DEDUCED_TYPENAME mpl::at_c<Sig,i>::type>().name() \
0083 , &converter::expected_pytype_for_arg<BOOST_DEDUCED_TYPENAME mpl::at_c<Sig,i>::type>::get_pytype \
0084 , indirect_traits::is_reference_to_non_const<BOOST_DEDUCED_TYPENAME mpl::at_c<Sig,i>::type>::value \
0085 },
0086 #else
0087 # define BOOST_PP_LOCAL_MACRO(i) \
0088 { \
0089 type_id<BOOST_DEDUCED_TYPENAME mpl::at_c<Sig,i>::type>().name() \
0090 , 0 \
0091 , indirect_traits::is_reference_to_non_const<BOOST_DEDUCED_TYPENAME mpl::at_c<Sig,i>::type>::value \
0092 },
0093 #endif
0094
0095 # define BOOST_PP_LOCAL_LIMITS (0, N)
0096 # include BOOST_PP_LOCAL_ITERATE()
0097 {0,0,0}
0098 };
0099 return result;
0100 }
0101 };
0102 };
0103
0104 #endif
0105
0106