MCPcopy Create free account
hub / github.com/Kitware/VTK / SetArray

Method SetArray

Common/Core/vtkVariantArray.cxx:770–810  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

768
769//------------------------------------------------------------------------------
770void vtkVariantArray::SetArray(ValueType* arr, vtkIdType size, int save, int deleteMethod)
771{
772 if ((this->Array) && (this->DeleteFunction))
773 {
774 vtkDebugMacro(<< "Deleting the array...");
775 this->DeleteFunction(this->Array);
776 }
777 else
778 {
779 vtkDebugMacro(<< "Warning, array not deleted, but will point to new array.");
780 }
781
782 vtkDebugMacro(<< "Setting array to: " << arr);
783
784 this->Array = arr;
785 this->Size = size;
786 this->MaxId = size - 1;
787
788 if (save != 0)
789 {
790 this->DeleteFunction = nullptr;
791 }
792 else if (deleteMethod == VTK_DATA_ARRAY_DELETE || deleteMethod == VTK_DATA_ARRAY_USER_DEFINED)
793 {
794 this->DeleteFunction = DefaultDeleteFunction;
795 }
796 else if (deleteMethod == VTK_DATA_ARRAY_ALIGNED_FREE)
797 {
798#ifdef _WIN32
799 this->DeleteFunction = _aligned_free;
800#else
801 this->DeleteFunction = free;
802#endif
803 }
804 else if (deleteMethod == VTK_DATA_ARRAY_FREE)
805 {
806 this->DeleteFunction = free;
807 }
808
809 this->DataChanged();
810}
811
812//------------------------------------------------------------------------------
813void vtkVariantArray::SetArrayFreeFunction(void (*callback)(void*))

Callers 1

SetVoidArrayMethod · 0.95

Calls 1

DataChangedMethod · 0.95

Tested by

no test coverage detected