//============================================================================ // Copyright (c) Kitware, Inc. // All rights reserved. // See LICENSE.txt for details. // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notice for more information. //============================================================================ #include #include namespace vtkm { namespace cont { namespace internal { template Storage::Storage() : StorageBasicBase() { } template Storage::Storage(const Storage& src) : StorageBasicBase(src) { } template Storage::Storage( Storage&& src) noexcept : StorageBasicBase(std::move(src)) { } template Storage::Storage(const T* array, vtkm::Id numberOfValues) : StorageBasicBase(const_cast(array), numberOfValues, sizeof(T)) { } template Storage::Storage(const T* array, vtkm::Id numberOfValues, void (*deleteFunction)(void*)) : StorageBasicBase(const_cast(array), numberOfValues, sizeof(T), deleteFunction) { } template Storage& Storage::Storage:: operator=(const Storage& src) { return static_cast&>(StorageBasicBase::operator=(src)); } template Storage& Storage::Storage:: operator=(Storage&& src) { return static_cast&>( StorageBasicBase::operator=(std::move(src))); } template void Storage::Allocate(vtkm::Id numberOfValues) { this->AllocateValues(numberOfValues, sizeof(T)); } template typename Storage::PortalType Storage::GetPortal() { auto v = static_cast(this->Array); return PortalType(v, v + this->NumberOfValues); } template typename Storage::PortalConstType Storage::GetPortalConst() const { auto v = static_cast(this->Array); return PortalConstType(v, v + this->NumberOfValues); } template T* Storage::GetArray() { return static_cast(this->Array); } template const T* Storage::GetArray() const { return static_cast(this->Array); } template vtkm::Pair Storage::StealArray() { vtkm::Pair result(static_cast(this->Array), this->DeleteFunction); this->DeleteFunction = nullptr; return result; } } // namespace internal } } // namespace vtkm::cont