11 #ifndef _RD_PYSEQUENCEHOLDER_H_ 12 #define _RD_PYSEQUENCEHOLDER_H_ 20 namespace python = boost::python;
40 unsigned int size()
const {
43 res = python::extract<int>(d_seq.attr(
"__len__")());
45 throw_value_error(
"sequence does not support length query");
63 throw_index_error(which);
67 T res = python::extract<T>(d_seq[which]);
70 throw_value_error(
"cannot extract desired type from sequence");
74 return static_cast<T
>(T());
#define POSTCONDITION(expr, mess)
Class to hold sequences (lists, tuples, arrays, etc.) passed from Python -> C++.
unsigned int size() const
Returns the size of the contained sequence.
T operator[](unsigned int which) const
Returns an element of the sequence.
PySequenceHolder(python::object seq)