From a47fbc18f740b7667871619c8d0eed5229b42ee5 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Thu, 11 Apr 2002 18:58:10 +0000 Subject: [PATCH] Use PP lib for holders [SVN r13447] --- include/boost/python/detail/preprocessor.hpp | 8 + include/boost/python/detail/signature.hpp | 217 ------------- include/boost/python/object/class.hpp | 2 + .../boost/python/object/pointer_holder.hpp | 295 +++--------------- include/boost/python/object/value_holder.hpp | 293 +++-------------- .../python/preprocessed/pointer_holder.hpp | 105 +++++++ .../pointer_holder_back_reference.hpp | 115 +++++++ .../python/preprocessed/value_holder.hpp | 105 +++++++ .../value_holder_back_reference.hpp | 117 +++++++ 9 files changed, 523 insertions(+), 734 deletions(-) delete mode 100644 include/boost/python/detail/signature.hpp create mode 100644 include/boost/python/preprocessed/pointer_holder.hpp create mode 100644 include/boost/python/preprocessed/pointer_holder_back_reference.hpp create mode 100644 include/boost/python/preprocessed/value_holder.hpp create mode 100644 include/boost/python/preprocessed/value_holder_back_reference.hpp diff --git a/include/boost/python/detail/preprocessor.hpp b/include/boost/python/detail/preprocessor.hpp index 23278436..728c4699 100644 --- a/include/boost/python/detail/preprocessor.hpp +++ b/include/boost/python/detail/preprocessor.hpp @@ -8,10 +8,12 @@ # include # include +# include # include # include # include # include +# include # include namespace boost { namespace python { namespace detail { @@ -83,6 +85,12 @@ namespace boost { namespace python { namespace detail { # define BOOST_PYTHON_REPEAT_MF_ALL_CV_2ND(function) \ BOOST_PP_LIST_FOR_EACH(BOOST_PYTHON_REPEAT_PMF_CV,function,BOOST_PYTHON_ALL_CV) +#define BOOST_PYTHON_NUMBER_PAIR(Index, Pair) \ + BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,0,Pair),Index) \ + BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,1,Pair),Index) + +#define BOOST_PYTHON_ENUM_PARAMS2(N, Pair) BOOST_PP_ENUM(N, BOOST_PYTHON_NUMBER_PAIR, Pair) + }}} // namespace boost::python::detail diff --git a/include/boost/python/detail/signature.hpp b/include/boost/python/detail/signature.hpp deleted file mode 100644 index db8b39a4..00000000 --- a/include/boost/python/detail/signature.hpp +++ /dev/null @@ -1,217 +0,0 @@ -// (C) Copyright David Abrahams 2002. Permission to copy, use, modify, sell and -// distribute this software is granted provided this copyright notice appears -// in all copies. This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// -// This work was funded in part by Lawrence Berkeley and Lawrence -// Livermore National Labs -// -// This file generated for 5-argument member functions and 6-argument free -// functions by gen_signature.py - -#ifndef SIGNATURE_DWA2002128_HPP -# define SIGNATURE_DWA2002128_HPP - -# include - -namespace boost { namespace python { namespace detail { - -template -mpl::type_list -signature(R (*)()) -{ - return mpl::type_list(); -} - -template -mpl::type_list -signature(R (*)(A0)) -{ - return mpl::type_list(); -} - -template -mpl::type_list -signature(R (*)(A0, A1)) -{ - return mpl::type_list(); -} - -template -mpl::type_list -signature(R (*)(A0, A1, A2)) -{ - return mpl::type_list(); -} - -template -mpl::type_list -signature(R (*)(A0, A1, A2, A3)) -{ - return mpl::type_list(); -} - -template -mpl::type_list -signature(R (*)(A0, A1, A2, A3, A4)) -{ - return mpl::type_list(); -} - -template -mpl::type_list -signature(R (*)(A0, A1, A2, A3, A4, A5)) -{ - return mpl::type_list(); -} -template -mpl::type_list signature(R (A0::*)()) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1)) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2)) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2, A3)) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2, A3, A4)) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2, A3, A4, A5)) -{ - return mpl::type_list(); -} - - -template -mpl::type_list signature(R (A0::*)() const) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1) const) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2) const) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2, A3) const) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2, A3, A4) const) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2, A3, A4, A5) const) -{ - return mpl::type_list(); -} - - -template -mpl::type_list signature(R (A0::*)() volatile) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1) volatile) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2) volatile) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2, A3) volatile) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2, A3, A4) volatile) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2, A3, A4, A5) volatile) -{ - return mpl::type_list(); -} - - -template -mpl::type_list signature(R (A0::*)() const volatile) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1) const volatile) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2) const volatile) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2, A3) const volatile) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2, A3, A4) const volatile) -{ - return mpl::type_list(); -} - -template -mpl::type_list signature(R (A0::*)(A1, A2, A3, A4, A5) const volatile) -{ - return mpl::type_list(); -} - -}}} // namespace boost::python::detail - -#endif // SIGNATURE_DWA2002128_HPP - diff --git a/include/boost/python/object/class.hpp b/include/boost/python/object/class.hpp index 5ca8c41e..10c54629 100644 --- a/include/boost/python/object/class.hpp +++ b/include/boost/python/object/class.hpp @@ -59,6 +59,8 @@ struct BOOST_PYTHON_DECL instance_holder : private noncopyable private: instance_holder* m_next; }; +// This macro is needed for implementation of derived holders +# define BOOST_PYTHON_UNFORWARD(N,ignored) (typename unforward::type)(a##N) // Each extension instance will be one of these struct instance diff --git a/include/boost/python/object/pointer_holder.hpp b/include/boost/python/object/pointer_holder.hpp index 3a8e2cec..31e8fead 100644 --- a/include/boost/python/object/pointer_holder.hpp +++ b/include/boost/python/object/pointer_holder.hpp @@ -15,6 +15,8 @@ # include # include # include +# include +# include namespace boost { namespace python { namespace objects { @@ -22,125 +24,27 @@ template struct pointer_holder : instance_holder { pointer_holder(Pointer); - + // Forward construction to the held object - pointer_holder(PyObject*) - : m_p(new Value) {} +# ifndef BOOST_PYTHON_GENERATE_CODE +# include +# endif - - template - pointer_holder(PyObject*, A1 a1) - : m_p(new Value( - (typename unforward::type)(a1) - )) - {} - - template - pointer_holder(PyObject*, A1 a1, A2 a2) - : m_p(new Value( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - )) - {} - - template - pointer_holder(PyObject*, A1 a1, A2 a2, A3 a3) - : m_p(new Value( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - )) - {} - - template - pointer_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4) - : m_p(new Value( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - )) - {} - - template - pointer_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) - : m_p(new Value( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - )) {} - - template - pointer_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) - : m_p(new Value( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - )) {} - - template - pointer_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) - : m_p(new Value( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - )) - {} - - template - pointer_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) - : m_p(new Value( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - , (typename unforward::type)(a8) - )) - {} - - template - pointer_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) - : m_p(new Value( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - , (typename unforward::type)(a8) - , (typename unforward::type)(a9) - )) - {} - - template - pointer_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) - : m_p(new Value( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - , (typename unforward::type)(a8) - , (typename unforward::type)(a9) - , (typename unforward::type)(a10) - )) + +# define BOOST_PYTHON_CONSTRUCT_POINTER_HOLDER(nargs, ignored) \ + BOOST_PP_EXPR_IF(nargs, template <) \ + BOOST_PP_ENUM_PARAMS(nargs, class A) \ + BOOST_PP_EXPR_IF(nargs, >) \ + pointer_holder(PyObject* \ + BOOST_PP_COMMA_IF(nargs) \ + BOOST_PYTHON_ENUM_PARAMS2(nargs, (A,a))) \ + : m_p(new Value( \ + BOOST_PP_ENUM(nargs, BOOST_PYTHON_UNFORWARD, nil) \ + )) \ {} + BOOST_PYTHON_REPEAT_ARITY_2ND(BOOST_PYTHON_CONSTRUCT_POINTER_HOLDER,nil) + private: // required holder implementation void* holds(converter::undecorated_type_id_t); @@ -158,153 +62,26 @@ struct pointer_holder_back_reference : instance_holder pointer_holder_back_reference(Pointer); // Forward construction to the held object - pointer_holder_back_reference(PyObject* p) - : m_p(new held_type(p)) { - void const* x = &instance_finder::registration; (void)x; - } - - template - pointer_holder_back_reference(PyObject* p, A1 a1) - : m_p(new held_type(p - , (typename unforward::type)(a1) - )) - { - void const* x = &instance_finder::registration; (void)x; - } - +# ifndef BOOST_PYTHON_GENERATE_CODE +# include +# endif - template - pointer_holder_back_reference(PyObject* p, A1 a1, A2 a2) - : m_p(new held_type(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - )) - { - void const* x = &instance_finder::registration; (void)x; - } - - - template - pointer_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3) - : m_p(new held_type(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - )) - { - void const* x = &instance_finder::registration; (void)x; - } - - - template - pointer_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4) - : m_p(new held_type(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - )) - { - void const* x = &instance_finder::registration; (void)x; - } - - - template - pointer_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) - : m_p(new held_type(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - )) { - void const* x = &instance_finder::registration; (void)x; - } - - - template - pointer_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) - : m_p(new held_type(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - )) { - void const* x = &instance_finder::registration; (void)x; - } - - - template - pointer_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) - : m_p(new held_type(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - )) - { - void const* x = &instance_finder::registration; (void)x; - } - - - template - pointer_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) - : m_p(new held_type(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - , (typename unforward::type)(a8) - )) - { - void const* x = &instance_finder::registration; (void)x; - } - - - template - pointer_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) - : m_p(new held_type(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - , (typename unforward::type)(a8) - , (typename unforward::type)(a9) - )) - { - void const* x = &instance_finder::registration; (void)x; - } - - - template - pointer_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) - : m_p(new held_type(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - , (typename unforward::type)(a8) - , (typename unforward::type)(a9) - , (typename unforward::type)(a10) - )) - { - void const* x = &instance_finder::registration; (void)x; +# define BOOST_PYTHON_CONSTRUCT_POINTER_HOLDER_BACK_REFERENCE(nargs, ignored) \ + BOOST_PP_EXPR_IF(nargs, template <) \ + BOOST_PP_ENUM_PARAMS(nargs, class A) \ + BOOST_PP_EXPR_IF(nargs, >) \ + pointer_holder_back_reference(PyObject* p \ + BOOST_PP_COMMA_IF(nargs) \ + BOOST_PYTHON_ENUM_PARAMS2(nargs, (A,a))) \ + : m_p(new held_type( \ + p, \ + BOOST_PP_ENUM(nargs, BOOST_PYTHON_UNFORWARD, nil) \ + )) \ + { \ + void const* x = &instance_finder::registration; (void)x; \ } + BOOST_PYTHON_REPEAT_ARITY_2ND(BOOST_PYTHON_CONSTRUCT_POINTER_HOLDER_BACK_REFERENCE,nil) private: // required holder implementation void* holds(converter::undecorated_type_id_t); diff --git a/include/boost/python/object/value_holder.hpp b/include/boost/python/object/value_holder.hpp index d98d1d10..49251921 100644 --- a/include/boost/python/object/value_holder.hpp +++ b/include/boost/python/object/value_holder.hpp @@ -12,6 +12,8 @@ # include # include # include +# include +# include namespace boost { namespace python { namespace objects { @@ -19,122 +21,24 @@ template struct value_holder : instance_holder { // Forward construction to the held object - value_holder(PyObject*) - : m_held() {} - - template - value_holder(PyObject*, A1 a1) - : m_held( - (typename unforward::type)(a1) - ) - {} - - template - value_holder(PyObject*, A1 a1, A2 a2) - : m_held( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - ) - {} - - template - value_holder(PyObject*, A1 a1, A2 a2, A3 a3) - : m_held( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - ) - {} - - template - value_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4) - : m_held( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - ) - {} - - template - value_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) - : m_held( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - ) {} - - template - value_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) - : m_held( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - ) {} - - template - value_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) - : m_held( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - ) - {} - - template - value_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) - : m_held( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - , (typename unforward::type)(a8) - ) - {} - - template - value_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) - : m_held( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - , (typename unforward::type)(a8) - , (typename unforward::type)(a9) - ) - {} - - template - value_holder(PyObject*, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) - : m_held( - (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - , (typename unforward::type)(a8) - , (typename unforward::type)(a9) - , (typename unforward::type)(a10) - ) +# ifndef BOOST_PYTHON_GENERATE_CODE +# include +# endif + +# define BOOST_PYTHON_CONSTRUCT_VALUE_HOLDER(nargs, ignored) \ + BOOST_PP_EXPR_IF(nargs, template <) \ + BOOST_PP_ENUM_PARAMS(nargs, class A) \ + BOOST_PP_EXPR_IF(nargs, >) \ + value_holder(PyObject* \ + BOOST_PP_COMMA_IF(nargs) \ + BOOST_PYTHON_ENUM_PARAMS2(nargs, (A,a))) \ + : m_held( \ + BOOST_PP_ENUM(nargs, BOOST_PYTHON_UNFORWARD, nil) \ + ) \ {} + BOOST_PYTHON_REPEAT_ARITY_2ND(BOOST_PYTHON_CONSTRUCT_VALUE_HOLDER,nil) + private: // required holder implementation void* holds(converter::undecorated_type_id_t); @@ -146,154 +50,27 @@ template struct value_holder_back_reference : instance_holder { // Forward construction to the held object - value_holder_back_reference(PyObject* p) - : m_held() { - void const* x = &instance_finder::registration; (void)x; - } - +# ifndef BOOST_PYTHON_GENERATE_CODE +# include +# endif - template - value_holder_back_reference(PyObject* p, A1 a1) - : m_held(p - , (typename unforward::type)(a1) - ) - { - void const* x = &instance_finder::registration; (void)x; +# define BOOST_PYTHON_CONSTRUCT_VALUE_HOLDER_BACK_REFERENCE(nargs, ignored) \ + BOOST_PP_EXPR_IF(nargs, template <) \ + BOOST_PP_ENUM_PARAMS(nargs, class A) \ + BOOST_PP_EXPR_IF(nargs, >) \ + value_holder_back_reference(PyObject* p \ + BOOST_PP_COMMA_IF(nargs) \ + BOOST_PYTHON_ENUM_PARAMS2(nargs, (A,a))) \ + : m_held( \ + p BOOST_PP_COMMA_IF(nargs) \ + BOOST_PP_ENUM(nargs, BOOST_PYTHON_UNFORWARD, nil) \ + ) \ + { \ + void const* x = &instance_finder::registration; (void)x; \ } + BOOST_PYTHON_REPEAT_ARITY_2ND(BOOST_PYTHON_CONSTRUCT_VALUE_HOLDER_BACK_REFERENCE,nil) - template - value_holder_back_reference(PyObject* p, A1 a1, A2 a2) - : m_held(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - ) - { - void const* x = &instance_finder::registration; (void)x; - } - - - template - value_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3) - : m_held(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - ) - { - void const* x = &instance_finder::registration; (void)x; - } - - - template - value_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4) - : m_held(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - ) - { - void const* x = &instance_finder::registration; (void)x; - } - - - template - value_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) - : m_held(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - ) { - void const* x = &instance_finder::registration; (void)x; - } - - - template - value_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) - : m_held(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - ) { - void const* x = &instance_finder::registration; (void)x; - } - - - template - value_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) - : m_held(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - ) - { - void const* x = &instance_finder::registration; (void)x; - } - - - template - value_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) - : m_held(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - , (typename unforward::type)(a8) - ) - { - void const* x = &instance_finder::registration; (void)x; - } - - - template - value_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) - : m_held(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - , (typename unforward::type)(a8) - , (typename unforward::type)(a9) - ) - { - void const* x = &instance_finder::registration; (void)x; - } - - - template - value_holder_back_reference(PyObject* p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10) - : m_held(p - , (typename unforward::type)(a1) - , (typename unforward::type)(a2) - , (typename unforward::type)(a3) - , (typename unforward::type)(a4) - , (typename unforward::type)(a5) - , (typename unforward::type)(a6) - , (typename unforward::type)(a7) - , (typename unforward::type)(a8) - , (typename unforward::type)(a9) - , (typename unforward::type)(a10) - ) - { - void const* x = &instance_finder::registration; (void)x; - } - private: // required holder implementation void* holds(converter::undecorated_type_id_t); diff --git a/include/boost/python/preprocessed/pointer_holder.hpp b/include/boost/python/preprocessed/pointer_holder.hpp new file mode 100644 index 00000000..0f2bf149 --- /dev/null +++ b/include/boost/python/preprocessed/pointer_holder.hpp @@ -0,0 +1,105 @@ +// Copyright David Abrahams 2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +#ifndef POINTER_HOLDER_DWA2002411_HPP +# define POINTER_HOLDER_DWA2002411_HPP + +pointer_holder(PyObject*) + :m_p(new Value()) +{ + +} +templatepointer_holder(PyObject*,A0 a0) + :m_p(new Value( + (typename unforward::type)(a0))) +{ + +} +templatepointer_holder(PyObject*,A0 a0,A1 a1) + :m_p(new Value( + (typename unforward::type)(a0), + (typename unforward::type)(a1))) +{ + +} +templatepointer_holder(PyObject*,A0 a0,A1 a1,A2 a2) + :m_p(new Value( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2))) +{ + +} +templatepointer_holder(PyObject*,A0 a0,A1 a1,A2 a2,A3 a3) + :m_p(new Value( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3))) +{ + +} +templatepointer_holder(PyObject*,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4) + :m_p(new Value( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4))) +{ + +} +templatepointer_holder(PyObject*,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5) + :m_p(new Value( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5))) +{ + +} +templatepointer_holder(PyObject*,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6) + :m_p(new Value( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5), + (typename unforward::type)(a6))) +{ + +} +templatepointer_holder(PyObject*,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7) + :m_p(new Value( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5), + (typename unforward::type)(a6), + (typename unforward::type)(a7))) +{ + +} +templatepointer_holder(PyObject*,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8) + :m_p(new Value( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5), + (typename unforward::type)(a6), + (typename unforward::type)(a7), + (typename unforward::type)(a8))) +{ + +} + +#endif // POINTER_HOLDER_DWA2002411_HPP diff --git a/include/boost/python/preprocessed/pointer_holder_back_reference.hpp b/include/boost/python/preprocessed/pointer_holder_back_reference.hpp new file mode 100644 index 00000000..b07242cc --- /dev/null +++ b/include/boost/python/preprocessed/pointer_holder_back_reference.hpp @@ -0,0 +1,115 @@ +// Copyright David Abrahams 2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +#ifndef POINTER_HOLDER_BACK_REFERENCE_DWA2002411_HPP +# define POINTER_HOLDER_BACK_REFERENCE_DWA2002411_HPP + +pointer_holder_back_reference(PyObject*p) + :m_p(new held_type(p,)) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatepointer_holder_back_reference(PyObject*p,A0 a0) + :m_p(new held_type(p, + (typename unforward::type)(a0))) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatepointer_holder_back_reference(PyObject*p,A0 a0,A1 a1) + :m_p(new held_type(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1))) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatepointer_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2) + :m_p(new held_type(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2))) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatepointer_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2,A3 a3) + :m_p(new held_type(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3))) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatepointer_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4) + :m_p(new held_type(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4))) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatepointer_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5) + :m_p(new held_type(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5))) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatepointer_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6) + :m_p(new held_type(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5), + (typename unforward::type)(a6))) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatepointer_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7) + :m_p(new held_type(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5), + (typename unforward::type)(a6), + (typename unforward::type)(a7))) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatepointer_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8) + :m_p(new held_type(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5), + (typename unforward::type)(a6), + (typename unforward::type)(a7), + (typename unforward::type)(a8))) +{ + void const*x=&instance_finder::registration; + (void)x; +} + +#endif // POINTER_HOLDER_BACK_REFERENCE_DWA2002411_HPP diff --git a/include/boost/python/preprocessed/value_holder.hpp b/include/boost/python/preprocessed/value_holder.hpp new file mode 100644 index 00000000..88ba56dd --- /dev/null +++ b/include/boost/python/preprocessed/value_holder.hpp @@ -0,0 +1,105 @@ +// Copyright David Abrahams 2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +#ifndef VALUE_HOLDER_DWA2002411_HPP +# define VALUE_HOLDER_DWA2002411_HPP + +value_holder(PyObject*) + :m_held() +{ + +} +templatevalue_holder(PyObject*,A0 a0) + :m_held( + (typename unforward::type)(a0)) +{ + +} +templatevalue_holder(PyObject*,A0 a0,A1 a1) + :m_held( + (typename unforward::type)(a0), + (typename unforward::type)(a1)) +{ + +} +templatevalue_holder(PyObject*,A0 a0,A1 a1,A2 a2) + :m_held( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2)) +{ + +} +templatevalue_holder(PyObject*,A0 a0,A1 a1,A2 a2,A3 a3) + :m_held( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3)) +{ + +} +templatevalue_holder(PyObject*,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4) + :m_held( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4)) +{ + +} +templatevalue_holder(PyObject*,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5) + :m_held( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5)) +{ + +} +templatevalue_holder(PyObject*,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6) + :m_held( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5), + (typename unforward::type)(a6)) +{ + +} +templatevalue_holder(PyObject*,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7) + :m_held( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5), + (typename unforward::type)(a6), + (typename unforward::type)(a7)) +{ + +} +templatevalue_holder(PyObject*,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8) + :m_held( + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5), + (typename unforward::type)(a6), + (typename unforward::type)(a7), + (typename unforward::type)(a8)) +{ + +} + +#endif // VALUE_HOLDER_DWA2002411_HPP diff --git a/include/boost/python/preprocessed/value_holder_back_reference.hpp b/include/boost/python/preprocessed/value_holder_back_reference.hpp new file mode 100644 index 00000000..c9d91434 --- /dev/null +++ b/include/boost/python/preprocessed/value_holder_back_reference.hpp @@ -0,0 +1,117 @@ +// Copyright David Abrahams 2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +#ifndef VALUE_HOLDER_BACK_REFERENCE_DWA2002411_HPP +# define VALUE_HOLDER_BACK_REFERENCE_DWA2002411_HPP + +value_holder_back_reference(PyObject*p) + :m_held(p) +{ + void const*x=&instance_finder::registration; + (void)x; +} + + +templatevalue_holder_back_reference(PyObject*p,A0 a0) + :m_held(p, + (typename unforward::type)(a0)) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatevalue_holder_back_reference(PyObject*p,A0 a0,A1 a1) + :m_held(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1)) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatevalue_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2) + :m_held(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2)) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatevalue_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2,A3 a3) + :m_held(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3)) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatevalue_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4) + :m_held(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4)) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatevalue_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5) + :m_held(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5)) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatevalue_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6) + :m_held(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5), + (typename unforward::type)(a6)) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatevalue_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7) + :m_held(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5), + (typename unforward::type)(a6), + (typename unforward::type)(a7)) +{ + void const*x=&instance_finder::registration; + (void)x; +} +templatevalue_holder_back_reference(PyObject*p,A0 a0,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8) + :m_held(p, + (typename unforward::type)(a0), + (typename unforward::type)(a1), + (typename unforward::type)(a2), + (typename unforward::type)(a3), + (typename unforward::type)(a4), + (typename unforward::type)(a5), + (typename unforward::type)(a6), + (typename unforward::type)(a7), + (typename unforward::type)(a8)) +{ + void const*x=&instance_finder::registration; + (void)x; +} + +#endif // VALUE_HOLDER_BACK_REFERENCE_DWA2002411_HPP