VTK: Common/DataModel/vtkAdjacentVertexIterator.h Source File

| VTK 9.3.1

vtkAdjacentVertexIterator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
30 #ifndef vtkAdjacentVertexIterator_h
31 #define vtkAdjacentVertexIterator_h
32
33 #include "vtkCommonDataModelModule.h" // For export macro
34 #include "vtkObject.h"
35
36 #include "vtkGraph.h" // For edge type definitions
37
38 VTK_ABI_NAMESPACE_BEGIN
39 class vtkGraphEdge;
40
41 class VTKCOMMONDATAMODEL_EXPORT vtkAdjacentVertexIterator : public vtkObject
42 {
43 public:
44 static vtkAdjacentVertexIterator* New();
45 vtkTypeMacro(vtkAdjacentVertexIterator, vtkObject);
46 void PrintSelf(ostream& os, vtkIndent indent) override;
47
51 void Initialize(vtkGraph* g, vtkIdType v);
52
54
57 vtkGetObjectMacro(Graph, vtkGraph);
58 vtkGetMacro(Vertex, vtkIdType);
60
62
65 vtkIdType Next()
66 {
67 vtkOutEdgeType e = *this->Current;
68 ++this->Current;
69 return e.Target;
70 }
72
76 bool HasNext() { return this->Current != this->End; }
77
78 protected:
79 vtkAdjacentVertexIterator();
80 ~vtkAdjacentVertexIterator() override;
81
86 virtual void SetGraph(vtkGraph* graph);
87
88 vtkGraph* Graph;
89 const vtkOutEdgeType* Current;
90 const vtkOutEdgeType* End;
91 vtkIdType Vertex;
92
93 private:
94 vtkAdjacentVertexIterator(const vtkAdjacentVertexIterator&) = delete;
95 void operator=(const vtkAdjacentVertexIterator&) = delete;
96 };
97
98 VTK_ABI_NAMESPACE_END
99 #endif
vtkAdjacentVertexIterator
Iterates through adjacent vertices in a graph.
Definition: vtkAdjacentVertexIterator.h:42
vtkAdjacentVertexIterator::~vtkAdjacentVertexIterator
~vtkAdjacentVertexIterator() override
vtkAdjacentVertexIterator::Next
vtkIdType Next()
Returns the next edge in the graph.
Definition: vtkAdjacentVertexIterator.h:65
vtkAdjacentVertexIterator::HasNext
bool HasNext()
Whether this iterator has more edges.
Definition: vtkAdjacentVertexIterator.h:76
vtkAdjacentVertexIterator::SetGraph
virtual void SetGraph(vtkGraph *graph)
Protected method for setting the graph used by Initialize().
vtkAdjacentVertexIterator::Vertex
vtkIdType Vertex
Definition: vtkAdjacentVertexIterator.h:91
vtkAdjacentVertexIterator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAdjacentVertexIterator::Graph
vtkGraph * Graph
Definition: vtkAdjacentVertexIterator.h:88
vtkAdjacentVertexIterator::End
const vtkOutEdgeType * End
Definition: vtkAdjacentVertexIterator.h:90
vtkAdjacentVertexIterator::Current
const vtkOutEdgeType * Current
Definition: vtkAdjacentVertexIterator.h:89
vtkAdjacentVertexIterator::Initialize
void Initialize(vtkGraph *g, vtkIdType v)
Initialize the iterator with a graph and vertex.
vtkAdjacentVertexIterator::New
static vtkAdjacentVertexIterator * New()
vtkAdjacentVertexIterator::vtkAdjacentVertexIterator
vtkAdjacentVertexIterator()
vtkGraphEdge
Representation of a single graph edge.
Definition: vtkGraphEdge.h:25
vtkGraph
Base class for graph data types.
Definition: vtkGraph.h:290
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkOutEdgeType
Definition: vtkGraph.h:255
vtkOutEdgeType::Target
vtkIdType Target
Definition: vtkGraph.h:262
vtkGraph.h
vtkObject.h
vtkIdType
int vtkIdType
Definition: vtkType.h:315