From f6974622e6281b9a8e3e17249d33448f3ed650c0 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Sun, 24 Apr 2016 18:32:01 -0400 Subject: [PATCH 1/7] Made GetDataType method const --- Common/Core/vtkAOSDataArrayTemplate.h | 2 +- Common/Core/vtkAbstractArray.h | 2 +- Common/Core/vtkArrayIterator.h | 2 +- Common/Core/vtkArrayIteratorTemplate.h | 2 +- Common/Core/vtkArrayIteratorTemplate.txx | 2 +- Common/Core/vtkBitArray.h | 2 +- Common/Core/vtkBitArrayIterator.cxx | 2 +- Common/Core/vtkBitArrayIterator.h | 2 +- Common/Core/vtkGenericDataArray.h | 2 +- Common/Core/vtkGenericDataArray.txx | 2 +- Common/Core/vtkIdTypeArray.h | 2 +- Common/Core/vtkMappedDataArray.h | 2 +- Common/Core/vtkPoints.cxx | 2 +- Common/Core/vtkPoints.h | 2 +- Common/Core/vtkPoints2D.cxx | 2 +- Common/Core/vtkPoints2D.h | 2 +- Common/Core/vtkStringArray.h | 2 +- Common/Core/vtkTypedDataArray.h | 2 +- Common/Core/vtkTypedDataArray.txx | 2 +- Common/Core/vtkUnicodeStringArray.cxx | 2 +- Common/Core/vtkUnicodeStringArray.h | 4 ++-- Common/Core/vtkVariantArray.cxx | 2 +- Common/Core/vtkVariantArray.h | 2 +- Common/Core/vtkVoidArray.h | 2 +- 24 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Common/Core/vtkAOSDataArrayTemplate.h b/Common/Core/vtkAOSDataArrayTemplate.h index 73e9eed4fb6..a4a666f89f6 100644 --- a/Common/Core/vtkAOSDataArrayTemplate.h +++ b/Common/Core/vtkAOSDataArrayTemplate.h @@ -310,7 +310,7 @@ 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); \ diff --git a/Common/Core/vtkAbstractArray.h b/Common/Core/vtkAbstractArray.h index f9e3f0d8c50..ff2e17a7b7c 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; //@{ /** diff --git a/Common/Core/vtkArrayIterator.h b/Common/Core/vtkArrayIterator.h index b76c53126ce..42d4521fa4e 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 80490b4bef9..0b8fc078a1c 100644 --- a/Common/Core/vtkArrayIteratorTemplate.h +++ b/Common/Core/vtkArrayIteratorTemplate.h @@ -90,7 +90,7 @@ 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. diff --git a/Common/Core/vtkArrayIteratorTemplate.txx b/Common/Core/vtkArrayIteratorTemplate.txx index 451009ad8c9..c2f8c56df91 100644 --- a/Common/Core/vtkArrayIteratorTemplate.txx +++ b/Common/Core/vtkArrayIteratorTemplate.txx @@ -100,7 +100,7 @@ T* vtkArrayIteratorTemplate::GetTuple(vtkIdType id) //----------------------------------------------------------------------------- template -int vtkArrayIteratorTemplate::GetDataType() +int vtkArrayIteratorTemplate::GetDataType() const { return this->Array->GetDataType(); } diff --git a/Common/Core/vtkBitArray.h b/Common/Core/vtkBitArray.h index ffda42061ed..59590e08cd6 100644 --- a/Common/Core/vtkBitArray.h +++ b/Common/Core/vtkBitArray.h @@ -57,7 +57,7 @@ public: void Initialize() override; // satisfy vtkDataArray API - int GetDataType() override { return VTK_BIT; } + int GetDataType() const override { return VTK_BIT; } int GetDataTypeSize() override { return 0; } /** diff --git a/Common/Core/vtkBitArrayIterator.cxx b/Common/Core/vtkBitArrayIterator.cxx index dd3b4243c2e..bcf85fc1c47 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) { diff --git a/Common/Core/vtkBitArrayIterator.h b/Common/Core/vtkBitArrayIterator.h index 96535ecb98b..9e9eb5cc3d0 100644 --- a/Common/Core/vtkBitArrayIterator.h +++ b/Common/Core/vtkBitArrayIterator.h @@ -75,7 +75,7 @@ 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. diff --git a/Common/Core/vtkGenericDataArray.h b/Common/Core/vtkGenericDataArray.h index c783d7f6864..fd13f0696de 100644 --- a/Common/Core/vtkGenericDataArray.h +++ b/Common/Core/vtkGenericDataArray.h @@ -264,7 +264,7 @@ public: */ virtual void FillValue(ValueType value); - int GetDataType() override; + int GetDataType() const override; int GetDataTypeSize() override; bool HasStandardMemoryLayout() override; vtkTypeBool Allocate(vtkIdType size, vtkIdType ext = 1000) override; diff --git a/Common/Core/vtkGenericDataArray.txx b/Common/Core/vtkGenericDataArray.txx index 0ea6cfb2c1f..861ebf4071c 100644 --- a/Common/Core/vtkGenericDataArray.txx +++ b/Common/Core/vtkGenericDataArray.txx @@ -241,7 +241,7 @@ vtkGenericDataArray::WritePointer(vtkIdType id, vtkIdType //----------------------------------------------------------------------------- template -int vtkGenericDataArray::GetDataType() +int vtkGenericDataArray::GetDataType() const { return vtkTypeTraits::VTK_TYPE_ID; } diff --git a/Common/Core/vtkIdTypeArray.h b/Common/Core/vtkIdTypeArray.h index 64ffd8527fc..e0423c27494 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 e72834e08e7..33b66969351 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 diff --git a/Common/Core/vtkPoints.cxx b/Common/Core/vtkPoints.cxx index be846ac9e63..6d3a3d4ccc7 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 2a975a65aaf..7344ea1d110 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 320948917ee..aa43a0473c5 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 45effca6362..094820ceaaf 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/vtkStringArray.h b/Common/Core/vtkStringArray.h index e2edf08503a..2a9e4d3e3cc 100644 --- a/Common/Core/vtkStringArray.h +++ b/Common/Core/vtkStringArray.h @@ -57,7 +57,7 @@ public: /** * Get the data type. */ - int GetDataType() override { return VTK_STRING; } + int GetDataType() const override { return VTK_STRING; } int IsNumeric() override { return 0; } diff --git a/Common/Core/vtkTypedDataArray.h b/Common/Core/vtkTypedDataArray.h index 83833cc0a5f..30dacc92377 100644 --- a/Common/Core/vtkTypedDataArray.h +++ b/Common/Core/vtkTypedDataArray.h @@ -89,7 +89,7 @@ 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. diff --git a/Common/Core/vtkTypedDataArray.txx b/Common/Core/vtkTypedDataArray.txx index 30c2e72b026..a9c3153cdbe 100644 --- a/Common/Core/vtkTypedDataArray.txx +++ b/Common/Core/vtkTypedDataArray.txx @@ -52,7 +52,7 @@ bool vtkTypedDataArray::ReallocateTuples(vtkIdType) //------------------------------------------------------------------------------ template -inline int vtkTypedDataArray::GetDataType() +inline int vtkTypedDataArray::GetDataType() const { return vtkTypeTraits::VTK_TYPE_ID; } diff --git a/Common/Core/vtkUnicodeStringArray.cxx b/Common/Core/vtkUnicodeStringArray.cxx index 7d9a8aa48ab..3c0534ed46a 100644 --- a/Common/Core/vtkUnicodeStringArray.cxx +++ b/Common/Core/vtkUnicodeStringArray.cxx @@ -60,7 +60,7 @@ void vtkUnicodeStringArray::Initialize() this->DataChanged(); } -int vtkUnicodeStringArray::GetDataType() +int vtkUnicodeStringArray::GetDataType() const { return VTK_UNICODE_STRING; } diff --git a/Common/Core/vtkUnicodeStringArray.h b/Common/Core/vtkUnicodeStringArray.h index 692f53ab5a0..3fc3bfe6ecc 100644 --- a/Common/Core/vtkUnicodeStringArray.h +++ b/Common/Core/vtkUnicodeStringArray.h @@ -45,8 +45,8 @@ public: vtkTypeBool Allocate(vtkIdType sz, vtkIdType ext = 1000) override; void Initialize() override; - int GetDataType() override; - int GetDataTypeSize() override; + int GetDataType() const override; + int GetDataTypeSize() const override; int GetElementComponentSize() override; void SetNumberOfTuples(vtkIdType number) override; void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) override; diff --git a/Common/Core/vtkVariantArray.cxx b/Common/Core/vtkVariantArray.cxx index 8b24a400846..7c81a75b8bf 100644 --- a/Common/Core/vtkVariantArray.cxx +++ b/Common/Core/vtkVariantArray.cxx @@ -159,7 +159,7 @@ void vtkVariantArray::Initialize() } //---------------------------------------------------------------------------- -int vtkVariantArray::GetDataType() +int vtkVariantArray::GetDataType() const { return VTK_VARIANT; } diff --git a/Common/Core/vtkVariantArray.h b/Common/Core/vtkVariantArray.h index c8439f5c939..153aec47629 100644 --- a/Common/Core/vtkVariantArray.h +++ b/Common/Core/vtkVariantArray.h @@ -84,7 +84,7 @@ 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 diff --git a/Common/Core/vtkVoidArray.h b/Common/Core/vtkVoidArray.h index 2957fc3d4e1..e08da09d9aa 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. -- GitLab From d4513f98bf553469258e6614f63ada7a6a9902f8 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Sun, 24 Apr 2016 19:43:37 -0400 Subject: [PATCH 2/7] Made GetDataTypeSize and GetElementComponentSize methods const --- Common/Core/vtkAbstractArray.h | 4 ++-- Common/Core/vtkArrayIteratorTemplate.h | 2 +- Common/Core/vtkArrayIteratorTemplate.txx | 2 +- Common/Core/vtkBitArray.h | 2 +- Common/Core/vtkBitArrayIterator.cxx | 2 +- Common/Core/vtkBitArrayIterator.h | 2 +- Common/Core/vtkDataArray.h | 2 +- Common/Core/vtkGenericDataArray.h | 2 +- Common/Core/vtkGenericDataArray.txx | 2 +- Common/Core/vtkStringArray.cxx | 2 +- Common/Core/vtkStringArray.h | 4 ++-- Common/Core/vtkTypedDataArray.h | 2 +- Common/Core/vtkTypedDataArray.txx | 2 +- Common/Core/vtkUnicodeStringArray.cxx | 4 ++-- Common/Core/vtkUnicodeStringArray.h | 2 +- Common/Core/vtkVariantArray.cxx | 4 ++-- Common/Core/vtkVariantArray.h | 4 ++-- 17 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Common/Core/vtkAbstractArray.h b/Common/Core/vtkAbstractArray.h index ff2e17a7b7c..6506ff72d7e 100644 --- a/Common/Core/vtkAbstractArray.h +++ b/Common/Core/vtkAbstractArray.h @@ -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; //@{ /** diff --git a/Common/Core/vtkArrayIteratorTemplate.h b/Common/Core/vtkArrayIteratorTemplate.h index 0b8fc078a1c..3878255b90b 100644 --- a/Common/Core/vtkArrayIteratorTemplate.h +++ b/Common/Core/vtkArrayIteratorTemplate.h @@ -95,7 +95,7 @@ public: /** * 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 c2f8c56df91..23c2f666d0b 100644 --- a/Common/Core/vtkArrayIteratorTemplate.txx +++ b/Common/Core/vtkArrayIteratorTemplate.txx @@ -107,7 +107,7 @@ int vtkArrayIteratorTemplate::GetDataType() const //----------------------------------------------------------------------------- template -int vtkArrayIteratorTemplate::GetDataTypeSize() +int vtkArrayIteratorTemplate::GetDataTypeSize() const { return this->Array->GetDataTypeSize(); } diff --git a/Common/Core/vtkBitArray.h b/Common/Core/vtkBitArray.h index 59590e08cd6..0bdabced9b2 100644 --- a/Common/Core/vtkBitArray.h +++ b/Common/Core/vtkBitArray.h @@ -58,7 +58,7 @@ public: // satisfy vtkDataArray API int GetDataType() const override { return VTK_BIT; } - int GetDataTypeSize() override { return 0; } + int GetDataTypeSize() const override { return 0; } /** * Set the number of n-tuples in the array. diff --git a/Common/Core/vtkBitArrayIterator.cxx b/Common/Core/vtkBitArrayIterator.cxx index bcf85fc1c47..6a51777543a 100644 --- a/Common/Core/vtkBitArrayIterator.cxx +++ b/Common/Core/vtkBitArrayIterator.cxx @@ -133,7 +133,7 @@ int vtkBitArrayIterator::GetDataType() const 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 9e9eb5cc3d0..69d6fb1f755 100644 --- a/Common/Core/vtkBitArrayIterator.h +++ b/Common/Core/vtkBitArrayIterator.h @@ -80,7 +80,7 @@ public: /** * 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.h b/Common/Core/vtkDataArray.h index 7d6ef255ca5..8e3253eda62 100644 --- a/Common/Core/vtkDataArray.h +++ b/Common/Core/vtkDataArray.h @@ -73,7 +73,7 @@ public: * 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; diff --git a/Common/Core/vtkGenericDataArray.h b/Common/Core/vtkGenericDataArray.h index fd13f0696de..97a439c8fb9 100644 --- a/Common/Core/vtkGenericDataArray.h +++ b/Common/Core/vtkGenericDataArray.h @@ -265,7 +265,7 @@ public: virtual void FillValue(ValueType value); int GetDataType() const override; - int GetDataTypeSize() override; + int GetDataTypeSize() const override; bool HasStandardMemoryLayout() override; vtkTypeBool Allocate(vtkIdType size, vtkIdType ext = 1000) override; vtkTypeBool Resize(vtkIdType numTuples) override; diff --git a/Common/Core/vtkGenericDataArray.txx b/Common/Core/vtkGenericDataArray.txx index 861ebf4071c..6073c32a4ec 100644 --- a/Common/Core/vtkGenericDataArray.txx +++ b/Common/Core/vtkGenericDataArray.txx @@ -248,7 +248,7 @@ int vtkGenericDataArray::GetDataType() const //----------------------------------------------------------------------------- template -int vtkGenericDataArray::GetDataTypeSize() +int vtkGenericDataArray::GetDataTypeSize() const { return static_cast(sizeof(ValueType)); } diff --git a/Common/Core/vtkStringArray.cxx b/Common/Core/vtkStringArray.cxx index 31dc784c968..79476f2c2f1 100644 --- a/Common/Core/vtkStringArray.cxx +++ b/Common/Core/vtkStringArray.cxx @@ -489,7 +489,7 @@ vtkIdType vtkStringArray::InsertNextValue(vtkStdString f) } // ---------------------------------------------------------------------------- -int vtkStringArray::GetDataTypeSize() +int vtkStringArray::GetDataTypeSize() const { return static_cast(sizeof(vtkStdString)); } diff --git a/Common/Core/vtkStringArray.h b/Common/Core/vtkStringArray.h index 2a9e4d3e3cc..e5dcaf46b9b 100644 --- a/Common/Core/vtkStringArray.h +++ b/Common/Core/vtkStringArray.h @@ -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)); } diff --git a/Common/Core/vtkTypedDataArray.h b/Common/Core/vtkTypedDataArray.h index 30dacc92377..4a580b89094 100644 --- a/Common/Core/vtkTypedDataArray.h +++ b/Common/Core/vtkTypedDataArray.h @@ -94,7 +94,7 @@ public: /** * 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. diff --git a/Common/Core/vtkTypedDataArray.txx b/Common/Core/vtkTypedDataArray.txx index a9c3153cdbe..c960783115c 100644 --- a/Common/Core/vtkTypedDataArray.txx +++ b/Common/Core/vtkTypedDataArray.txx @@ -59,7 +59,7 @@ inline int vtkTypedDataArray::GetDataType() const //------------------------------------------------------------------------------ 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 3c0534ed46a..5838d167f97 100644 --- a/Common/Core/vtkUnicodeStringArray.cxx +++ b/Common/Core/vtkUnicodeStringArray.cxx @@ -65,12 +65,12 @@ 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); } diff --git a/Common/Core/vtkUnicodeStringArray.h b/Common/Core/vtkUnicodeStringArray.h index 3fc3bfe6ecc..f3aef215484 100644 --- a/Common/Core/vtkUnicodeStringArray.h +++ b/Common/Core/vtkUnicodeStringArray.h @@ -47,7 +47,7 @@ public: void Initialize() override; int GetDataType() const override; int GetDataTypeSize() const override; - int GetElementComponentSize() 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; diff --git a/Common/Core/vtkVariantArray.cxx b/Common/Core/vtkVariantArray.cxx index 7c81a75b8bf..c63267460cf 100644 --- a/Common/Core/vtkVariantArray.cxx +++ b/Common/Core/vtkVariantArray.cxx @@ -165,13 +165,13 @@ int vtkVariantArray::GetDataType() const } //---------------------------------------------------------------------------- -int vtkVariantArray::GetDataTypeSize() +int vtkVariantArray::GetDataTypeSize() const { return static_cast(sizeof(vtkVariant)); } //---------------------------------------------------------------------------- -int vtkVariantArray::GetElementComponentSize() +int vtkVariantArray::GetElementComponentSize() const { return this->GetDataTypeSize(); } diff --git a/Common/Core/vtkVariantArray.h b/Common/Core/vtkVariantArray.h index 153aec47629..22bfa7e4714 100644 --- a/Common/Core/vtkVariantArray.h +++ b/Common/Core/vtkVariantArray.h @@ -91,7 +91,7 @@ public: * 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 -- GitLab From 5ebac51b79be8395b29f17a8d1765e98d99e23d1 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Sun, 24 Apr 2016 20:19:11 -0400 Subject: [PATCH 3/7] Made HasStandardMemoryLayout and HasAComponentName methods const --- Common/Core/vtkAOSDataArrayTemplate.h | 2 +- Common/Core/vtkAbstractArray.cxx | 4 ++-- Common/Core/vtkAbstractArray.h | 4 ++-- Common/Core/vtkGenericDataArray.h | 2 +- Common/Core/vtkGenericDataArray.txx | 2 +- Common/Core/vtkMappedDataArray.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Common/Core/vtkAOSDataArrayTemplate.h b/Common/Core/vtkAOSDataArrayTemplate.h index a4a666f89f6..2c1b929e3ff 100644 --- a/Common/Core/vtkAOSDataArrayTemplate.h +++ b/Common/Core/vtkAOSDataArrayTemplate.h @@ -265,7 +265,7 @@ public: int GetArrayType() 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: diff --git a/Common/Core/vtkAbstractArray.cxx b/Common/Core/vtkAbstractArray.cxx index 5ea22997f48..b2e010b535b 100644 --- a/Common/Core/vtkAbstractArray.cxx +++ b/Common/Core/vtkAbstractArray.cxx @@ -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 6506ff72d7e..0a5b3c53b4f 100644 --- a/Common/Core/vtkAbstractArray.h +++ b/Common/Core/vtkAbstractArray.h @@ -141,7 +141,7 @@ public: /** * 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 @@ -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 diff --git a/Common/Core/vtkGenericDataArray.h b/Common/Core/vtkGenericDataArray.h index 97a439c8fb9..0f23a9ab4be 100644 --- a/Common/Core/vtkGenericDataArray.h +++ b/Common/Core/vtkGenericDataArray.h @@ -266,7 +266,7 @@ public: int GetDataType() const override; int GetDataTypeSize() const override; - bool HasStandardMemoryLayout() 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 6073c32a4ec..4f916cf0a57 100644 --- a/Common/Core/vtkGenericDataArray.txx +++ b/Common/Core/vtkGenericDataArray.txx @@ -255,7 +255,7 @@ int vtkGenericDataArray::GetDataTypeSize() const //----------------------------------------------------------------------------- template -bool vtkGenericDataArray::HasStandardMemoryLayout() +bool vtkGenericDataArray::HasStandardMemoryLayout() const { // False by default, AoS should set true. return false; diff --git a/Common/Core/vtkMappedDataArray.h b/Common/Core/vtkMappedDataArray.h index 33b66969351..3132e94c1af 100644 --- a/Common/Core/vtkMappedDataArray.h +++ b/Common/Core/vtkMappedDataArray.h @@ -119,7 +119,7 @@ public: void Modified() override; // vtkAbstractArray override: - bool HasStandardMemoryLayout() override { return false; } + bool HasStandardMemoryLayout() const override { return false; } protected: vtkMappedDataArray(); -- GitLab From 229b3a947c80788117dc048ea5c5935eff013148 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Sun, 24 Apr 2016 20:21:33 -0400 Subject: [PATCH 4/7] Made GetArrayType method const --- Common/Core/vtkAOSDataArrayTemplate.h | 2 +- Common/Core/vtkAbstractArray.h | 2 +- Common/Core/vtkDataArray.h | 2 +- Common/Core/vtkMappedDataArray.h | 2 +- Common/Core/vtkSOADataArrayTemplate.h | 2 +- Common/Core/vtkScaledSOADataArrayTemplate.h | 2 +- Common/Core/vtkTypedDataArray.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Common/Core/vtkAOSDataArrayTemplate.h b/Common/Core/vtkAOSDataArrayTemplate.h index 2c1b929e3ff..aaf0a099eba 100644 --- a/Common/Core/vtkAOSDataArrayTemplate.h +++ b/Common/Core/vtkAOSDataArrayTemplate.h @@ -263,7 +263,7 @@ public: } //@} - int GetArrayType() override { return vtkAbstractArray::AoSDataArrayTemplate; } + int GetArrayType() const override { return vtkAbstractArray::AoSDataArrayTemplate; } VTK_NEWINSTANCE vtkArrayIterator* NewIterator() override; bool HasStandardMemoryLayout() const override { return true; } void ShallowCopy(vtkDataArray* other) override; diff --git a/Common/Core/vtkAbstractArray.h b/Common/Core/vtkAbstractArray.h index 0a5b3c53b4f..7a6fdb9bf95 100644 --- a/Common/Core/vtkAbstractArray.h +++ b/Common/Core/vtkAbstractArray.h @@ -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/vtkDataArray.h b/Common/Core/vtkDataArray.h index 8e3253eda62..126441fe49b 100644 --- a/Common/Core/vtkDataArray.h +++ b/Common/Core/vtkDataArray.h @@ -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/vtkMappedDataArray.h b/Common/Core/vtkMappedDataArray.h index 3132e94c1af..6260eb2ab56 100644 --- a/Common/Core/vtkMappedDataArray.h +++ b/Common/Core/vtkMappedDataArray.h @@ -125,7 +125,7 @@ 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/vtkSOADataArrayTemplate.h b/Common/Core/vtkSOADataArrayTemplate.h index 34f28fa5fca..4746eab2b8b 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 89ce729206c..30de99f8587 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/vtkTypedDataArray.h b/Common/Core/vtkTypedDataArray.h index 4a580b89094..b0a8f74850d 100644 --- a/Common/Core/vtkTypedDataArray.h +++ b/Common/Core/vtkTypedDataArray.h @@ -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 -- GitLab From b9ba195568bdfc87e49e6ebd67ad32fa0c3899c8 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Sun, 24 Apr 2016 21:11:27 -0400 Subject: [PATCH 5/7] Made IsNumeric and HasInformation methods const --- Common/Core/vtkAbstractArray.h | 4 ++-- Common/Core/vtkDataArray.h | 2 +- Common/Core/vtkStringArray.h | 2 +- Common/Core/vtkUnicodeStringArray.cxx | 2 +- Common/Core/vtkUnicodeStringArray.h | 2 +- Common/Core/vtkVariantArray.cxx | 2 +- Common/Core/vtkVariantArray.h | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Common/Core/vtkAbstractArray.h b/Common/Core/vtkAbstractArray.h index 7a6fdb9bf95..c6404b86e5a 100644 --- a/Common/Core/vtkAbstractArray.h +++ b/Common/Core/vtkAbstractArray.h @@ -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 @@ -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 diff --git a/Common/Core/vtkDataArray.h b/Common/Core/vtkDataArray.h index 126441fe49b..8de49600601 100644 --- a/Common/Core/vtkDataArray.h +++ b/Common/Core/vtkDataArray.h @@ -66,7 +66,7 @@ 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 diff --git a/Common/Core/vtkStringArray.h b/Common/Core/vtkStringArray.h index e5dcaf46b9b..2dfe44212ac 100644 --- a/Common/Core/vtkStringArray.h +++ b/Common/Core/vtkStringArray.h @@ -59,7 +59,7 @@ public: */ 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. diff --git a/Common/Core/vtkUnicodeStringArray.cxx b/Common/Core/vtkUnicodeStringArray.cxx index 5838d167f97..8a8b6335683 100644 --- a/Common/Core/vtkUnicodeStringArray.cxx +++ b/Common/Core/vtkUnicodeStringArray.cxx @@ -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 f3aef215484..4d3054b87be 100644 --- a/Common/Core/vtkUnicodeStringArray.h +++ b/Common/Core/vtkUnicodeStringArray.h @@ -67,7 +67,7 @@ public: 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; + 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 c63267460cf..fa584c62983 100644 --- a/Common/Core/vtkVariantArray.cxx +++ b/Common/Core/vtkVariantArray.cxx @@ -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 22bfa7e4714..7382f637cbf 100644 --- a/Common/Core/vtkVariantArray.h +++ b/Common/Core/vtkVariantArray.h @@ -217,7 +217,7 @@ public: /** * 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 -- GitLab From 0889a4b395ddf58fd692f3f40483e3a7a5b5e0b8 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 6 Dec 2018 21:24:21 -0500 Subject: [PATCH 6/7] Made more array APIs const --- Common/Core/vtkAOSDataArrayTemplate.h | 2 +- Common/Core/vtkAbstractArray.cxx | 2 +- Common/Core/vtkAbstractArray.h | 10 +++++----- Common/Core/vtkBitArray.cxx | 2 +- Common/Core/vtkBitArray.h | 2 +- Common/Core/vtkStringArray.cxx | 2 +- Common/Core/vtkStringArray.h | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Common/Core/vtkAOSDataArrayTemplate.h b/Common/Core/vtkAOSDataArrayTemplate.h index aaf0a099eba..9c8f13a2471 100644 --- a/Common/Core/vtkAOSDataArrayTemplate.h +++ b/Common/Core/vtkAOSDataArrayTemplate.h @@ -315,7 +315,7 @@ vtkArrayDownCast_TemplateFastCastMacro(vtkAOSDataArrayTemplate); 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 b2e010b535b..0ade36cfff9 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()) diff --git a/Common/Core/vtkAbstractArray.h b/Common/Core/vtkAbstractArray.h index c6404b86e5a..4a0a78d04dd 100644 --- a/Common/Core/vtkAbstractArray.h +++ b/Common/Core/vtkAbstractArray.h @@ -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,7 +136,7 @@ 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 @@ -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 @@ -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()); } @@ -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(); } diff --git a/Common/Core/vtkBitArray.cxx b/Common/Core/vtkBitArray.cxx index 4a31ecce661..f0d38020c07 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 0bdabced9b2..a0b4b660536 100644 --- a/Common/Core/vtkBitArray.h +++ b/Common/Core/vtkBitArray.h @@ -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/vtkStringArray.cxx b/Common/Core/vtkStringArray.cxx index 79476f2c2f1..059b325009a 100644 --- a/Common/Core/vtkStringArray.cxx +++ b/Common/Core/vtkStringArray.cxx @@ -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 2dfe44212ac..5a962771234 100644 --- a/Common/Core/vtkStringArray.h +++ b/Common/Core/vtkStringArray.h @@ -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; //@{ /** -- GitLab From 73394591b14fefdf4f9e05624c42fed31ce8d8e2 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Thu, 6 Dec 2018 23:14:27 -0500 Subject: [PATCH 7/7] Made GetActualMemorySize const --- Common/Core/vtkAbstractArray.h | 2 +- Common/Core/vtkDataArray.cxx | 2 +- Common/Core/vtkDataArray.h | 2 +- Common/Core/vtkStringArray.cxx | 2 +- Common/Core/vtkStringArray.h | 2 +- Common/Core/vtkUnicodeStringArray.cxx | 2 +- Common/Core/vtkUnicodeStringArray.h | 2 +- Common/Core/vtkVariantArray.cxx | 2 +- Common/Core/vtkVariantArray.h | 2 +- Common/DataModel/vtkCellArray.cxx | 2 +- Common/DataModel/vtkCellArray.h | 2 +- Common/DataModel/vtkPeriodicDataArray.h | 2 +- Common/DataModel/vtkPeriodicDataArray.txx | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Common/Core/vtkAbstractArray.h b/Common/Core/vtkAbstractArray.h index 4a0a78d04dd..5f0d7b6f5e6 100644 --- a/Common/Core/vtkAbstractArray.h +++ b/Common/Core/vtkAbstractArray.h @@ -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; //@{ /** diff --git a/Common/Core/vtkDataArray.cxx b/Common/Core/vtkDataArray.cxx index 77bbf34ebe0..d1e3b6a17f0 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 8de49600601..a28c545ba3c 100644 --- a/Common/Core/vtkDataArray.h +++ b/Common/Core/vtkDataArray.h @@ -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 diff --git a/Common/Core/vtkStringArray.cxx b/Common/Core/vtkStringArray.cxx index 059b325009a..073a4a27333 100644 --- a/Common/Core/vtkStringArray.cxx +++ b/Common/Core/vtkStringArray.cxx @@ -495,7 +495,7 @@ int vtkStringArray::GetDataTypeSize() const } // ---------------------------------------------------------------------------- -unsigned long vtkStringArray::GetActualMemorySize() +unsigned long vtkStringArray::GetActualMemorySize() const { size_t totalSize = 0; size_t numPrims = static_cast(this->GetSize()); diff --git a/Common/Core/vtkStringArray.h b/Common/Core/vtkStringArray.h index 5a962771234..d9c9145c388 100644 --- a/Common/Core/vtkStringArray.h +++ b/Common/Core/vtkStringArray.h @@ -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. diff --git a/Common/Core/vtkUnicodeStringArray.cxx b/Common/Core/vtkUnicodeStringArray.cxx index 8a8b6335683..65524e61b7e 100644 --- a/Common/Core/vtkUnicodeStringArray.cxx +++ b/Common/Core/vtkUnicodeStringArray.cxx @@ -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) diff --git a/Common/Core/vtkUnicodeStringArray.h b/Common/Core/vtkUnicodeStringArray.h index 4d3054b87be..65b82af2fda 100644 --- a/Common/Core/vtkUnicodeStringArray.h +++ b/Common/Core/vtkUnicodeStringArray.h @@ -66,7 +66,7 @@ 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 + unsigned long GetActualMemorySize() const override; // in bytes int IsNumeric() const override; VTK_NEWINSTANCE vtkArrayIterator* NewIterator() override; vtkVariant GetVariantValue(vtkIdType idx) override; diff --git a/Common/Core/vtkVariantArray.cxx b/Common/Core/vtkVariantArray.cxx index fa584c62983..ffb188cae9d 100644 --- a/Common/Core/vtkVariantArray.cxx +++ b/Common/Core/vtkVariantArray.cxx @@ -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; diff --git a/Common/Core/vtkVariantArray.h b/Common/Core/vtkVariantArray.h index 7382f637cbf..a39b3b321fb 100644 --- a/Common/Core/vtkVariantArray.h +++ b/Common/Core/vtkVariantArray.h @@ -212,7 +212,7 @@ 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. diff --git a/Common/DataModel/vtkCellArray.cxx b/Common/DataModel/vtkCellArray.cxx index a8577cf1d3e..30229226e59 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 64364d27051..bcbc3a3fbd9 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 b07f2922013..e59d6daf02c 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 fb4ff4d0473..1f4dbdf7186 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); -- GitLab