| Line | |
|---|
| 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> |
|---|
| 16 | list 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 | |
|---|
| 27 | inline list RangeWrapper(int count){ |
|---|
| 28 | return VectorToList(wrappertest::Range(count)); |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | inline int f_wrapper(wrappertest::A*) { return 10; } |
|---|
| 32 | |
|---|
| 33 | #endif |
|---|
Note: See
TracBrowser
for help on using the repository browser.