VTK  9.3.0
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:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
52 
54 
57  vtkGetObjectMacro(Graph, vtkGraph);
58  vtkGetMacro(Vertex, vtkIdType);
60 
62 
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:
81 
86  virtual void SetGraph(vtkGraph* graph);
87 
92 
93 private:
95  void operator=(const vtkAdjacentVertexIterator&) = delete;
96 };
97 
98 VTK_ABI_NAMESPACE_END
99 #endif
Iterates through adjacent vertices in a graph.
~vtkAdjacentVertexIterator() override
vtkIdType Next()
Returns the next edge in the graph.
bool HasNext()
Whether this iterator has more edges.
virtual void SetGraph(vtkGraph *graph)
Protected method for setting the graph used by Initialize().
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Initialize(vtkGraph *g, vtkIdType v)
Initialize the iterator with a graph and vertex.
static vtkAdjacentVertexIterator * New()
Representation of a single graph edge.
Definition: vtkGraphEdge.h:25
Base class for graph data types.
Definition: vtkGraph.h:290
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkIdType Target
Definition: vtkGraph.h:262
int vtkIdType
Definition: vtkType.h:315