16#ifndef vtkDataObjectTreeRange_h
17#define vtkDataObjectTreeRange_h
52struct DataObjectTreeRange;
53struct DataObjectTreeIterator;
59 :
public std::iterator<std::forward_iterator_tag, vtkDataObject*, int,
60 DataObjectTreeIteratorReference, DataObjectTreeIteratorReference>
63 using Superclass = std::iterator<std::forward_iterator_tag,
vtkDataObject*, int,
72 using pointer =
typename Superclass::pointer;
76 : Iterator(o.Iterator ?
SmartIterator::Take(o.Iterator->NewInstance()) : nullptr)
78 this->CopyState(o.Iterator);
86 this->CopyState(o.Iterator);
133 return !(lhs == rhs);
139 swap(lhs.Iterator, rhs.Iterator);
148 : Iterator(std::move(iter))
155 : Iterator{
nullptr }
160 void CopyState(InternalIterator*
source)
164 assert(this->Iterator !=
nullptr);
170 this->AdvanceTo(
source->GetCurrentFlatIndex());
174 void AdvanceTo(
const unsigned int flatIdx)
176 assert(this->Iterator !=
nullptr);
186 assert(this->Iterator !=
nullptr);
193 assert(this->Iterator !=
nullptr);
198 mutable SmartIterator Iterator;
219 : DataObjectTree(cds)
222 assert(this->DataObjectTree);
233 auto iter = this->NewIterator();
234 iter->InitTraversal();
235 while (!iter->IsDoneWithTraversal())
238 iter->GoToNextItem();
254 SmartIterator NewIterator()
const
259 result->SetSkipEmptyNodes((this->Options & Opts::SkipEmptyNodes) != Opts::None);
260 result->SetVisitOnlyLeaves((this->Options & Opts::VisitOnlyLeaves) != Opts::None);
261 result->SetTraverseSubTree((this->Options & Opts::TraverseSubTree) != Opts::None);
262 result->InitTraversal();
virtual void SetDataSet(vtkCompositeDataSet *ds)
Set the composite dataset this iterator is iterating over.
virtual void InitTraversal()
Begin iterating over the composite dataset structure.
virtual void SetSkipEmptyNodes(vtkTypeBool)
If SkipEmptyNodes is true, then nullptr datasets will be skipped.
superclass for composite data iterators
int IsDoneWithTraversal() override
Test whether the iterator is finished with the traversal.
virtual void SetTraverseSubTree(vtkTypeBool)
If TraverseSubTree is set to true, the iterator will visit the entire tree structure,...
void GoToNextItem() override
Move the iterator to the next item in the collection.
unsigned int GetCurrentFlatIndex() override
Flat index is an index obtained by traversing the tree in preorder.
virtual void SetVisitOnlyLeaves(vtkTypeBool)
If VisitOnlyLeaves is true, the iterator will only visit nodes (sub-datasets) that are not composite.
provides implementation for most abstract methods in the superclass vtkCompositeDataSet
virtual vtkDataObjectTreeIterator * NewTreeIterator()
Return a new iterator (the iterator has to be deleted by user).
general representation of visualization data
static vtkSmartPointer< InternalIterator > Take(InternalIterator *t)
Transfer ownership of one reference to the given VTK object to a new smart pointer.
A reference proxy into a vtkCompositeDataSet, obtained by dereferencing an iterator from the vtk::Ran...
vtk::CompositeDataSetNodeReference< vtkDataObjectTreeIterator, DataObjectTreeIterator > DataObjectTreeIteratorReference
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
typename Superclass::value_type value_type
pointer operator->() const
DataObjectTreeIterator(const DataObjectTreeIterator &o)
DataObjectTreeIterator(DataObjectTreeIterator &&) noexcept=default
DataObjectTreeIterator operator++(int)
DataObjectTreeIterator(SmartIterator &&iter) noexcept
typename Superclass::pointer pointer
reference operator*() const
DataObjectTreeIterator & operator++()
typename Superclass::reference reference
friend bool operator!=(const DataObjectTreeIterator &lhs, const DataObjectTreeIterator &rhs)
typename Superclass::iterator_category iterator_category
DataObjectTreeIterator() noexcept
friend bool operator==(const DataObjectTreeIterator &lhs, const DataObjectTreeIterator &rhs)
friend void swap(DataObjectTreeIterator &lhs, DataObjectTreeIterator &rhs) noexcept
typename Superclass::difference_type difference_type
vtkDataObjectTree * GetDataObjectTree() const noexcept
DataObjectTreeOptions GetOptions() const noexcept
DataObjectTreeRange(vtkDataObjectTree *cds, DataObjectTreeOptions opts=DataObjectTreeOptions::None)
const_iterator cbegin() const
const_iterator cend() const
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)