VTK  9.7.1
vtkCollectionIterator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
16 #ifndef vtkCollectionIterator_h
17 #define vtkCollectionIterator_h
18 
19 #include "vtkCommonCoreModule.h" // For export macro
20 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_7_0
21 #include "vtkObject.h"
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 class vtkCollection;
25 
26 class VTK_DEPRECATED_IN_9_7_0("Use vtk::Range instead.") VTKCOMMONCORE_EXPORT vtkCollectionIterator
27  : public vtkObject
28 {
29 public:
31  void PrintSelf(ostream& os, vtkIndent indent) override;
32  static vtkCollectionIterator* New();
33 
35 
38  virtual void SetCollection(vtkCollection*);
39  vtkGetObjectMacro(Collection, vtkCollection);
41 
45  void InitTraversal() { this->GoToFirstItem(); }
46 
50  void GoToFirstItem();
51 
55  void GoToNextItem();
56 
61  int IsDoneWithTraversal();
62 
68 
69 protected:
71  ~vtkCollectionIterator() override;
72 
73  // The collection over which we are iterating.
75 
77 
78 private:
79  // The current iterator position.
80  std::vector<vtkObject*>::iterator Iterator;
81 
83  void operator=(const vtkCollectionIterator&) = delete;
84 };
85 
86 VTK_ABI_NAMESPACE_END
87 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
static vtkCollectionIterator * New()
vtkObject * GetObjectInternal()
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
auto Range(IterablePtr iterable, Options &&...opts) -> typename detail::IterableTraits< typename detail::StripPointers< IterablePtr >::type >::RangeType
Generate an iterable STL proxy object for a VTK container.
Definition: vtkRange.h:74
~vtkCollectionIterator() override
void GoToFirstItem()
Position the iterator at the first item in the collection.
a simple class to control print indentation
Definition: vtkIndent.h:28
iterator through a vtkCollection.
virtual void SetCollection(vtkCollection *)
Set/Get the collection over which to iterate.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int IsDoneWithTraversal()
Test whether the iterator is currently positioned at a valid item.
create and manipulate ordered lists of objects
Definition: vtkCollection.h:39
vtkObject * GetCurrentObject()
Get the item at the current iterator position.
void InitTraversal()
Position the iterator at the first item in the collection.
#define VTK_DEPRECATED_IN_9_7_0(reason)
void GoToNextItem()
Move the iterator to the next item in the collection.