12#ifndef _RD_PYSEQUENCEHOLDER_H_
13#define _RD_PYSEQUENCEHOLDER_H_
21namespace python = boost::python;
41 unsigned int size()
const {
44 res = python::extract<int>(d_seq.attr(
"__len__")());
46 throw_value_error(
"sequence does not support length query");
64 throw_index_error(which);
68 T res = python::extract<T>(d_seq[which]);
71 throw_value_error(
"cannot extract desired type from sequence");
75 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)