VTK
vtkAdjacentVertexIterator.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkAdjacentVertexIterator.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15/*-------------------------------------------------------------------------
16 Copyright 2008 Sandia Corporation.
17 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18 the U.S. Government retains certain rights in this software.
19-------------------------------------------------------------------------*/
37#ifndef vtkAdjacentVertexIterator_h
38#define vtkAdjacentVertexIterator_h
39
40#include "vtkCommonDataModelModule.h" // For export macro
41#include "vtkObject.h"
42
43#include "vtkGraph.h" // For edge type definitions
44
45class vtkGraphEdge;
46
47class VTKCOMMONDATAMODEL_EXPORT vtkAdjacentVertexIterator : public vtkObject
48{
49public:
52 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
53
58
60
63 vtkGetObjectMacro(Graph, vtkGraph);
64 vtkGetMacro(Vertex, vtkIdType);
66
68
72 {
73 vtkOutEdgeType e = *this->Current;
74 ++this->Current;
75 return e.Target;
76 }
78
82 bool HasNext()
83 {
84 return this->Current != this->End;
85 }
86
87protected:
90
95 virtual void SetGraph(vtkGraph *graph);
96
97 vtkGraph *Graph;
98 const vtkOutEdgeType *Current;
99 const vtkOutEdgeType *End;
100 vtkIdType Vertex;
101
102private:
103 vtkAdjacentVertexIterator(const vtkAdjacentVertexIterator&) VTK_DELETE_FUNCTION;
104 void operator=(const vtkAdjacentVertexIterator&) VTK_DELETE_FUNCTION;
105};
106
107#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.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkAdjacentVertexIterator * New()
void Initialize(vtkGraph *g, vtkIdType v)
Initialize the iterator with a graph and vertex.
Representation of a single graph edge.
Definition: vtkGraphEdge.h:40
Base class for graph data types.
Definition: vtkGraph.h:288
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkIdType Target
Definition: vtkGraph.h:264
int vtkIdType
Definition: vtkType.h:287