ITK
5.1.0
Insight Toolkit
|
#include <itkSmartPointer.h>
Public Types | |
template<typename T > | |
using | EnableIfConvertible = typename std::enable_if< std::is_convertible< T *, TObjectType * >::value > |
using | ObjectType = TObjectType |
Public Member Functions | |
constexpr | SmartPointer () noexcept |
SmartPointer (const SmartPointer &p) noexcept | |
template<typename T , typename = typename EnableIfConvertible<T>::type> | |
SmartPointer (const SmartPointer< T > &p) noexcept | |
SmartPointer (ObjectType *p) noexcept | |
SmartPointer (SmartPointer< ObjectType > &&p) noexcept | |
template<typename T , typename = typename EnableIfConvertible<T>::type> | |
SmartPointer (SmartPointer< T > &&p) noexcept | |
constexpr | SmartPointer (std::nullptr_t p) noexcept |
ObjectType * | m_Pointer |
template<typename T > | |
class | SmartPointer |
~SmartPointer () | |
ObjectType * | operator-> () const noexcept |
ObjectType & | operator* () const noexcept |
operator bool () const noexcept | |
operator ObjectType * () const noexcept | |
bool | IsNotNull () const noexcept |
bool | IsNull () const noexcept |
ObjectType * | GetPointer () const noexcept |
SmartPointer & | operator= (SmartPointer r) noexcept |
SmartPointer & | operator= (std::nullptr_t) noexcept |
ObjectType * | Print (std::ostream &os) const |
void | Swap (SmartPointer &other) noexcept |
void | Register () noexcept |
void | UnRegister () noexcept |
Implements transparent reference counting.
SmartPointer implements reference counting by overloading operator -> (and *) among others. This allows natural interface to the class referred to by the pointer without having to invoke special Register()/UnRegister() methods directly.
To compile / test this class Windows: cl SmartPointerTest.cxx; .\SmartPointerTest.exe linux: c++ SmartPointerTest.cxx ./a.out other: CCcompiler SmartPointerTest.cxx ./a.out
The state of the SmartPointer after a move
is with a value of nullptr
.
Definition at line 51 of file itkSmartPointer.h.
using itk::SmartPointer< TObjectType >::EnableIfConvertible = typename std::enable_if<std::is_convertible<T *, TObjectType *>::value> |
Definition at line 57 of file itkSmartPointer.h.
using itk::SmartPointer< TObjectType >::ObjectType = TObjectType |
Definition at line 54 of file itkSmartPointer.h.
|
inlineconstexprnoexcept |
Constructor
Definition at line 60 of file itkSmartPointer.h.
|
inlinenoexcept |
Copy constructor
Definition at line 65 of file itkSmartPointer.h.
|
inlineconstexprnoexcept |
Definition at line 71 of file itkSmartPointer.h.
|
inlinenoexcept |
constructor with implicit conversion of pointer type
Definition at line 77 of file itkSmartPointer.h.
|
inlinenoexcept |
Move constructor
Definition at line 84 of file itkSmartPointer.h.
|
inlinenoexcept |
move constructor with implicit conversion of pointer type
Definition at line 92 of file itkSmartPointer.h.
|
inlinenoexcept |
Constructor to pointer p
Definition at line 99 of file itkSmartPointer.h.
|
inline |
Destructor
Definition at line 106 of file itkSmartPointer.h.
|
inlinenoexcept |
Access function to pointer.
Definition at line 140 of file itkSmartPointer.h.
Referenced by itk::watershed::BoundaryResolver< TPixelType, TDimension >::BoundaryResolver(), itk::ObjectFactory< T >::Create(), itk::BSplineDeformableTransform< TParametersValueType, NDimensions, VSplineOrder >::CreateAnother(), itk::CreateObjectFunction< T >::CreateObject(), itk::watershed::EquivalenceRelabeler< TScalar, TImageDimension >::EquivalenceRelabeler(), itk::SpatialObjectFactoryBase::GetFactory(), itk::testhelper::ImageRegistrationMethodImageSource< TFixedPixelType, TMovingPixelType, NDimension >::GetFixedImage(), itk::GPUImageDataManager< itk::GPUImage >::GetImagePointer(), itk::v3::Rigid3DTransform< TParametersValueType >::GetInverseTransform(), itk::testhelper::ImageRegistrationMethodImageSource< TFixedPixelType, TMovingPixelType, NDimension >::GetMovingImage(), itk::HistogramThresholdCalculator< THistogram, TOutput >::MakeOutput(), itk::ImageRegistrationMethodv4< TFixedImage, TMovingImage, TOutputTransform, TVirtualImage, TPointSet >::MakeOutputTransform(), and itk::watershed::BoundaryResolver< TPixelType, TDimension >::SetEquivalencyTable().
|
inlinenoexcept |
Test if the pointer is not NULL.
Definition at line 125 of file itkSmartPointer.h.
Referenced by itk::BSplineResampleImageFunction< TImageType, TCoordRep >::SetInputImage().
|
inlinenoexcept |
Test if the pointer is NULL.
Definition at line 132 of file itkSmartPointer.h.
Referenced by itk::SmartPointer< const Self >::Print().
|
inlineexplicitnoexcept |
The pointer to the object referred to by this smart pointer.
Definition at line 118 of file itkSmartPointer.h.
|
inlinenoexcept |
Return pointer to object.
Definition at line 121 of file itkSmartPointer.h.
|
inlinenoexcept |
The pointer to the object referred to by this smart pointer.
Definition at line 116 of file itkSmartPointer.h.
|
inlinenoexcept |
Overload operator ->
Definition at line 114 of file itkSmartPointer.h.
|
inlinenoexcept |
Overload operator assignment.
This method is also implicitly used for move semantics. Additionally, it relies on constructors for additional conversion for pointer types.
Definition at line 153 of file itkSmartPointer.h.
|
inlinenoexcept |
The pointer to the object referred to by this smart pointer.
Definition at line 163 of file itkSmartPointer.h.
|
inline |
Function to print object pointed to
Definition at line 172 of file itkSmartPointer.h.
Referenced by itk::operator<<().
|
inlineprivatenoexcept |
The pointer to the object referred to by this smart pointer.
Definition at line 211 of file itkSmartPointer.h.
Referenced by itk::SmartPointer< const Self >::SmartPointer().
|
inlinenoexcept |
The pointer to the object referred to by this smart pointer.
Definition at line 196 of file itkSmartPointer.h.
Referenced by itk::SmartPointer< const Self >::operator=().
|
inlineprivatenoexcept |
The pointer to the object referred to by this smart pointer.
Definition at line 220 of file itkSmartPointer.h.
Referenced by itk::Directory::New(), itk::ScanlineFilterCommon< TInputImage, TOutputImage >::New(), itk::CellInterface< TPixelType, TCellTraits >::MultiVisitor::New(), itk::SmartPointer< const Self >::operator=(), and itk::SmartPointer< const Self >::~SmartPointer().
The pointer to the object referred to by this smart pointer.
Definition at line 208 of file itkSmartPointer.h.
|
private |
The pointer to the object referred to by this smart pointer.
Definition at line 205 of file itkSmartPointer.h.
Referenced by itk::SmartPointer< const Self >::GetPointer(), itk::SmartPointer< const Self >::IsNotNull(), itk::SmartPointer< const Self >::IsNull(), itk::SmartPointer< const Self >::operator bool(), itk::SmartPointer< const Self >::operator ObjectType *(), itk::SmartPointer< const Self >::operator*(), itk::SmartPointer< const Self >::operator->(), itk::SmartPointer< const Self >::operator=(), itk::SmartPointer< const Self >::Print(), itk::SmartPointer< const Self >::Register(), itk::SmartPointer< const Self >::Swap(), itk::SmartPointer< const Self >::UnRegister(), and itk::SmartPointer< const Self >::~SmartPointer().