1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkBridgeCellIteratorOnCellList.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 // .NAME vtkBridgeCellIteratorOnCellList - Iterate over a list of cells defined
16 // on a dataset.
17 // See InitWithCells().
18 // .SECTION See Also
19 // vtkBridgeCellIterator, vtkBridgeDataSet, vtkBridgeCellIteratorStrategy
20 
21 #ifndef vtkBridgeCellIteratorOnCellList_h
22 #define vtkBridgeCellIteratorOnCellList_h
23 
24 #include "vtkBridgeCellIteratorStrategy.h"
25 
26 class vtkBridgeCell;
27 class vtkIdList;
28 class vtkBridgeDataSet;
29 
30 class VTKTESTINGGENERICBRIDGE_EXPORT vtkBridgeCellIteratorOnCellList : public vtkBridgeCellIteratorStrategy
31 {
32 public:
33   static vtkBridgeCellIteratorOnCellList *New();
34   vtkTypeMacro(vtkBridgeCellIteratorOnCellList,
35                        vtkBridgeCellIteratorStrategy);
36   void PrintSelf(ostream& os, vtkIndent indent);
37 
38   // Description:
39   // Move iterator to first position if any (loop initialization).
40   void Begin();
41 
42   // Description:
43   // Is there no cell at iterator position? (exit condition).
44   int IsAtEnd();
45 
46   // Description:
47   // Cell at current position
48   // \pre not_at_end: !IsAtEnd()
49   // \pre c_exists: c!=0
50   // THREAD SAFE
51   void GetCell(vtkGenericAdaptorCell *c);
52 
53   // Description:
54   // Cell at current position.
55   // NOT THREAD SAFE
56   // \pre not_at_end: !IsAtEnd()
57   // \post result_exits: result!=0
58   vtkGenericAdaptorCell *GetCell();
59 
60   // Description:
61   // Move iterator to next position. (loop progression).
62   // \pre not_at_end: !IsAtEnd()
63   void Next();
64 
65   // Description:
66   // Used internally by vtkBridgeCell.
67   // Iterate on neighbors defined by `cells' over the dataset `ds'.
68   // \pre cells_exist: cells!=0
69   // \pre ds_exists: ds!=0
70   void InitWithCells(vtkIdList *cells,
71                      vtkBridgeDataSet *ds);
72 
73 protected:
74   vtkBridgeCellIteratorOnCellList();
75   virtual ~vtkBridgeCellIteratorOnCellList();
76 
77   vtkIdList *Cells; // cells traversed by the iterator.
78   vtkBridgeDataSet *DataSet;
79   vtkIdType Id; // the id at current position.
80   vtkBridgeCell *Cell; // cell at current position.
81 
82 private:
83   vtkBridgeCellIteratorOnCellList(const vtkBridgeCellIteratorOnCellList&); // Not implemented
84   void operator=(const vtkBridgeCellIteratorOnCellList&); // Not implemented
85 };
86 
87 #endif
88