Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::WeakPointerProperty Class Reference

Property containing a weak (non-owning) pointer to an itk::Object. More...

#include <mitkWeakPointerProperty.h>

Inheritance diagram for mitk::WeakPointerProperty:
Collaboration diagram for mitk::WeakPointerProperty:

Public Types

typedef itk::WeakPointer< itk::Object > ValueType
 The type of the value stored by this property. More...
 

Public Member Functions

 mitkClassMacro (WeakPointerProperty, BaseProperty)
 
Pointer Clone () const
 
 mitkNewMacro1Param (WeakPointerProperty, itk::Object *)
 
 ~WeakPointerProperty () override
 
ValueType GetWeakPointer () const
 Get the stored weak pointer. More...
 
ValueType GetValue () const
 Get the stored weak pointer (alias for GetWeakPointer()). More...
 
void SetWeakPointer (itk::Object *pointer)
 Set the stored weak pointer. More...
 
void SetValue (const ValueType &value)
 Set the stored weak pointer (alias for SetWeakPointer()). More...
 
std::string GetValueAsString () const override
 Return the pointer address as a string. More...
 
bool ToJSON (nlohmann::json &j) const override
 JSON serialization is not supported for WeakPointerProperty. More...
 
bool FromJSON (const nlohmann::json &j) override
 JSON deserialization is not supported for WeakPointerProperty. More...
 
BaseProperty & operator= (const BaseProperty &property)
 Assign a property value to this instance. More...
 
- Public Member Functions inherited from mitk::BaseProperty
 mitkClassMacroItkParent (BaseProperty, itk::Object)
 
Pointer Clone () const
 
bool operator== (const BaseProperty &property) const
 Compare two properties for equality. More...
 
BaseProperty & operator= (const BaseProperty &property)
 Assign a property value to this instance. More...
 
bool AssignProperty (const BaseProperty &property)
 Assign a property value to this instance and report success. More...
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 WeakPointerProperty (const WeakPointerProperty &)
 
 WeakPointerProperty (itk::Object *pointer=nullptr)
 
 mitkCloneMacro (WeakPointerProperty)
 
- Protected Member Functions inherited from mitk::BaseProperty
 BaseProperty ()
 
 BaseProperty (const BaseProperty &other)
 
 ~BaseProperty () override
 

Protected Attributes

itk::WeakPointer< itk::Object > m_WeakPointer
 

Additional Inherited Members

- Static Public Attributes inherited from mitk::BaseProperty
static const std::string VALUE_CANNOT_BE_CONVERTED_TO_STRING
 Default return value for properties that cannot be converted to a string. More...
 

Detailed Description

Property containing a weak (non-owning) pointer to an itk::Object.

Unlike SmartPointerProperty, this property does not prevent the referenced object from being deleted. The weak pointer becomes invalid if the referenced object is destroyed.

Note
This property does not support JSON serialization. ToJSON() and FromJSON() return false.
See also
BaseProperty
SmartPointerProperty

Definition at line 35 of file mitkWeakPointerProperty.h.

Member Typedef Documentation

◆ ValueType

typedef itk::WeakPointer<itk::Object> mitk::WeakPointerProperty::ValueType

The type of the value stored by this property.

Definition at line 48 of file mitkWeakPointerProperty.h.

Constructor & Destructor Documentation

◆ ~WeakPointerProperty()

mitk::WeakPointerProperty::~WeakPointerProperty ( )
override

◆ WeakPointerProperty() [1/2]

mitk::WeakPointerProperty::WeakPointerProperty ( const WeakPointerProperty &  )
protected

◆ WeakPointerProperty() [2/2]

mitk::WeakPointerProperty::WeakPointerProperty ( itk::Object *  pointer = nullptr)
protected

Member Function Documentation

◆ Clone()

Pointer mitk::WeakPointerProperty::Clone ( ) const

◆ FromJSON()

bool mitk::WeakPointerProperty::FromJSON ( const nlohmann::json &  j)
overridevirtual

JSON deserialization is not supported for WeakPointerProperty.

Parameters
[in]jUnused.
Returns
Always false.

Implements mitk::BaseProperty.

◆ GetValue()

ValueType mitk::WeakPointerProperty::GetValue ( ) const

Get the stored weak pointer (alias for GetWeakPointer()).

Returns
The itk::WeakPointer value.

◆ GetValueAsString()

std::string mitk::WeakPointerProperty::GetValueAsString ( ) const
overridevirtual

Return the pointer address as a string.

Returns
A string representation of the pointer address.

Reimplemented from mitk::BaseProperty.

◆ GetWeakPointer()

ValueType mitk::WeakPointerProperty::GetWeakPointer ( ) const

Get the stored weak pointer.

Returns
The itk::WeakPointer value.

◆ mitkClassMacro()

mitk::WeakPointerProperty::mitkClassMacro ( WeakPointerProperty  ,
BaseProperty   
)

◆ mitkCloneMacro()

mitk::WeakPointerProperty::mitkCloneMacro ( WeakPointerProperty  )
protected

◆ mitkNewMacro1Param()

mitk::WeakPointerProperty::mitkNewMacro1Param ( WeakPointerProperty  ,
itk::Object *   
)

◆ New()

static Pointer mitk::WeakPointerProperty::New ( )
static

◆ operator=()

BaseProperty& mitk::BaseProperty::operator=

Assign a property value to this instance.

Performs a polymorphic assignment from the given property. The assignment succeeds only if the source and target properties are of the same type. The subclass-specific Assign() method is called to perform the actual value copy.

Subclasses must implement Assign(const BaseProperty&) and call the superclass Assign method for proper handling. The copy assignment operator of the subclass should be disabled and the base class operator should be made visible using "using" statements.

Parameters
[in]propertyThe property whose value should be assigned to this instance.
Returns
A reference to this property.
See also
AssignProperty
Assign

◆ SetValue()

void mitk::WeakPointerProperty::SetValue ( const ValueType &  value)

Set the stored weak pointer (alias for SetWeakPointer()).

Parameters
[in]valueThe itk::WeakPointer value to set.

◆ SetWeakPointer()

void mitk::WeakPointerProperty::SetWeakPointer ( itk::Object *  pointer)

Set the stored weak pointer.

Parameters
[in]pointerThe itk::Object to point to, or nullptr.

◆ ToJSON()

bool mitk::WeakPointerProperty::ToJSON ( nlohmann::json &  j) const
overridevirtual

JSON serialization is not supported for WeakPointerProperty.

Parameters
[out]jUnused.
Returns
Always false.

Implements mitk::BaseProperty.

Member Data Documentation

◆ m_WeakPointer

itk::WeakPointer<itk::Object> mitk::WeakPointerProperty::m_WeakPointer
protected

Definition at line 101 of file mitkWeakPointerProperty.h.


The documentation for this class was generated from the following file: