29 #ifndef vtkSmartPointer_h
30 #define vtkSmartPointer_h
37 static T* CheckType(T* t) {
return t; }
88 return static_cast<T*
>(this->
Object);
92 return static_cast<T*
>(this->
Object);
101 return static_cast<T*
>(this->
Object);
110 return *
static_cast<T*
>(this->
Object);
118 return static_cast<T*
>(this->
Object);
177 #if defined(__HP_aCC) || defined(__IBMCPP__)
178 # define VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(op) \
179 bool operator op (NullPointerOnly*) const \
181 return ::operator op (*this, 0); \
184 class NullPointerOnly {};
186 VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(==)
187 VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(!=)
188 VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(<)
189 VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(<=)
190 VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(>)
191 VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND(>=)
192 # undef VTK_SMART_POINTER_DEFINE_OPERATOR_WORKAROUND
203 #define VTK_SMART_POINTER_DEFINE_OPERATOR(op) \
206 operator op (const vtkSmartPointer<T>& l, const vtkSmartPointer<T>& r) \
208 return (l.GetPointer() op r.GetPointer()); \
211 inline bool operator op (T* l, const vtkSmartPointer<T>& r) \
213 return (l op r.GetPointer()); \
216 inline bool operator op (const vtkSmartPointer<T>& l, T* r) \
218 return (l.GetPointer() op r); \
230 #undef VTK_SMART_POINTER_DEFINE_OPERATOR
236 inline ostream& operator << (ostream& os, const vtkSmartPointer<T>& p)
238 return os << static_cast<const vtkSmartPointerBase&>(p);
vtkSmartPointer()
Initialize smart pointer to NULL.
static vtkSmartPointer< T > Take(T *t)
Transfer ownership of one reference to the given VTK object to a new smart pointer.
static vtkSmartPointer< T > NewInstance(T *t)
Create a new instance of the given VTK object.
vtkSmartPointerBase & operator=(vtkObjectBase *r)
Assign object to reference.
vtkSmartPointer(T *r, const NoReference &n)
vtkSmartPointer & operator=(T *r)
Assign object to reference.
Hold a reference to a vtkObjectBase instance.
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
vtkSmartPointer & operator=(const vtkSmartPointer< U > &r)
Assign object to reference.
vtkSmartPointer(T *r)
Initialize smart pointer to given object.
Non-templated superclass for vtkSmartPointer.
void TakeReference(T *t)
Transfer ownership of one reference to the given VTK object to this smart pointer.
T * operator->() const
Provides normal pointer target member access using operator ->.
T * GetPointer() const
Get the contained pointer.
vtkSmartPointer(const vtkSmartPointer< U > &r)
Initialize smart pointer with a new reference to the same object referenced by given smart pointer...
T & operator*() const
Dereference the pointer and return a reference to the contained object.
#define VTK_SMART_POINTER_DEFINE_OPERATOR(op)
T * Get() const
Get the contained pointer.