diff --git a/Common/Core/vtkAOSDataArrayTemplate.h b/Common/Core/vtkAOSDataArrayTemplate.h index 73e9eed4fb691b6d83a2fd45e06357ed09c8833c..9c8f13a24712bd610dae1f35fcb10aab321b539f 100644 --- a/Common/Core/vtkAOSDataArrayTemplate.h +++ b/Common/Core/vtkAOSDataArrayTemplate.h @@ -263,9 +263,9 @@ public: } //@} - int GetArrayType() override { return vtkAbstractArray::AoSDataArrayTemplate; } + int GetArrayType() const override { return vtkAbstractArray::AoSDataArrayTemplate; } VTK_NEWINSTANCE vtkArrayIterator* NewIterator() override; - bool HasStandardMemoryLayout() override { return true; } + bool HasStandardMemoryLayout() const override { return true; } void ShallowCopy(vtkDataArray* other) override; // Reimplemented for efficiency: @@ -310,12 +310,12 @@ vtkArrayDownCast_TemplateFastCastMacro(vtkAOSDataArrayTemplate); // declarations for these functions such that the wrapper // can see them. The wrappers ignore vtkAOSDataArrayTemplate. #define vtkCreateWrappedArrayInterface(T) \ - int GetDataType() override; \ + int GetDataType() const override; \ void GetTypedTuple(vtkIdType i, T* tuple) VTK_EXPECTS(0 <= i && i < GetNumberOfTuples()); \ void SetTypedTuple(vtkIdType i, const T* tuple) VTK_EXPECTS(0 <= i && i < GetNumberOfTuples()); \ void InsertTypedTuple(vtkIdType i, const T* tuple) VTK_EXPECTS(0 <= i); \ vtkIdType InsertNextTypedTuple(const T* tuple); \ - T GetValue(vtkIdType id) VTK_EXPECTS(0 <= id && id < GetNumberOfValues()); \ + T GetValue(vtkIdType id) const VTK_EXPECTS(0 <= id && id < GetNumberOfValues()); \ void SetValue(vtkIdType id, T value) VTK_EXPECTS(0 <= id && id < GetNumberOfValues()); \ bool SetNumberOfValues(vtkIdType number) override; \ void InsertValue(vtkIdType id, T f) VTK_EXPECTS(0 <= id); \ diff --git a/Common/Core/vtkAbstractArray.cxx b/Common/Core/vtkAbstractArray.cxx index 5ea22997f482f2e00b8d025565e9adf76408e88a..0ade36cfff90283a5827b86d610abd2579788a84 100644 --- a/Common/Core/vtkAbstractArray.cxx +++ b/Common/Core/vtkAbstractArray.cxx @@ -136,7 +136,7 @@ void vtkAbstractArray::SetComponentName(vtkIdType component, const char* name) } //---------------------------------------------------------------------------- -const char* vtkAbstractArray::GetComponentName(vtkIdType component) +const char* vtkAbstractArray::GetComponentName(vtkIdType component) const { unsigned int index = static_cast(component); if (!this->ComponentNames || component < 0 || index >= this->ComponentNames->size()) @@ -150,7 +150,7 @@ const char* vtkAbstractArray::GetComponentName(vtkIdType component) } //---------------------------------------------------------------------------- -bool vtkAbstractArray::HasAComponentName() +bool vtkAbstractArray::HasAComponentName() const { return (this->ComponentNames) ? (!this->ComponentNames->empty()) : 0; } @@ -258,7 +258,7 @@ void vtkAbstractArray::GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray* a } //---------------------------------------------------------------------------- -bool vtkAbstractArray::HasStandardMemoryLayout() +bool vtkAbstractArray::HasStandardMemoryLayout() const { return true; } diff --git a/Common/Core/vtkAbstractArray.h b/Common/Core/vtkAbstractArray.h index f9e3f0d8c50a143ef5ba94a3a365dda5257972f5..5f0d7b6f5e651eb8993132a84728c484ba6e5734 100644 --- a/Common/Core/vtkAbstractArray.h +++ b/Common/Core/vtkAbstractArray.h @@ -97,7 +97,7 @@ public: * Return the underlying data type. An integer indicating data type is * returned as specified in vtkType.h. */ - virtual int GetDataType() = 0; + virtual int GetDataType() const = 0; //@{ /** @@ -105,7 +105,7 @@ public: * returned. For string 0 is returned. Arrays with variable length * components return 0. */ - virtual int GetDataTypeSize() = 0; + virtual int GetDataTypeSize() const = 0; static int GetDataTypeSize(int type); //@} @@ -116,7 +116,7 @@ public: * sizeof(vtkStdString::value_type), which winds up being * sizeof(char). */ - virtual int GetElementComponentSize() = 0; + virtual int GetElementComponentSize() const = 0; //@{ /** @@ -124,7 +124,7 @@ public: * this is set before allocation. */ vtkSetClampMacro(NumberOfComponents, int, 1, VTK_INT_MAX); - int GetNumberOfComponents() { return this->NumberOfComponents; } + int GetNumberOfComponents() const { return this->NumberOfComponents; } //@} /** @@ -136,12 +136,12 @@ public: * Get the component name for a given component. * Note: will return the actual string that is stored */ - const char* GetComponentName(vtkIdType component); + const char* GetComponentName(vtkIdType component) const; /** * Returns if any component has had a name assigned */ - bool HasAComponentName(); + bool HasAComponentName() const; /** * Copies the component names from the inputed array to the current array @@ -169,7 +169,7 @@ public: /** * Get the number of complete tuples (a component group) in the array. */ - vtkIdType GetNumberOfTuples() { return (this->MaxId + 1) / this->NumberOfComponents; } + vtkIdType GetNumberOfTuples() const { return (this->MaxId + 1) / this->NumberOfComponents; } /** * Get the total number of values in the array. This is typically equivalent @@ -237,7 +237,7 @@ public: * {t1c1, t1c2, t1c3, ... t1cM, t2c1, ... tNcM} * where t1c2 is the second component of the first tuple. */ - virtual bool HasStandardMemoryLayout(); + virtual bool HasStandardMemoryLayout() const; /** * Return a void pointer. For image pipeline interface and other @@ -375,7 +375,7 @@ public: * information returned is valid only after the pipeline has * been updated. */ - virtual unsigned long GetActualMemorySize() = 0; + virtual unsigned long GetActualMemorySize() const = 0; //@{ /** @@ -388,7 +388,7 @@ public: /** * Get the name of a data type as a string. */ - virtual const char* GetDataTypeAsString(void) + virtual const char* GetDataTypeAsString(void) const { return vtkImageScalarTypeNameMacro(this->GetDataType()); } @@ -409,7 +409,7 @@ public: * This method is here to make backward compatibility easier. It * must return true if and only if an array contains numeric data. */ - virtual int IsNumeric() = 0; + virtual int IsNumeric() const = 0; /** * Subclasses must override this method and provide the right kind @@ -424,7 +424,7 @@ public: * GetDataTypeSize(). Non-contiguous or variable- size arrays need * to override this method. */ - virtual vtkIdType GetDataSize() + virtual vtkIdType GetDataSize() const { return this->GetNumberOfComponents() * this->GetNumberOfTuples(); } @@ -545,7 +545,7 @@ public: * Inquire if this array has an instance of vtkInformation * already associated with it. */ - bool HasInformation() { return this->Information != nullptr; } + bool HasInformation() const { return this->Information != nullptr; } /** * Copy information instance. Arrays use information objects @@ -647,7 +647,7 @@ public: * Method for type-checking in FastDownCast implementations. See also * vtkArrayDownCast. */ - virtual int GetArrayType() { return AbstractArray; } + virtual int GetArrayType() const { return AbstractArray; } protected: // Construct object with default tuple dimension (number of components) of 1. diff --git a/Common/Core/vtkArrayIterator.h b/Common/Core/vtkArrayIterator.h index b76c53126ce0efd5b5c321a4aab590c336e1a3ad..42d4521fa4eea25d5aa33977cca84dfe455991db 100644 --- a/Common/Core/vtkArrayIterator.h +++ b/Common/Core/vtkArrayIterator.h @@ -65,7 +65,7 @@ public: * Get the data type from the underlying array. Returns 0 if * no underlying array is present. */ - virtual int GetDataType() = 0; + virtual int GetDataType() const = 0; protected: vtkArrayIterator(); diff --git a/Common/Core/vtkArrayIteratorTemplate.h b/Common/Core/vtkArrayIteratorTemplate.h index 80490b4bef93b552789b081ca24faa5d1be75175..3878255b90bb0181fab38614e213a586750db574 100644 --- a/Common/Core/vtkArrayIteratorTemplate.h +++ b/Common/Core/vtkArrayIteratorTemplate.h @@ -90,12 +90,12 @@ public: /** * Get the data type from the underlying array. */ - int GetDataType() override; + int GetDataType() const override; /** * Get the data type size from the underlying array. */ - int GetDataTypeSize(); + int GetDataTypeSize() const; /** * This is the data type for the value. diff --git a/Common/Core/vtkArrayIteratorTemplate.txx b/Common/Core/vtkArrayIteratorTemplate.txx index 451009ad8c99fe07057e92b9ab9dc1d6b8f27c79..23c2f666d0b56a95286179ee8fa6a10873e41897 100644 --- a/Common/Core/vtkArrayIteratorTemplate.txx +++ b/Common/Core/vtkArrayIteratorTemplate.txx @@ -100,14 +100,14 @@ T* vtkArrayIteratorTemplate::GetTuple(vtkIdType id) //----------------------------------------------------------------------------- template -int vtkArrayIteratorTemplate::GetDataType() +int vtkArrayIteratorTemplate::GetDataType() const { return this->Array->GetDataType(); } //----------------------------------------------------------------------------- template -int vtkArrayIteratorTemplate::GetDataTypeSize() +int vtkArrayIteratorTemplate::GetDataTypeSize() const { return this->Array->GetDataTypeSize(); } diff --git a/Common/Core/vtkBitArray.cxx b/Common/Core/vtkBitArray.cxx index 4a31ecce66146eecab00128cc677503fd3aa56ac..f0d38020c07432ac33c56de1073973dbdc065fda 100644 --- a/Common/Core/vtkBitArray.cxx +++ b/Common/Core/vtkBitArray.cxx @@ -144,7 +144,7 @@ void vtkBitArray::SetArrayFreeFunction(void (*callback)(void*)) //---------------------------------------------------------------------------- // Get the data at a particular index. -int vtkBitArray::GetValue(vtkIdType id) +int vtkBitArray::GetValue(vtkIdType id) const { if (this->Array[id / 8] & (0x80 >> (id % 8))) { diff --git a/Common/Core/vtkBitArray.h b/Common/Core/vtkBitArray.h index ffda42061eda8f335c96eaf88e25394f856fcde7..a0b4b6605366e612239a28d0026ccf3a29e28353 100644 --- a/Common/Core/vtkBitArray.h +++ b/Common/Core/vtkBitArray.h @@ -57,8 +57,8 @@ public: void Initialize() override; // satisfy vtkDataArray API - int GetDataType() override { return VTK_BIT; } - int GetDataTypeSize() override { return 0; } + int GetDataType() const override { return VTK_BIT; } + int GetDataTypeSize() const override { return 0; } /** * Set the number of n-tuples in the array. @@ -169,7 +169,7 @@ public: /** * Get the data at a particular index. */ - int GetValue(vtkIdType id); + int GetValue(vtkIdType id) const; /** * Set the data at a particular index. Does not do range checking. Make sure diff --git a/Common/Core/vtkBitArrayIterator.cxx b/Common/Core/vtkBitArrayIterator.cxx index dd3b4243c2ec7967fc2f23a44fb5d242279f1a3d..6a51777543a8f10392c255619c8764ce9d372aaa 100644 --- a/Common/Core/vtkBitArrayIterator.cxx +++ b/Common/Core/vtkBitArrayIterator.cxx @@ -124,7 +124,7 @@ int vtkBitArrayIterator::GetNumberOfComponents() } //----------------------------------------------------------------------------- -int vtkBitArrayIterator::GetDataType() +int vtkBitArrayIterator::GetDataType() const { if (this->Array) { @@ -133,7 +133,7 @@ int vtkBitArrayIterator::GetDataType() return 0; } //----------------------------------------------------------------------------- -int vtkBitArrayIterator::GetDataTypeSize() +int vtkBitArrayIterator::GetDataTypeSize() const { if (this->Array) { diff --git a/Common/Core/vtkBitArrayIterator.h b/Common/Core/vtkBitArrayIterator.h index 96535ecb98bcecdd1965e830a0bfd07c214a6e0f..69d6fb1f7550002a8e9dcace3e14de5e97fa26ce 100644 --- a/Common/Core/vtkBitArrayIterator.h +++ b/Common/Core/vtkBitArrayIterator.h @@ -75,12 +75,12 @@ public: /** * Get the data type from the underlying array. */ - int GetDataType() override; + int GetDataType() const override; /** * Get the data type size from the underlying array. */ - int GetDataTypeSize(); + int GetDataTypeSize() const; /** * Sets the value at the index. This does not verify if the index is valid. diff --git a/Common/Core/vtkDataArray.cxx b/Common/Core/vtkDataArray.cxx index 77bbf34ebe019c6d08a18986ea98173f92643bb5..d1e3b6a17f0dda559eb9499d884ed7535ef0051d 100644 --- a/Common/Core/vtkDataArray.cxx +++ b/Common/Core/vtkDataArray.cxx @@ -1286,7 +1286,7 @@ void vtkDataArray::InsertNextTuple9(double val0, double val1, double val2, doubl } //---------------------------------------------------------------------------- -unsigned long vtkDataArray::GetActualMemorySize() +unsigned long vtkDataArray::GetActualMemorySize() const { vtkIdType numPrims; double size; diff --git a/Common/Core/vtkDataArray.h b/Common/Core/vtkDataArray.h index 7d6ef255ca51c55c2960442dc77687306b25e8c6..a28c545ba3c4436d3f35d52846cbed5dcd22516f 100644 --- a/Common/Core/vtkDataArray.h +++ b/Common/Core/vtkDataArray.h @@ -66,14 +66,14 @@ public: * All vtkDataArray subclasses contain numeric data, hence this method * always returns 1(true). */ - int IsNumeric() override { return 1; } + int IsNumeric() const override { return 1; } /** * Return the size, in bytes, of the lowest-level element of an * array. For vtkDataArray and subclasses this is the size of the * data type. */ - int GetElementComponentSize() override { return this->GetDataTypeSize(); } + int GetElementComponentSize() const override { return this->GetDataTypeSize(); } // Reimplemented virtuals (doc strings are inherited from superclass): void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override; @@ -318,7 +318,7 @@ public: * information returned is valid only after the pipeline has * been updated. */ - unsigned long GetActualMemorySize() override; + unsigned long GetActualMemorySize() const override; /** * Create default lookup table. Generally used to create one when none @@ -506,7 +506,7 @@ public: /** * Method for type-checking in FastDownCast implementations. */ - int GetArrayType() override { return DataArray; } + int GetArrayType() const override { return DataArray; } protected: friend class vtkPoints; diff --git a/Common/Core/vtkGenericDataArray.h b/Common/Core/vtkGenericDataArray.h index c783d7f68645a534c6ca1fb0ade1c7e82ae76690..0f23a9ab4bec752f78a3ccc894501f3389eaaff1 100644 --- a/Common/Core/vtkGenericDataArray.h +++ b/Common/Core/vtkGenericDataArray.h @@ -264,9 +264,9 @@ public: */ virtual void FillValue(ValueType value); - int GetDataType() override; - int GetDataTypeSize() override; - bool HasStandardMemoryLayout() override; + int GetDataType() const override; + int GetDataTypeSize() const override; + bool HasStandardMemoryLayout() const override; vtkTypeBool Allocate(vtkIdType size, vtkIdType ext = 1000) override; vtkTypeBool Resize(vtkIdType numTuples) override; void SetNumberOfComponents(int num) override; diff --git a/Common/Core/vtkGenericDataArray.txx b/Common/Core/vtkGenericDataArray.txx index 0ea6cfb2c1f0013a1c579aae2e6b2847660633f1..4f916cf0a5755949d0a1118cdf05545c11e02524 100644 --- a/Common/Core/vtkGenericDataArray.txx +++ b/Common/Core/vtkGenericDataArray.txx @@ -241,21 +241,21 @@ vtkGenericDataArray::WritePointer(vtkIdType id, vtkIdType //----------------------------------------------------------------------------- template -int vtkGenericDataArray::GetDataType() +int vtkGenericDataArray::GetDataType() const { return vtkTypeTraits::VTK_TYPE_ID; } //----------------------------------------------------------------------------- template -int vtkGenericDataArray::GetDataTypeSize() +int vtkGenericDataArray::GetDataTypeSize() const { return static_cast(sizeof(ValueType)); } //----------------------------------------------------------------------------- template -bool vtkGenericDataArray::HasStandardMemoryLayout() +bool vtkGenericDataArray::HasStandardMemoryLayout() const { // False by default, AoS should set true. return false; diff --git a/Common/Core/vtkIdTypeArray.h b/Common/Core/vtkIdTypeArray.h index 64ffd8527fc3b091c10cb3b721d974ce824d5467..e0423c274942da6ec0b21ccfa0f68e3935f237bd 100644 --- a/Common/Core/vtkIdTypeArray.h +++ b/Common/Core/vtkIdTypeArray.h @@ -52,7 +52,7 @@ public: /** * Get the data type. */ - int GetDataType() override + int GetDataType() const override { // This needs to overwritten from superclass because // the templated superclass is not able to differentiate diff --git a/Common/Core/vtkMappedDataArray.h b/Common/Core/vtkMappedDataArray.h index e72834e08e70c82674418fb7a842c836a67051e3..6260eb2ab562376a21f37956f35a23f6cfcd2948 100644 --- a/Common/Core/vtkMappedDataArray.h +++ b/Common/Core/vtkMappedDataArray.h @@ -29,7 +29,7 @@ * * @attention * Subclasses that hold vtkIdType elements must also - * reimplement `int GetDataType()` (see Caveat in vtkTypedDataArray). + * reimplement `int GetDataType() const` (see Caveat in vtkTypedDataArray). */ #ifndef vtkMappedDataArray_h @@ -119,13 +119,13 @@ public: void Modified() override; // vtkAbstractArray override: - bool HasStandardMemoryLayout() override { return false; } + bool HasStandardMemoryLayout() const override { return false; } protected: vtkMappedDataArray(); ~vtkMappedDataArray() override; - int GetArrayType() override { return vtkAbstractArray::MappedDataArray; } + int GetArrayType() const override { return vtkAbstractArray::MappedDataArray; } private: vtkMappedDataArray(const vtkMappedDataArray&) = delete; diff --git a/Common/Core/vtkPoints.cxx b/Common/Core/vtkPoints.cxx index be846ac9e63430473988617645c9939ce1412007..6d3a3d4ccc760909c42f713c1d44fa403c42dd5b 100644 --- a/Common/Core/vtkPoints.cxx +++ b/Common/Core/vtkPoints.cxx @@ -135,7 +135,7 @@ void vtkPoints::Modified() } } -int vtkPoints::GetDataType() +int vtkPoints::GetDataType() const { return this->Data->GetDataType(); } diff --git a/Common/Core/vtkPoints.h b/Common/Core/vtkPoints.h index 2a975a65aafae0739ee7191a69fe87fb4ece8551..7344ea1d110b0d7a35d70e5b525ef9d202d697ae 100644 --- a/Common/Core/vtkPoints.h +++ b/Common/Core/vtkPoints.h @@ -65,7 +65,7 @@ public: * Return the underlying data type. An integer indicating data type is * returned as specified in vtkSetGet.h. */ - virtual int GetDataType(); + virtual int GetDataType() const; /** * Specify the underlying data type of the object. diff --git a/Common/Core/vtkPoints2D.cxx b/Common/Core/vtkPoints2D.cxx index 320948917ee9c2844234584adf5e18700513e750..aa43a0473c5dc67b40e7f6bb0e13c8cda8149c9e 100644 --- a/Common/Core/vtkPoints2D.cxx +++ b/Common/Core/vtkPoints2D.cxx @@ -137,7 +137,7 @@ void vtkPoints2D::Initialize() this->Modified(); } -int vtkPoints2D::GetDataType() +int vtkPoints2D::GetDataType() const { return this->Data->GetDataType(); } diff --git a/Common/Core/vtkPoints2D.h b/Common/Core/vtkPoints2D.h index 45effca6362af05bc41a5e0a3e7164f235062d32..094820ceaaff2270f130b305b6f94c7cd5c26190 100644 --- a/Common/Core/vtkPoints2D.h +++ b/Common/Core/vtkPoints2D.h @@ -65,7 +65,7 @@ public: * Return the underlying data type. An integer indicating data type is * returned as specified in vtkSetGet.h. */ - virtual int GetDataType(); + virtual int GetDataType() const; /** * Specify the underlying data type of the object. diff --git a/Common/Core/vtkSOADataArrayTemplate.h b/Common/Core/vtkSOADataArrayTemplate.h index 34f28fa5fcad952cd3b31973b7b2be2605c316a4..4746eab2b8bc924270b8abe047eea5c794702051 100644 --- a/Common/Core/vtkSOADataArrayTemplate.h +++ b/Common/Core/vtkSOADataArrayTemplate.h @@ -202,7 +202,7 @@ public: //@} #endif - int GetArrayType() override { return vtkAbstractArray::SoADataArrayTemplate; } + int GetArrayType() const override { return vtkAbstractArray::SoADataArrayTemplate; } VTK_NEWINSTANCE vtkArrayIterator* NewIterator() override; void SetNumberOfComponents(int numComps) override; void ShallowCopy(vtkDataArray* other) override; diff --git a/Common/Core/vtkScaledSOADataArrayTemplate.h b/Common/Core/vtkScaledSOADataArrayTemplate.h index 89ce729206c7269be3658f674b81a9184c139426..30de99f8587feef4f174720d80c4ce1609a815d8 100644 --- a/Common/Core/vtkScaledSOADataArrayTemplate.h +++ b/Common/Core/vtkScaledSOADataArrayTemplate.h @@ -231,7 +231,7 @@ public: //@} #endif - int GetArrayType() override { return vtkAbstractArray::ScaleSoADataArrayTemplate; } + int GetArrayType() const override { return vtkAbstractArray::ScaleSoADataArrayTemplate; } VTK_NEWINSTANCE vtkArrayIterator* NewIterator() override; void SetNumberOfComponents(int numComps) override; void ShallowCopy(vtkDataArray* other) override; diff --git a/Common/Core/vtkStringArray.cxx b/Common/Core/vtkStringArray.cxx index 31dc784c9688641203745c350f2184cd10b6b717..073a4a273334863ec6950d026c24114fb560294b 100644 --- a/Common/Core/vtkStringArray.cxx +++ b/Common/Core/vtkStringArray.cxx @@ -489,13 +489,13 @@ vtkIdType vtkStringArray::InsertNextValue(vtkStdString f) } // ---------------------------------------------------------------------------- -int vtkStringArray::GetDataTypeSize() +int vtkStringArray::GetDataTypeSize() const { return static_cast(sizeof(vtkStdString)); } // ---------------------------------------------------------------------------- -unsigned long vtkStringArray::GetActualMemorySize() +unsigned long vtkStringArray::GetActualMemorySize() const { size_t totalSize = 0; size_t numPrims = static_cast(this->GetSize()); @@ -510,7 +510,7 @@ unsigned long vtkStringArray::GetActualMemorySize() } // ---------------------------------------------------------------------------- -vtkIdType vtkStringArray::GetDataSize() +vtkIdType vtkStringArray::GetDataSize() const { size_t size = 0; size_t numStrs = static_cast(this->GetMaxId() + 1); diff --git a/Common/Core/vtkStringArray.h b/Common/Core/vtkStringArray.h index e2edf08503aa9fabc8d70462c16139adbe767900..d9c9145c38817f02393192dee54b70f19454d9d1 100644 --- a/Common/Core/vtkStringArray.h +++ b/Common/Core/vtkStringArray.h @@ -57,9 +57,9 @@ public: /** * Get the data type. */ - int GetDataType() override { return VTK_STRING; } + int GetDataType() const override { return VTK_STRING; } - int IsNumeric() override { return 0; } + int IsNumeric() const override { return 0; } /** * Release storage and reset array to initial state. @@ -72,7 +72,7 @@ public: * sizeof(std::string) and not take into account the data * included in any particular string. */ - int GetDataTypeSize() override; + int GetDataTypeSize() const override; /** * Free any unnecessary memory. @@ -196,7 +196,7 @@ public: vtkIdType GetNumberOfValues() { return this->MaxId + 1; } int GetNumberOfElementComponents() { return 0; } - int GetElementComponentSize() override + int GetElementComponentSize() const override { return static_cast(sizeof(vtkStdString::value_type)); } @@ -287,7 +287,7 @@ public: * This function takes into account the size of the contents of the * strings as well as the string containers themselves. */ - unsigned long GetActualMemorySize() override; + unsigned long GetActualMemorySize() const override; /** * Returns a vtkArrayIteratorTemplate. @@ -299,7 +299,7 @@ public: * for the data can be computed by GetDataSize() * GetDataTypeSize(). * The size computation includes the string termination character for each string. */ - vtkIdType GetDataSize() override; + vtkIdType GetDataSize() const override; //@{ /** diff --git a/Common/Core/vtkTypedDataArray.h b/Common/Core/vtkTypedDataArray.h index 83833cc0a5f69a68a8ca019b37b59e8b5f670d58..b0a8f74850d8cafcf2667b79171e08d10dd55cab 100644 --- a/Common/Core/vtkTypedDataArray.h +++ b/Common/Core/vtkTypedDataArray.h @@ -89,12 +89,12 @@ public: /** * Return the VTK data type held by this array. */ - int GetDataType() override; + int GetDataType() const override; /** * Return the size of the element type in bytes. */ - int GetDataTypeSize() override; + int GetDataTypeSize() const override; /** * Set the tuple value at the ith location in the array. @@ -149,7 +149,7 @@ public: /** * Method for type-checking in FastDownCast implementations. */ - int GetArrayType() override { return vtkAbstractArray::TypedDataArray; } + int GetArrayType() const override { return vtkAbstractArray::TypedDataArray; } // Reintroduced as pure virtual since the base vtkGenericDataArray method // requires new allocation/resize APIs, though existing MappedDataArrays diff --git a/Common/Core/vtkTypedDataArray.txx b/Common/Core/vtkTypedDataArray.txx index 30c2e72b026be64e048f808542eb605614189f4f..c960783115c612e96b77d8a320d210e63acc2f47 100644 --- a/Common/Core/vtkTypedDataArray.txx +++ b/Common/Core/vtkTypedDataArray.txx @@ -52,14 +52,14 @@ bool vtkTypedDataArray::ReallocateTuples(vtkIdType) //------------------------------------------------------------------------------ template -inline int vtkTypedDataArray::GetDataType() +inline int vtkTypedDataArray::GetDataType() const { return vtkTypeTraits::VTK_TYPE_ID; } //------------------------------------------------------------------------------ template -inline int vtkTypedDataArray::GetDataTypeSize() +inline int vtkTypedDataArray::GetDataTypeSize() const { return static_cast(sizeof(Scalar)); } diff --git a/Common/Core/vtkUnicodeStringArray.cxx b/Common/Core/vtkUnicodeStringArray.cxx index 7d9a8aa48abc10f3cc0b54c048477a0337d12a13..65524e61b7ee4b137f1ddff11bbf79319d295047 100644 --- a/Common/Core/vtkUnicodeStringArray.cxx +++ b/Common/Core/vtkUnicodeStringArray.cxx @@ -60,17 +60,17 @@ void vtkUnicodeStringArray::Initialize() this->DataChanged(); } -int vtkUnicodeStringArray::GetDataType() +int vtkUnicodeStringArray::GetDataType() const { return VTK_UNICODE_STRING; } -int vtkUnicodeStringArray::GetDataTypeSize() +int vtkUnicodeStringArray::GetDataTypeSize() const { return 0; } -int vtkUnicodeStringArray::GetElementComponentSize() +int vtkUnicodeStringArray::GetElementComponentSize() const { return sizeof(vtkUnicodeString::value_type); } @@ -312,7 +312,7 @@ void vtkUnicodeStringArray::SetArrayFreeFunction(void (*)(void*)) vtkErrorMacro("Not implemented."); } -unsigned long vtkUnicodeStringArray::GetActualMemorySize() +unsigned long vtkUnicodeStringArray::GetActualMemorySize() const { unsigned long count = 0; for (Implementation::StorageT::size_type i = 0; i != this->Internal->Storage.size(); ++i) @@ -323,7 +323,7 @@ unsigned long vtkUnicodeStringArray::GetActualMemorySize() return count; } -int vtkUnicodeStringArray::IsNumeric() +int vtkUnicodeStringArray::IsNumeric() const { return 0; } diff --git a/Common/Core/vtkUnicodeStringArray.h b/Common/Core/vtkUnicodeStringArray.h index 692f53ab5a0ae3e068a93ca4cc1512c377c990c6..65b82af2fdaa492d4a2bf43927879071d90a240e 100644 --- a/Common/Core/vtkUnicodeStringArray.h +++ b/Common/Core/vtkUnicodeStringArray.h @@ -45,9 +45,9 @@ public: vtkTypeBool Allocate(vtkIdType sz, vtkIdType ext = 1000) override; void Initialize() override; - int GetDataType() override; - int GetDataTypeSize() override; - int GetElementComponentSize() override; + int GetDataType() const override; + int GetDataTypeSize() const override; + int GetElementComponentSize() const override; void SetNumberOfTuples(vtkIdType number) override; void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) override; void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) override; @@ -66,8 +66,8 @@ public: void SetVoidArray(void* array, vtkIdType size, int save) override; void SetVoidArray(void* array, vtkIdType size, int save, int deleteMethod) override; void SetArrayFreeFunction(void (*callback)(void*)) override; - unsigned long GetActualMemorySize() override; // in bytes - int IsNumeric() override; + unsigned long GetActualMemorySize() const override; // in bytes + int IsNumeric() const override; VTK_NEWINSTANCE vtkArrayIterator* NewIterator() override; vtkVariant GetVariantValue(vtkIdType idx) override; vtkIdType LookupValue(vtkVariant value) override; diff --git a/Common/Core/vtkVariantArray.cxx b/Common/Core/vtkVariantArray.cxx index 8b24a40084602fee4191b71372e6a8783a51e09c..ffb188cae9dbf1443bcd419017a1791827ebfa7d 100644 --- a/Common/Core/vtkVariantArray.cxx +++ b/Common/Core/vtkVariantArray.cxx @@ -159,19 +159,19 @@ void vtkVariantArray::Initialize() } //---------------------------------------------------------------------------- -int vtkVariantArray::GetDataType() +int vtkVariantArray::GetDataType() const { return VTK_VARIANT; } //---------------------------------------------------------------------------- -int vtkVariantArray::GetDataTypeSize() +int vtkVariantArray::GetDataTypeSize() const { return static_cast(sizeof(vtkVariant)); } //---------------------------------------------------------------------------- -int vtkVariantArray::GetElementComponentSize() +int vtkVariantArray::GetElementComponentSize() const { return this->GetDataTypeSize(); } @@ -593,7 +593,7 @@ void vtkVariantArray::SetVoidArray(void* arr, vtkIdType size, int save, int dele } //---------------------------------------------------------------------------- -unsigned long vtkVariantArray::GetActualMemorySize() +unsigned long vtkVariantArray::GetActualMemorySize() const { // NOTE: Currently does not take into account the "pointed to" data. size_t totalSize = 0; @@ -605,7 +605,7 @@ unsigned long vtkVariantArray::GetActualMemorySize() } //---------------------------------------------------------------------------- -int vtkVariantArray::IsNumeric() +int vtkVariantArray::IsNumeric() const { return 0; } diff --git a/Common/Core/vtkVariantArray.h b/Common/Core/vtkVariantArray.h index c8439f5c93974353c79bd54868cf809e9c017080..a39b3b321fb190b16d95020d8cdcf4e9768a94f6 100644 --- a/Common/Core/vtkVariantArray.h +++ b/Common/Core/vtkVariantArray.h @@ -84,14 +84,14 @@ public: * Return the underlying data type. An integer indicating data type is * returned as specified in vtkSetGet.h. */ - int GetDataType() override; + int GetDataType() const override; /** * Return the size of the underlying data type. For a bit, 1 is * returned. For string 0 is returned. Arrays with variable length * components return 0. */ - int GetDataTypeSize() override; + int GetDataTypeSize() const override; /** * Return the size, in bytes, of the lowest-level element of an @@ -100,7 +100,7 @@ public: * sizeof(vtkStdString::value_type), which winds up being * sizeof(char). */ - int GetElementComponentSize() override; + int GetElementComponentSize() const override; /** * Set the number of tuples (a component group) in the array. Note that @@ -212,12 +212,12 @@ public: * information returned is valid only after the pipeline has * been updated. */ - unsigned long GetActualMemorySize() override; + unsigned long GetActualMemorySize() const override; /** * Since each item can be of a different type, we say that a variant array is not numeric. */ - int IsNumeric() override; + int IsNumeric() const override; /** * Subclasses must override this method and provide the right diff --git a/Common/Core/vtkVoidArray.h b/Common/Core/vtkVoidArray.h index 2957fc3d4e10d53fb1f50d9832b3410f3bec1f75..e08da09d9aadebb299eb5e34f35a6ca1269398bc 100644 --- a/Common/Core/vtkVoidArray.h +++ b/Common/Core/vtkVoidArray.h @@ -52,7 +52,7 @@ public: /** * Return the type of data. */ - int GetDataType() { return VTK_VOID; } + int GetDataType() const { return VTK_VOID; } /** * Return the size of the data contained in the array. diff --git a/Common/DataModel/vtkCellArray.cxx b/Common/DataModel/vtkCellArray.cxx index a8577cf1d3ee0252dcb618c4a0633d412740d2b0..30229226e5940d11301ac3b458d87497d97bfbde 100644 --- a/Common/DataModel/vtkCellArray.cxx +++ b/Common/DataModel/vtkCellArray.cxx @@ -1045,7 +1045,7 @@ int vtkCellArray::GetMaxCellSize() } //---------------------------------------------------------------------------- -unsigned long vtkCellArray::GetActualMemorySize() +unsigned long vtkCellArray::GetActualMemorySize() const { return this->Visit(GetActualMemorySizeImpl{}); } diff --git a/Common/DataModel/vtkCellArray.h b/Common/DataModel/vtkCellArray.h index 64364d270519ba0459b3faf94b100b67fe33fb29..bcbc3a3fbd9af0c682f5eefd8d5affed4cb49447 100644 --- a/Common/DataModel/vtkCellArray.h +++ b/Common/DataModel/vtkCellArray.h @@ -706,7 +706,7 @@ public: * information returned is valid only after the pipeline has * been updated. */ - unsigned long GetActualMemorySize(); + unsigned long GetActualMemorySize() const; // The wrappers get understandably confused by some of the template code below #ifndef __VTK_WRAP__ diff --git a/Common/DataModel/vtkPeriodicDataArray.h b/Common/DataModel/vtkPeriodicDataArray.h index b07f292201345232c1631cfb89f961246abb27f3..e59d6daf02c4f62f3f491d9a5b45321326fa1a46 100644 --- a/Common/DataModel/vtkPeriodicDataArray.h +++ b/Common/DataModel/vtkPeriodicDataArray.h @@ -143,7 +143,7 @@ public: /** * Return the memory in kilobytes consumed by this data array. */ - unsigned long GetActualMemorySize() override; + unsigned long GetActualMemorySize() const override; /** * Read only container, not supported. diff --git a/Common/DataModel/vtkPeriodicDataArray.txx b/Common/DataModel/vtkPeriodicDataArray.txx index fb4ff4d047357375d916e7dd1d17fed048a676b1..1f4dbdf7186ad17a56cdda6954e5004fa7088083 100644 --- a/Common/DataModel/vtkPeriodicDataArray.txx +++ b/Common/DataModel/vtkPeriodicDataArray.txx @@ -376,7 +376,7 @@ typename vtkPeriodicDataArray::ValueType vtkPeriodicDataArray::G //------------------------------------------------------------------------------ template -unsigned long int vtkPeriodicDataArray::GetActualMemorySize() +unsigned long int vtkPeriodicDataArray::GetActualMemorySize() const { return static_cast( (this->NumberOfComponents * (sizeof(Scalar) + sizeof(double)) + sizeof(*this)) / 1024);