8 #include <boost/version.hpp>
9 #if BOOST_VERSION != 102800
10 #if defined (_MSC_VER) && _MSC_VER <= 1200
14 #if defined (_MSC_VER) && _MSC_VER <= 1200
18 #include <boost/python/detail/extension_class.hpp>
24 static void initpaths();
26 static void reseterrors();
29 BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE
30 #if BOOST_VERSION != 102800
40 struct my_builtin_to_python
42 BOOST_STATIC_CONSTANT(
bool, uses_registry =
false );
45 #ifndef BOOST_PYTHON_TO_PYTHON_BY_VALUE
46 # define BOOST_PYTHON_RETURN_TO_PYTHON_BY_VALUE( T, expr ) \
47 template < class MYTYPE > \
48 struct to_python_value; \
50 struct to_python_value< T& >: \
51 my_builtin_to_python \
53 inline PyObject* operator()( T const &x ) const \
59 struct to_python_value< T const& >: \
60 my_builtin_to_python \
62 inline PyObject* operator()( T const &x ) const \
68 # define BOOST_PYTHON_ARG_TO_PYTHON_BY_VALUE( T, expr ) \
71 template < class MYTYPE > \
72 struct arg_to_python; \
74 struct arg_to_python< T >: \
75 ::boost::python::handle< > \
77 arg_to_python( T const&x ) : \
78 ::boost::python::handle< > ( expr ) {} \
83 # define BOOST_PYTHON_TO_PYTHON_BY_VALUE( T, expr ) \
84 BOOST_PYTHON_RETURN_TO_PYTHON_BY_VALUE( T, expr ) \
85 BOOST_PYTHON_ARG_TO_PYTHON_BY_VALUE( T, expr )
88 boost::python::to_python_value< boost::python::tuple > () ( boost::python::make_tuple( (
double)
95 boost::python::to_python_value< boost::python::tuple > () ( boost::python::make_tuple( (
double)
102 inline PyObject * to_python(
Vector vec )
104 return to_python( boost::python::tuple( (
double) vec.i, (
double) vec.j, (
double) vec.k ) );
106 inline PyObject * to_python(
QVector vec )
108 return to_python( boost::python::tuple( (
double) vec.i, (
double) vec.j, (
double) vec.k ) );
111 inline Vector from_python( PyObject *p, boost::python::type< Vector >)
114 PyArg_ParseTuple( p,
"fff", &vec.i, &vec.j, &vec.k );
117 inline QVector from_python( PyObject *p, boost::python::type< QVector >)
120 PyArg_ParseTuple( p,
"ddd", &vec.i, &vec.j, &vec.k );
124 BOOST_PYTHON_END_CONVERSION_NAMESPACE