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

Base class of identifiable objects. More...

#include <mitkIdentifiable.h>

Inheritance diagram for mitk::Identifiable:

Public Types

using UIDType = std::string
 Type alias for unique identifiers. More...
 

Public Member Functions

 Identifiable ()
 Default constructor. Generates a new random UID. More...
 
 Identifiable (const UIDType &uid)
 Construct with a pre-existing UID. More...
 
 Identifiable (const Identifiable &)=delete
 Copy construction is deleted to prevent UID duplication. More...
 
 Identifiable (Identifiable &&) noexcept
 Move constructor. Transfers ownership of the UID. More...
 
virtual ~Identifiable ()
 Virtual destructor. More...
 
Identifiable & operator= (const Identifiable &)=delete
 Copy assignment is deleted to prevent UID duplication. More...
 
Identifiable & operator= (Identifiable &&other) noexcept
 Move assignment operator. Transfers ownership of the UID. More...
 
virtual UIDType GetUID () const
 Get the unique identifier of this object. More...
 
UIDType GetRuntimeUID () const noexcept
 Get a runtime-unique ID for this object instance. More...
 

Protected Member Functions

virtual void SetUID (const UIDType &uid)
 

Detailed Description

Base class of identifiable objects.

Provides a universally unique identifier (UID) for each instance. Other classes can inherit from Identifiable to gain this capability.

The UID is unique at creation time but is not content-dependent:

  • An instance may change its data over its lifetime and still keep the same UID.
  • If an instance is persisted and loaded multiple times, several in-memory objects may share the same UID.
  • UIDs are analogous to git paths (identifying an entity whose state may change) rather than git hashes. They abstract from memory addresses, enabling serialization.
  • It is up to the application to ensure appropriate UID usage within its scope.
Note
Identifiable itself is not inherently persistable. Derived classes decide if and how to persist their UID.
To change the UID after construction, use mitk::UIDManipulator. This indirection exists to discourage casual UID modification; it is intended for data readers only.
See also
UIDGenerator, UIDManipulator

Definition at line 45 of file mitkIdentifiable.h.

Member Typedef Documentation

◆ UIDType

using mitk::Identifiable::UIDType = std::string

Type alias for unique identifiers.

Definition at line 48 of file mitkIdentifiable.h.

Constructor & Destructor Documentation

◆ Identifiable() [1/4]

mitk::Identifiable::Identifiable ( )

Default constructor. Generates a new random UID.

◆ Identifiable() [2/4]

mitk::Identifiable::Identifiable ( const UIDType &  uid)
explicit

Construct with a pre-existing UID.

Parameters
[in]uidThe unique identifier to assign.

◆ Identifiable() [3/4]

mitk::Identifiable::Identifiable ( const Identifiable &  )
delete

Copy construction is deleted to prevent UID duplication.

◆ Identifiable() [4/4]

mitk::Identifiable::Identifiable ( Identifiable &&  )
noexcept

Move constructor. Transfers ownership of the UID.

◆ ~Identifiable()

virtual mitk::Identifiable::~Identifiable ( )
virtual

Virtual destructor.

Member Function Documentation

◆ GetRuntimeUID()

UIDType mitk::Identifiable::GetRuntimeUID ( ) const
noexcept

Get a runtime-unique ID for this object instance.

Unlike GetUID(), this ID is never persisted and never manipulated by readers. It is guaranteed unique for every distinct in-memory instance, derived from the object's memory address at construction time.

Thread-safe: written once in the constructor, read-only thereafter.

Note
Do not rely on this value after a move operation – the moved-to object inherits the original address.
Returns
A string representation of the construction-time memory address.

◆ GetUID()

virtual UIDType mitk::Identifiable::GetUID ( ) const
virtual

Get the unique identifier of this object.

Returns
The UID string. May be empty if the object has no UID.

Reimplemented in mitk::MAPRegistrationWrapper.

◆ operator=() [1/2]

Identifiable& mitk::Identifiable::operator= ( const Identifiable &  )
delete

Copy assignment is deleted to prevent UID duplication.

◆ operator=() [2/2]

Identifiable& mitk::Identifiable::operator= ( Identifiable &&  other)
noexcept

Move assignment operator. Transfers ownership of the UID.

Parameters
[in]otherThe source object (left in a valid but unspecified state).
Returns
Reference to this object.

◆ SetUID()

virtual void mitk::Identifiable::SetUID ( const UIDType &  uid)
protectedvirtual

Reimplemented in mitk::MAPRegistrationWrapper.


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