Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/python/pyste/tests/wrappertest_wrappers.h @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 803 bytes
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
13using namespace boost::python;
14
15template <class T>
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
27inline list RangeWrapper(int count){
28    return VectorToList(wrappertest::Range(count));
29}
30
31inline int f_wrapper(wrappertest::A*) { return 10; } 
32
33#endif
Note: See TracBrowser for help on using the repository browser.