10 #ifndef vtkBitArrayIterator_h
11 #define vtkBitArrayIterator_h
15 #include "vtkCommonCoreModule.h"
19 VTK_ABI_NAMESPACE_BEGIN
40 vtkBitArray* b = vtkArrayDownCast<vtkBitArray>(array);
43 vtkErrorMacro(
"vtkBitArrayIterator can iterate only over vtkBitArray.");
64 vtkIdType numComps = this->Array->GetNumberOfComponents();
65 if (this->TupleSize < numComps)
67 this->TupleSize =
static_cast<int>(numComps);
69 this->Tuple =
new int[this->TupleSize];
72 for (
int j = 0; j < numComps; j++)
74 this->Tuple[j] = this->Array->GetValue(loc + j);
86 return this->Array->GetValue(
id);
88 vtkErrorMacro(
"Array Iterator not initialized.");
99 return this->Array->GetNumberOfTuples();
111 return this->Array->GetNumberOfTuples() * this->Array->GetNumberOfComponents();
123 return this->Array->GetNumberOfComponents();
135 return this->Array->GetDataType();
147 return this->Array->GetDataTypeSize();
160 this->Array->SetValue(
id, value);
172 this->Array =
nullptr;
173 this->Tuple =
nullptr;
178 this->SetArray(
nullptr);
179 delete[] this->Tuple;
192 VTK_ABI_NAMESPACE_END
~vtkBitArrayIterator() override
int GetNumberOfComponents() const
Must be called only after Initialize.
Iterator for vtkBitArray.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Initialize(vtkAbstractArray *array) override
Set the array this iterator will iterate over.
Abstract superclass for all arrays.
vtkIdType GetNumberOfValues() const
Must be called only after Initialize.
void SetValue(vtkIdType id, int value)
Sets the value at the index.
int ValueType
Data type of a value.
int GetDataType() const override
Get the data type from the underlying array.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractArray * GetArray()
Get the array.
a simple class to control print indentation
static vtkBitArrayIterator * New()
#define VTK_STANDARD_NEW_BODY(thisClass)
int GetValue(vtkIdType id)
Must be called only after Initialize.
Abstract superclass to iterate over elements in an vtkAbstractArray.
dynamic, self-adjusting array of bits
vtkIdType GetNumberOfTuples() const
Must be called only after Initialize.
void SetArray(vtkBitArray *b)
int GetDataTypeSize() const
Get the data type size from the underlying array.
#define VTK_DEPRECATED_IN_9_7_0(reason)
int * GetTuple(vtkIdType id)
Must be called only after Initialize.