------------------------------------------------------------------------------ This method lets the user specify data to be held by the array. The array argument is a pointer to the data. size is the size of the array supplied by the user. Set save to 1 to keep the class from deleting the array when it cleans up or reallocates memory. The class uses the actual array provided; it does not copy t
| 114 | // The class uses the actual array provided; it does not copy the data |
| 115 | // from the supplied array. |
| 116 | void vtkBitArray::SetArray(ValueType* array, vtkIdType size, int save, int deleteMethod) |
| 117 | { |
| 118 | if ((this->Array) && (this->DeleteFunction)) |
| 119 | { |
| 120 | vtkDebugMacro(<< "Deleting the array..."); |
| 121 | this->DeleteFunction(this->Array); |
| 122 | } |
| 123 | else |
| 124 | { |
| 125 | vtkDebugMacro(<< "Warning, array not deleted, but will point to new array."); |
| 126 | } |
| 127 | |
| 128 | vtkDebugMacro(<< "Setting array to: " << array); |
| 129 | |
| 130 | this->Array = array; |
| 131 | this->Size = size; |
| 132 | this->MaxId = size - 1; |
| 133 | this->InitializeUnusedBitsInLastByte(); |
| 134 | |
| 135 | if (save != 0) |
| 136 | { |
| 137 | this->DeleteFunction = nullptr; |
| 138 | } |
| 139 | else if (deleteMethod == VTK_DATA_ARRAY_DELETE || deleteMethod == VTK_DATA_ARRAY_USER_DEFINED) |
| 140 | { |
| 141 | this->DeleteFunction = ::operator delete[]; |
| 142 | } |
| 143 | else if (deleteMethod == VTK_DATA_ARRAY_ALIGNED_FREE) |
| 144 | { |
| 145 | #ifdef _WIN32 |
| 146 | this->DeleteFunction = _aligned_free; |
| 147 | #else |
| 148 | this->DeleteFunction = free; |
| 149 | #endif |
| 150 | } |
| 151 | else if (deleteMethod == VTK_DATA_ARRAY_FREE) |
| 152 | { |
| 153 | this->DeleteFunction = free; |
| 154 | } |
| 155 | |
| 156 | this->DataChanged(); |
| 157 | } |
| 158 | |
| 159 | //------------------------------------------------------------------------------ |
| 160 | void vtkBitArray::SetArrayFreeFunction(void (*callback)(void*)) |
nothing calls this directly
no test coverage detected