VTK
dox/Common/DataModel/vtkAdjacentVertexIterator.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkAdjacentVertexIterator.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright 2008 Sandia Corporation.
00017   Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00018   the U.S. Government retains certain rights in this software.
00019 -------------------------------------------------------------------------*/
00036 #ifndef __vtkAdjacentVertexIterator_h
00037 #define __vtkAdjacentVertexIterator_h
00038 
00039 #include "vtkCommonDataModelModule.h" // For export macro
00040 #include "vtkObject.h"
00041 
00042 #include "vtkGraph.h" // For edge type definitions
00043 
00044 class vtkGraphEdge;
00045 
00046 class VTKCOMMONDATAMODEL_EXPORT vtkAdjacentVertexIterator : public vtkObject
00047 {
00048 public:
00049   static vtkAdjacentVertexIterator *New();
00050   vtkTypeMacro(vtkAdjacentVertexIterator, vtkObject);
00051   void PrintSelf(ostream& os, vtkIndent indent);
00052 
00054   void Initialize(vtkGraph *g, vtkIdType v);
00055 
00057 
00058   vtkGetObjectMacro(Graph, vtkGraph);
00059   vtkGetMacro(Vertex, vtkIdType);
00061 
00063 
00064   vtkIdType Next()
00065   {
00066     vtkOutEdgeType e = *this->Current;
00067     ++this->Current;
00068     return e.Target;
00069   }
00071 
00073 
00074   bool HasNext()
00075   {
00076     return this->Current != this->End;
00077   }
00079 
00080 protected:
00081   vtkAdjacentVertexIterator();
00082   ~vtkAdjacentVertexIterator();
00083 
00085   virtual void SetGraph(vtkGraph *graph);
00086 
00087   vtkGraph            *Graph;
00088   const vtkOutEdgeType *Current;
00089   const vtkOutEdgeType *End;
00090   vtkIdType             Vertex;
00091 
00092 private:
00093   vtkAdjacentVertexIterator(const vtkAdjacentVertexIterator&);  // Not implemented.
00094   void operator=(const vtkAdjacentVertexIterator&);  // Not implemented.
00095 };
00096 
00097 #endif