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

Property containing a smart pointer to an itk::Object. More...

#include <mitkSmartPointerProperty.h>

Inheritance diagram for mitk::SmartPointerProperty:
Collaboration diagram for mitk::SmartPointerProperty:

Public Types

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

Public Member Functions

 mitkClassMacro (SmartPointerProperty, BaseProperty)
 
Pointer Clone () const
 
 mitkNewMacro1Param (SmartPointerProperty, itk::Object *)
 
itk::Object::Pointer GetSmartPointer () const
 Get the stored smart pointer. More...
 
ValueType GetValue () const
 Get the stored smart pointer (alias for GetSmartPointer()). More...
 
void SetSmartPointer (itk::Object *)
 Set the stored smart pointer. More...
 
void SetValue (const ValueType &)
 Set the stored smart pointer (alias for SetSmartPointer()). More...
 
std::string GetValueAsString () const override
 Return the UID of the pointed-to object as a string. More...
 
bool ToJSON (nlohmann::json &j) const override
 JSON serialization is not supported for SmartPointerProperty. More...
 
bool FromJSON (const nlohmann::json &j) override
 JSON deserialization is not supported for SmartPointerProperty. 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 ()
 
static void PostProcessXMLReading ()
 Resolve all smart pointer references after XML deserialization. More...
 
static unsigned int GetReferenceCountFor (itk::Object *)
 Get the number of SmartPointerProperties referencing the given object. More...
 
static std::string GetReferenceUIDFor (itk::Object *)
 Get the reference UID for the given object. More...
 
static void RegisterPointerTarget (itk::Object *, const std::string uid)
 Register an object as a potential target for XML deserialization. More...
 

Protected Member Functions

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

Protected Attributes

itk::Object::Pointer m_SmartPointer
 

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 smart pointer to an itk::Object.

Stores a reference-counted smart pointer to an arbitrary itk::Object. Internally tracks reference counts and UIDs for all pointed-to objects to support XML serialization and deserialization workflows.

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

Definition at line 39 of file mitkSmartPointerProperty.h.

Member Typedef Documentation

◆ ValueType

typedef itk::Object::Pointer mitk::SmartPointerProperty::ValueType

The type of the value stored by this property.

Definition at line 48 of file mitkSmartPointerProperty.h.

Constructor & Destructor Documentation

◆ SmartPointerProperty() [1/2]

mitk::SmartPointerProperty::SmartPointerProperty ( itk::Object *  = nullptr)
protected

◆ SmartPointerProperty() [2/2]

mitk::SmartPointerProperty::SmartPointerProperty ( const SmartPointerProperty &  )
protected

Member Function Documentation

◆ Clone()

Pointer mitk::SmartPointerProperty::Clone ( ) const

◆ FromJSON()

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

JSON deserialization is not supported for SmartPointerProperty.

Parameters
[in]jUnused.
Returns
Always false.

Implements mitk::BaseProperty.

◆ GetReferenceCountFor()

static unsigned int mitk::SmartPointerProperty::GetReferenceCountFor ( itk::Object *  )
static

Get the number of SmartPointerProperties referencing the given object.

Returns
The reference count (0 if not referenced by any SmartPointerProperty).

◆ GetReferenceUIDFor()

static std::string mitk::SmartPointerProperty::GetReferenceUIDFor ( itk::Object *  )
static

Get the reference UID for the given object.

Returns
The UID string, or "invalid" if the object is not tracked.

◆ GetSmartPointer()

itk::Object::Pointer mitk::SmartPointerProperty::GetSmartPointer ( ) const

Get the stored smart pointer.

Returns
The itk::Object smart pointer.

Referenced by mitk::NonBlockingAlgorithm::GetPointerParameter().

◆ GetValue()

ValueType mitk::SmartPointerProperty::GetValue ( ) const

Get the stored smart pointer (alias for GetSmartPointer()).

Returns
The itk::Object smart pointer.

◆ GetValueAsString()

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

Return the UID of the pointed-to object as a string.

Returns "nullptr" if the pointer is null.

Returns
The UID string of the referenced object.

Reimplemented from mitk::BaseProperty.

◆ mitkClassMacro()

mitk::SmartPointerProperty::mitkClassMacro ( SmartPointerProperty  ,
BaseProperty   
)

◆ mitkCloneMacro()

mitk::SmartPointerProperty::mitkCloneMacro ( SmartPointerProperty  )
protected

◆ mitkNewMacro1Param()

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

◆ New()

static Pointer mitk::SmartPointerProperty::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

◆ PostProcessXMLReading()

static void mitk::SmartPointerProperty::PostProcessXMLReading ( )
static

Resolve all smart pointer references after XML deserialization.

Iterates over all SmartPointerProperty instances that were read from XML and resolves their pointer targets from the registered target map.

◆ RegisterPointerTarget()

static void mitk::SmartPointerProperty::RegisterPointerTarget ( itk::Object *  ,
const std::string  uid 
)
static

Register an object as a potential target for XML deserialization.

Takes the target object and the UID string to associate with it.

◆ SetSmartPointer()

void mitk::SmartPointerProperty::SetSmartPointer ( itk::Object *  )

Set the stored smart pointer.

Updates internal reference counting and UID tracking. Marks the property as modified if the pointer changes.

Takes the new itk::Object to point to, or nullptr.

◆ SetValue()

void mitk::SmartPointerProperty::SetValue ( const ValueType &  )

Set the stored smart pointer (alias for SetSmartPointer()).

Takes the new itk::Object smart pointer.

◆ ToJSON()

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

JSON serialization is not supported for SmartPointerProperty.

Parameters
[out]jUnused.
Returns
Always false.

Implements mitk::BaseProperty.

Member Data Documentation

◆ m_SmartPointer

itk::Object::Pointer mitk::SmartPointerProperty::m_SmartPointer
protected

Definition at line 139 of file mitkSmartPointerProperty.h.


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