55VTK_ABI_NAMESPACE_BEGIN
73 template <
typename U = T>
74 static void CheckTypes() noexcept
77 "vtkNew<T>'s T type has not been defined. Missing include?");
79 "Cannot store an object with undefined type in "
80 "vtkNew. Missing include?");
81 static_assert(std::is_base_of<T, U>::value,
82 "Argument type is not compatible with vtkNew<T>'s "
84 static_assert(std::is_base_of<vtkObjectBase, T>::value,
85 "vtkNew can only be used with subclasses of vtkObjectBase.");
109 template <
typename U>
113 vtkNew::CheckTypes<U>();
127 T* obj = this->Object;
130 this->Object =
nullptr;
150 T*
Get() const noexcept {
return this->Object; }
151 operator T*()
const noexcept {
return static_cast<T*
>(this->Object); }
159 T&
operator*() const noexcept {
return *
static_cast<T*
>(this->Object); }
167 this->Object = other.Object;
168 other.Object =
nullptr;
Allocate and hold a VTK object.
void Reset()
Deletes reference to instance of T.
T * Get() const noexcept
Get a raw pointer to the contained object.
vtkNew()
Create a new T on construction.
T * operator->() const noexcept
Enable pointer-like dereference syntax.
vtkNew(vtkNew &&o) noexcept
Move the object into the constructed vtkNew wrapper, stealing its reference.
~vtkNew()
Deletes reference to instance of T.
vtkNew(vtkNew< U > &&o) noexcept
Move the object into the constructed vtkNew wrapper, stealing its reference.
T * GetPointer() const noexcept
Get a raw pointer to the contained object.
T & operator*() const noexcept
Dereference the pointer and return a reference to the contained object.
vtkNew< T > & operator=(vtkNew< T > &&other) noexcept
Move assignment operator.
abstract base class for most VTK objects
Hold a reference to a vtkObjectBase instance.
a weak reference to a vtkObject.