------------------------------------------------------------------------------ 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
| 118 | // The class uses the actual array provided; it does not copy the data |
| 119 | // from the suppled array. |
| 120 | void vtkStringArray::SetArray(ValueType* array, vtkIdType size, int save, int deleteMethod) |
| 121 | { |
| 122 | if (this->Array && this->DeleteFunction) |
| 123 | { |
| 124 | vtkDebugMacro(<< "Deleting the array..."); |
| 125 | this->DeleteFunction(this->Array); |
| 126 | } |
| 127 | else |
| 128 | { |
| 129 | vtkDebugMacro(<< "Warning, array not deleted, but will point to new array."); |
| 130 | } |
| 131 | |
| 132 | vtkDebugMacro(<< "Setting array to: " << array); |
| 133 | |
| 134 | this->Array = array; |
| 135 | this->Size = size; |
| 136 | this->MaxId = size - 1; |
| 137 | |
| 138 | if (save != 0) |
| 139 | { |
| 140 | this->DeleteFunction = nullptr; |
| 141 | } |
| 142 | else if (deleteMethod == VTK_DATA_ARRAY_DELETE || deleteMethod == VTK_DATA_ARRAY_USER_DEFINED) |
| 143 | { |
| 144 | this->DeleteFunction = DefaultDeleteFunction; |
| 145 | } |
| 146 | else if (deleteMethod == VTK_DATA_ARRAY_ALIGNED_FREE) |
| 147 | { |
| 148 | #ifdef _WIN32 |
| 149 | this->DeleteFunction = _aligned_free; |
| 150 | #else |
| 151 | this->DeleteFunction = free; |
| 152 | #endif |
| 153 | } |
| 154 | else if (deleteMethod == VTK_DATA_ARRAY_FREE) |
| 155 | { |
| 156 | this->DeleteFunction = free; |
| 157 | } |
| 158 | |
| 159 | this->DataChanged(); |
| 160 | } |
| 161 | |
| 162 | //------------------------------------------------------------------------------ |
| 163 | void vtkStringArray::SetArrayFreeFunction(void (*callback)(void*)) |
nothing calls this directly
no test coverage detected