VTK  9.3.20240328
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
40 #ifndef vtkAdjacentVertexIterator_h
41 #define vtkAdjacentVertexIterator_h
42 
43 #include "vtkCommonDataModelModule.h" // For export macro
44 #include "vtkObject.h"
45 
46 #include "vtkGraph.h" // For edge type definitions
47 
48 VTK_ABI_NAMESPACE_BEGIN
49 class vtkGraphEdge;
50 
51 class VTKCOMMONDATAMODEL_EXPORT vtkAdjacentVertexIterator : public vtkObject
52 {
53 public:
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
62 
64 
67  vtkGetObjectMacro(Graph, vtkGraph);
68  vtkGetMacro(Vertex, vtkIdType);
70 
72 
76  {
77  vtkOutEdgeType e = *this->Current;
78  ++this->Current;
79  return e.Target;
80  }
82 
86  bool HasNext() { return this->Current != this->End; }
87 
88 protected:
91 
96  virtual void SetGraph(vtkGraph* graph);
97 
102 
103 private:
105  void operator=(const vtkAdjacentVertexIterator&) = delete;
106 };
107 
108 VTK_ABI_NAMESPACE_END
109 #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:340
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:161
vtkIdType Target
Definition: vtkGraph.h:312
int vtkIdType
Definition: vtkType.h:315