1 #ifndef OPENMESH_PYTHON_ITERATOR_HH
2 #define OPENMESH_PYTHON_ITERATOR_HH
20 template<
class Iterator,
size_t (OpenMesh::ArrayKernel::*n_items)() const>
32 mesh_(_mesh), n_items_(n_items),
33 iterator_(_mesh, _hnd, _skip),
34 iterator_end_(_mesh, typename Iterator::value_type(int((_mesh.*n_items)()))) {
45 mesh_(_mesh), n_items_(n_items),
46 iterator_(_mesh, _hnd, _skip),
47 iterator_end_(_mesh, typename Iterator::value_type(int((_mesh.*n_items)()))) {
65 typename Iterator::value_type
next() {
66 if (iterator_ != iterator_end_) {
67 typename Iterator::value_type res = *iterator_;
72 PyErr_SetString(PyExc_StopIteration,
"No more data.");
73 boost::python::throw_error_already_set();
75 return typename Iterator::value_type();
83 unsigned int len()
const {
84 return (mesh_.*n_items_)();
91 Iterator iterator_end_;
107 template<
class Iterator,
size_t (OpenMesh::ArrayKernel::*n_items)() const>
109 class_<IteratorWrapperT<Iterator, n_items> >(_name, init<PolyMesh&, typename Iterator::value_type, optional<bool> >())
110 .def(init<
TriMesh&,
typename Iterator::value_type, optional<bool> >())
IteratorWrapperT(const TriMesh &_mesh, typename Iterator::value_type _hnd, bool _skip=false)
Connectivity Class for polygonal meshes.
Iterator::value_type next()
IteratorWrapperT(const PolyMesh &_mesh, typename Iterator::value_type _hnd, bool _skip=false)
void expose_iterator(const char *_name)
IteratorWrapperT iter() const