1 /* Copyright Bruno da Silva de Oliveira 2003. Use, modification and 2 distribution is subject to the Boost Software License, Version 1.0. 3 (See accompanying file LICENSE_1_0.txt or copy at 4 http://www.boost.org/LICENSE_1_0.txt) 5 */ 6 #ifndef WRAPPER_TEST_WRAPPERS 7 #define WRAPPER_TEST_WRAPPERS 8 9 #include <vector> 10 #include <boost/python.hpp> 11 #include "wrappertest.h" 12 13 using namespace boost::python; 14 15 template <class T> VectorToList(const std::vector<T> & v)16list VectorToList(const std::vector<T> & v) 17 { 18 list res; 19 typename std::vector<T>::const_iterator it; 20 for(it = v.begin(); it != v.end(); ++it){ 21 res.append(*it); 22 } 23 Py_XINCREF(res.ptr()); 24 return res; 25 } 26 RangeWrapper(int count)27inline list RangeWrapper(int count){ 28 return VectorToList(wrappertest::Range(count)); 29 } 30 f_wrapper(wrappertest::A *)31inline int f_wrapper(wrappertest::A*) { return 10; } 32 33 #endif 34