1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkBitArrayIterator.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 vtkBitArrayIterator - Iterator for vtkBitArray.
16 // This iterator iterates over a vtkBitArray. It uses the double interface
17 // to get/set bit values.
18 
19 #ifndef vtkBitArrayIterator_h
20 #define vtkBitArrayIterator_h
21 
22 #include "vtkCommonCoreModule.h" // For export macro
23 #include "vtkArrayIterator.h"
24 
25 class vtkBitArray;
26 class VTKCOMMONCORE_EXPORT vtkBitArrayIterator : public vtkArrayIterator
27 {
28 public:
29   static vtkBitArrayIterator* New();
30   vtkTypeMacro(vtkBitArrayIterator, vtkArrayIterator);
31   void PrintSelf(ostream& os, vtkIndent indent);
32 
33   // Description:
34   // Set the array this iterator will iterate over.
35   // After Initialize() has been called, the iterator is valid
36   // so long as the Array has not been modified
37   // (except using the iterator itself).
38   // If the array is modified, the iterator must be re-intialized.
39   virtual void Initialize(vtkAbstractArray* array);
40 
41   // Description:
42   // Get the array.
43   vtkAbstractArray* GetArray();
44 
45   // Description:
46   // Must be called only after Initialize.
47   int* GetTuple(vtkIdType id) ;
48 
49   // Description:
50   // Must be called only after Initialize.
51   int GetValue(vtkIdType id);
52 
53   // Description:
54   // Must be called only after Initialize.
55   vtkIdType GetNumberOfTuples();
56 
57   // Description:
58   // Must be called only after Initialize.
59   vtkIdType GetNumberOfValues();
60 
61   // Description:
62   // Must be called only after Initialize.
63   int GetNumberOfComponents();
64 
65   // Description:
66   // Get the data type from the underlying array.
67   int GetDataType();
68 
69   // Description:
70   // Get the data type size from the underlying array.
71   int GetDataTypeSize();
72 
73   // Description:
74   // Sets the value at the index. This does not verify if the index is valid.
75   // The caller must ensure that id is less than the maximum number of values.
76   void SetValue(vtkIdType id, int value);
77 
78   //BTX
79   // Description:
80   // Data type of a value.
81   typedef int ValueType;
82   //ETX
83 protected:
84   vtkBitArrayIterator();
85   ~vtkBitArrayIterator();
86 
87   int *Tuple;
88   int TupleSize;
89   void SetArray(vtkBitArray* b);
90   vtkBitArray* Array;
91 private:
92   vtkBitArrayIterator(const vtkBitArrayIterator&); // Not implemented.
93   void operator=(const vtkBitArrayIterator&); // Not implemented.
94 };
95 
96 #endif
97 
98