|
| 1 | +#include <boost/python.hpp> |
| 2 | +#include "Bundle.hpp" |
| 3 | +#include <vector> |
| 4 | +#include <boost/python/suite/indexing/vector_indexing_suite.hpp> |
| 5 | +using namespace boost; |
| 6 | +namespace py = boost::python; |
| 7 | +using namespace libConfig; |
| 8 | + |
| 9 | + |
| 10 | +template<class T> |
| 11 | +py::list std_vector_to_py_list(const std::vector<T>& v) |
| 12 | +{ |
| 13 | + py::object get_iter = py::iterator<std::vector<T> >(); |
| 14 | + py::object iter = get_iter(v); |
| 15 | + py::list l(iter); |
| 16 | + return l; |
| 17 | +} |
| 18 | + |
| 19 | +BOOST_PYTHON_MODULE(bundle) |
| 20 | +{ |
| 21 | + py::class_<std::vector<std::string> >("string_vector") |
| 22 | + .def(py::vector_indexing_suite<std::vector<std::string> >()) |
| 23 | + ; |
| 24 | + |
| 25 | + py::class_<SingleBundle>("SingleBundle"); |
| 26 | + py::class_<Bundle>("Bundle") |
| 27 | + .def("initialize", &Bundle::initialize) |
| 28 | + .def("getActiveBundleName", &Bundle::getActiveBundleName, |
| 29 | + py::return_value_policy<py::reference_existing_object>()) |
| 30 | + .def("selectedBundle", &Bundle::selectedBundle, |
| 31 | + py::return_value_policy<py::reference_existing_object>()) |
| 32 | + .def("findFileByName", &Bundle::findFileByName) |
| 33 | + .def("findFilesByName", &Bundle::findFilesByName) |
| 34 | + .def("findFilesByExtension", &Bundle::findFilesByExtension) |
| 35 | + .def("getConfigurationPathsForTaskModel", |
| 36 | + &Bundle::getConfigurationPathsForTaskModel); |
| 37 | +} |
0 commit comments