[Smtk-developers] Iterator class
David Thompson
david.thompson at kitware.com
Thu Feb 5 16:23:56 EST 2015
Hi all,
Due to popular demand, SMTK now has an iterator class for traversing model entities:
https://github.com/Kitware/SMTK/blob/master/smtk/model/EntityIterator.h
https://github.com/Kitware/SMTK/blob/master/smtk/model/testing/cxx/unitIterators.cxx
The iterator can traverse
* a fixed set of EntityRefs you provide,
* the children of all the items in a set you provide (without repetition), or
* the children of all the models of all the items in a set you provide (without repetition).
The unit test above illustrates how to use it.
To avoid revisiting entities and for robustness against cycles (such as a model owning itself), the iterator maintains a set of entities it has traversed. This also allows for multiple passes to be performed simply (by recycling the list of traversed entities as the source list on the next pass).
David
More information about the Smtk-developers
mailing list