11 #ifndef _RD_PYSEQUENCEHOLDER_H_ 12 #define _RD_PYSEQUENCEHOLDER_H_ 20 namespace python = boost::python;
42 unsigned int size()
const {
45 res = python::extract<int>(d_seq.attr(
"__len__")());
47 throw_value_error(
"sequence does not support length query");
65 throw_index_error(which);
69 T res = python::extract<T>(d_seq[which]);
72 throw_value_error(
"cannot extract desired type from sequence");
76 return static_cast<T
>(0);
#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.
PySequenceHolder(python::object seq)
T operator[](unsigned int which) const
Returns an element of the sequence.