132#ifndef vtkSmartPointer_h
133#define vtkSmartPointer_h
140#include <type_traits>
150 template <
typename U = T>
151 static void CheckTypes()
noexcept
154 "vtkSmartPointer<T>'s T type has not been defined. Missing "
157 "Cannot store an object with undefined type in "
158 "vtkSmartPointer. Missing include?");
160 "Argument type is not compatible with vtkSmartPointer<T>'s "
163 "vtkSmartPointer can only be used with subclasses of "
191 vtkSmartPointer::CheckTypes<U>();
209 vtkSmartPointer::CheckTypes<U>();
220 vtkSmartPointer::CheckTypes();
223 template <
typename U>
227 vtkSmartPointer::CheckTypes<U>();
235 template <
typename U>
239 vtkSmartPointer::CheckTypes<U>();
260 vtkSmartPointer::CheckTypes<U>();
271 template <
typename U>
274 vtkSmartPointer::CheckTypes<U>();
284 template <
typename U>
287 vtkSmartPointer::CheckTypes<U>();
298 T*
Get() const noexcept {
return static_cast<T*
>(this->
Object); }
304 operator T*()
const noexcept {
return static_cast<T*
>(this->
Object); }
373#if defined(__HP_aCC) || defined(__IBMCPP__)
374#define VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(op) \
375 bool operator op(NullPointerOnly*) const { return ::operator op(*this, 0); }
378 class NullPointerOnly
383 VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(==)
384 VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(!=)
385 VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(<)
386 VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(<=)
387 VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(>)
388 VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(>=)
389#undef VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND
404#define VTK_SMART_POINTER_DEFINE_OPERATOR(op) \
405 template <class T, class U> \
406 inline bool operator op(const vtkSmartPointer<T>& l, const vtkSmartPointer<U>& r) \
408 return (l.GetPointer() op r.GetPointer()); \
410 template <class T, class U> \
411 inline bool operator op(T* l, const vtkSmartPointer<U>& r) \
413 return (l op r.GetPointer()); \
415 template <class T, class U> \
416 inline bool operator op(const vtkSmartPointer<T>& l, U* r) \
418 return (l.GetPointer() op r); \
420 template <class T, class U> \
421 inline bool operator op(const vtkNew<T>& l, const vtkSmartPointer<U>& r) \
423 return (l.GetPointer() op r.GetPointer()); \
425 template <class T, class U> \
426 inline bool operator op(const vtkSmartPointer<T>& l, const vtkNew<U>& r) \
428 return (l.GetPointer() op r.GetPointer); \
441#undef VTK_SMART_POINTER_DEFINE_OPERATOR
470 return os << static_cast<const vtkSmartPointerBase&>(p);
Allocate and hold a VTK object.
Non-templated superclass for vtkSmartPointer.
vtkSmartPointerBase & operator=(vtkObjectBase *r)
Assign object to reference.
vtkSmartPointerBase() noexcept
Initialize smart pointer to nullptr.
Hold a reference to a vtkObjectBase instance.
static vtkSmartPointer< T > NewInstance(T *t)
Create a new instance of the given VTK object.
vtkSmartPointer() noexcept
Initialize smart pointer to nullptr.
vtkSmartPointer(vtkNew< U > &&r) noexcept
Move the pointer from the vtkNew smart pointer to the new vtkSmartPointer, stealing its reference and...
vtkSmartPointer(const vtkSmartPointer &r)
Initialize smart pointer with a new reference to the same object referenced by given smart pointer.
vtkSmartPointer(T *r)
Initialize smart pointer to given object.
vtkSmartPointer & operator=(U *r)
Assign object to reference.
vtkSmartPointer(const vtkSmartPointer< U > &r)
Initialize smart pointer with a new reference to the same object referenced by given smart pointer.
void TakeReference(T *t)
Transfer ownership of one reference to the given VTK object to this smart pointer.
vtkSmartPointer(vtkSmartPointer &&r) noexcept
Move the contents of r into this.
vtkSmartPointer & operator=(const vtkSmartPointer &r)
Assign object to reference.
vtkSmartPointer & operator=(const vtkNew< U > &r)
Assign object to reference.
T * operator->() const noexcept
Provides normal pointer target member access using operator ->.
vtkSmartPointer(vtkSmartPointer< U > &&r) noexcept
Initialize smart pointer with a new reference to the same object referenced by given smart pointer.
static vtkSmartPointer< T > Take(T *t)
Transfer ownership of one reference to the given VTK object to a new smart pointer.
T * GetPointer() const noexcept
Get the contained pointer.
T & operator*() const noexcept
Dereference the pointer and return a reference to the contained object.
vtkSmartPointer & operator=(const vtkSmartPointer< U > &r)
Assign object to reference.
static vtkSmartPointer< T > ExtendedNew()
Create an instance of a VTK object in a memkind extended memory space.
vtkSmartPointer(T *r, const NoReference &n)
T * Get() const noexcept
Get the contained pointer.
vtkSmartPointer(const vtkNew< U > &r)
Initialize smart pointer to given object.
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
vtkSmartPointer< T > TakeSmartPointer(T *obj)
Construct a vtkSmartPointer<T> containing obj.
vtkSmartPointer< T > MakeSmartPointer(T *obj)
Construct a vtkSmartPointer<T> containing obj.
ostream & operator<<(ostream &os, const vtkSmartPointer< T > &p)
Streaming operator to print smart pointer like regular pointers.
#define VTK_SMART_POINTER_DEFINE_OPERATOR(op)