OpenMesh
OpenMesh::Python::IteratorWrapperT< Iterator, n_items > Class Template Reference

Wrapper for mesh item iterators. More...

#include <Python/Iterator.hh>

Public Member Functions

 IteratorWrapperT (const PolyMesh &_mesh, typename Iterator::value_type _hnd, bool _skip=false)
 Constructor. More...
 
 IteratorWrapperT (const TriMesh &_mesh, typename Iterator::value_type _hnd, bool _skip=false)
 Constructor. More...
 
IteratorWrapperT iter () const
 Implementation of Python's __iter__ magic method. More...
 
Iterator::value_type next ()
 Implementation of Python's __next__ magic method. More...
 
unsigned int len () const
 Implementation of Python's __len__ magic method. More...
 

Detailed Description

template<class Iterator, size_t(OpenMesh::ArrayKernel::*)() const n_items>
class OpenMesh::Python::IteratorWrapperT< Iterator, n_items >

Wrapper for mesh item iterators.

This class template is used to wrap mesh item iterators for Python. It implements Python's iterator protocol (the magic methods __iter__ and __next__).

Template Parameters
IteratorAn iterator type.
n_itemsA member function pointer that points to the mesh function that returns the number of items to iterate over (e.g. n_vertices).

Constructor & Destructor Documentation

template<class Iterator, size_t(OpenMesh::ArrayKernel::*)() const n_items>
OpenMesh::Python::IteratorWrapperT< Iterator, n_items >::IteratorWrapperT ( const PolyMesh _mesh,
typename Iterator::value_type  _hnd,
bool  _skip = false 
)
inline

Constructor.

Parameters
_meshThe mesh that contains the items to iterate over.
_hndThe handle of the first item to iterate over.
_skipSpecifies if deleted/hidden elements are skipped.
template<class Iterator, size_t(OpenMesh::ArrayKernel::*)() const n_items>
OpenMesh::Python::IteratorWrapperT< Iterator, n_items >::IteratorWrapperT ( const TriMesh _mesh,
typename Iterator::value_type  _hnd,
bool  _skip = false 
)
inline

Constructor.

Parameters
_meshThe mesh that contains the items to iterate over.
_hndThe handle of the first item to iterate over.
_skipSpecifies if deleted/hidden elements are skipped.

Member Function Documentation

template<class Iterator, size_t(OpenMesh::ArrayKernel::*)() const n_items>
IteratorWrapperT OpenMesh::Python::IteratorWrapperT< Iterator, n_items >::iter ( ) const
inline

Implementation of Python's __iter__ magic method.

Returns
This iterator.
template<class Iterator, size_t(OpenMesh::ArrayKernel::*)() const n_items>
unsigned int OpenMesh::Python::IteratorWrapperT< Iterator, n_items >::len ( ) const
inline

Implementation of Python's __len__ magic method.

Returns
The number of items in the mesh.
template<class Iterator, size_t(OpenMesh::ArrayKernel::*)() const n_items>
Iterator::value_type OpenMesh::Python::IteratorWrapperT< Iterator, n_items >::next ( )
inline

Implementation of Python's __next__ magic method.

Returns
The next item. Raises a Python StopIteration exception if there are no more items.

The documentation for this class was generated from the following file:

Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .