14 #include <boost/python.hpp> 26 static PyObject *
convert(
const std::vector<T> & vec)
33 return incref(result.ptr());
42 #define def_readwrite_vector(NAME, FIELDREF) \ 43 add_property(NAME, make_getter(FIELDREF, return_value_policy<return_by_value>()), \ 44 make_setter(FIELDREF, return_value_policy<return_by_value>())) 56 converter::registry::push_back(&convertible, &construct, type_id<std::vector<T>>());
61 if (PySequence_Check(obj_ptr))
63 for (Py_ssize_t i = 0; i < PySequence_Length(obj_ptr); i++)
65 if (!extract<T>(
object(handle<>(PySequence_GetItem(obj_ptr, i)))).check())
80 static void construct(PyObject * obj_ptr, converter::rvalue_from_python_stage1_data * data)
85 for (Py_ssize_t i = 0; i < PySequence_Length(obj_ptr); i++)
87 PyObject * elt = PySequence_GetItem(obj_ptr, i);
88 vs.push_back(extract<T>(
object(handle<>(borrowed(elt)))));
91 void * storage = ((converter::rvalue_from_python_storage<std::vector<T>> *)data)->storage.bytes;
93 new(storage) std::vector<T>(vs);
95 data->convertible = storage;
static void construct(PyObject *obj_ptr, converter::rvalue_from_python_stage1_data *data)
static PyObject * convert(const std::vector< T > &vec)
Python bindings for freeopcua. GNU LGPL.
static void * convertible(PyObject *obj_ptr)
vector_from_python_converter()