5 #ifndef __pinocchio_python_utils_list_hpp__
6 #define __pinocchio_python_utils_list_hpp__
13 #include <boost/python.hpp>
14 #include <boost/python/type_id.hpp>
24 template<
typename T,
class Allocator>
25 void extract(
const boost::python::list & list, std::vector<T, Allocator> & vec)
29 size_t size_list = (size_t)bp::len(list);
30 vec.resize(size_list);
31 for (
size_t i = 0;
i < size_list; ++
i)
33 bp::extract<T> input_T(list[
i]);
38 const std::string classname =
39 bp::extract<std::string>(list[
i].attr(
"__class__").attr(
"__name__"));
41 ss <<
"The conversion from " << classname <<
" to " << bp::type_id<T>().name()
42 <<
" has failed." << std::endl;
49 std::vector<T, std::allocator<T>>
extract(
const boost::python::list & list)
51 std::vector<T, std::allocator<T>>
vec;
56 template<
typename T,
class Allocator>
57 std::vector<T, Allocator>
extract(
const boost::python::list & list)
59 std::vector<T, Allocator>
vec;
67 #endif // ifndef __pinocchio_python_utils_list_hpp__