Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::IPersistable Class Referenceabstract

Abstract interface for objects that can persist their state to and from files. More...

#include <mitkIPersistable.h>

Public Member Functions

virtual bool Save (const std::string &fileName="")=0
 Save the object's state to a file. More...
 
virtual bool Load (const std::string &fileName="")=0
 Load the object's state from a file. More...
 
virtual void SetId (const std::string &id)=0
 Set the unique identifier for this persistable object. More...
 
virtual std::string GetId () const =0
 Get the unique identifier of this persistable object. More...
 

Detailed Description

Abstract interface for objects that can persist their state to and from files.

Classes implementing this interface provide the ability to serialize their internal state to a file and restore it later. Each persistable object is identified by a unique string identifier.

See also
IPersistenceService
PersistenceService

Definition at line 28 of file mitkIPersistable.h.

Member Function Documentation

◆ GetId()

virtual std::string mitk::IPersistable::GetId ( ) const
pure virtual

Get the unique identifier of this persistable object.

Returns
The unique string identifier.

◆ Load()

virtual bool mitk::IPersistable::Load ( const std::string &  fileName = "")
pure virtual

Load the object's state from a file.

Parameters
[in]fileNamePath to the file to load from. If empty, a default file is used.
Returns
True if the state was loaded successfully, false otherwise.

◆ Save()

virtual bool mitk::IPersistable::Save ( const std::string &  fileName = "")
pure virtual

Save the object's state to a file.

Parameters
[in]fileNamePath to the file to save to. If empty, a default file is used.
Returns
True if the state was saved successfully, false otherwise.

◆ SetId()

virtual void mitk::IPersistable::SetId ( const std::string &  id)
pure virtual

Set the unique identifier for this persistable object.

Parameters
[in]idThe unique string identifier to assign.

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