00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkCollectionIterator.h,v $ 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 =========================================================================*/ 00027 #ifndef __vtkCollectionIterator_h 00028 #define __vtkCollectionIterator_h 00029 00030 #include "vtkObject.h" 00031 00032 class vtkCollection; 00033 class vtkCollectionElement; 00034 00035 class VTK_COMMON_EXPORT vtkCollectionIterator : public vtkObject 00036 { 00037 public: 00038 vtkTypeRevisionMacro(vtkCollectionIterator,vtkObject); 00039 void PrintSelf(ostream& os, vtkIndent indent); 00040 static vtkCollectionIterator* New(); 00041 00043 00044 virtual void SetCollection(vtkCollection*); 00045 vtkGetObjectMacro(Collection, vtkCollection); 00047 00049 void InitTraversal() { this->GoToFirstItem(); } 00050 00052 void GoToFirstItem(); 00053 00055 void GoToNextItem(); 00056 00059 int IsDoneWithTraversal(); 00060 00063 vtkObject* GetCurrentObject(); 00064 00065 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE 00066 # define GetObjectA GetObject 00067 # define GetObjectW GetObject 00068 #endif 00069 00072 VTK_LEGACY(vtkObject* GetObject()); 00073 00074 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE 00075 # undef GetObjectW 00076 # undef GetObjectA 00077 //BTX 00078 VTK_LEGACY(vtkObject* GetObjectA()); 00079 VTK_LEGACY(vtkObject* GetObjectW()); 00080 //ETX 00081 #endif 00082 00083 protected: 00084 vtkCollectionIterator(); 00085 ~vtkCollectionIterator(); 00086 00087 // The collection over which we are iterating. 00088 vtkCollection* Collection; 00089 00090 // The current iterator position. 00091 vtkCollectionElement* Element; 00092 00093 vtkObject* GetObjectInternal(); 00094 private: 00095 vtkCollectionIterator(const vtkCollectionIterator&); // Not implemented 00096 void operator=(const vtkCollectionIterator&); // Not implemented 00097 }; 00098 00099 #endif