| 237 | // Deep copy of another string array. |
| 238 | |
| 239 | void vtkStringArray::DeepCopy(vtkAbstractArray* aa) |
| 240 | { |
| 241 | // Do nothing on a nullptr input. |
| 242 | if (!aa) |
| 243 | { |
| 244 | return; |
| 245 | } |
| 246 | |
| 247 | // Avoid self-copy. |
| 248 | if (this == aa) |
| 249 | { |
| 250 | return; |
| 251 | } |
| 252 | |
| 253 | // If data type does not match, we can't copy. |
| 254 | if (aa->GetDataType() != this->GetDataType()) |
| 255 | { |
| 256 | vtkErrorMacro(<< "Incompatible types: tried to copy an array of type " |
| 257 | << aa->GetDataTypeAsString() << " into a string array "); |
| 258 | return; |
| 259 | } |
| 260 | |
| 261 | vtkStringArray* fa = vtkArrayDownCast<vtkStringArray>(aa); |
| 262 | if (fa == nullptr) |
| 263 | { |
| 264 | vtkErrorMacro(<< "Shouldn't Happen: Couldn't downcast array into a vtkStringArray."); |
| 265 | return; |
| 266 | } |
| 267 | |
| 268 | // Free our previous memory. |
| 269 | if (this->DeleteFunction) |
| 270 | { |
| 271 | this->DeleteFunction(this->Array); |
| 272 | } |
| 273 | |
| 274 | this->Superclass::DeepCopy(aa); // copy information objects. |
| 275 | |
| 276 | // Copy the given array into new memory. |
| 277 | this->NumberOfComponents = aa->GetNumberOfComponents(); |
| 278 | this->MaxId = fa->GetMaxId(); |
| 279 | this->Size = fa->GetSize(); |
| 280 | this->DeleteFunction = DefaultDeleteFunction; |
| 281 | this->Array = new ValueType[this->Size]; |
| 282 | |
| 283 | for (int i = 0; i < this->Size; ++i) |
| 284 | { |
| 285 | this->Array[i] = fa->Array[i]; |
| 286 | } |
| 287 | this->DataChanged(); |
| 288 | } |
| 289 | |
| 290 | //------------------------------------------------------------------------------ |
| 291 | // Interpolate array value from other array value given the |
nothing calls this directly
no test coverage detected