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

Implementation of the IPreferencesService interface. More...

#include <mitkPreferencesService.h>

Inheritance diagram for mitk::PreferencesService:
Collaboration diagram for mitk::PreferencesService:

Public Member Functions

 PreferencesService ()
 
 ~PreferencesService () override
 Destructor that flushes pending preferences to disk. More...
 
void InitializeStorage (const fs::path &filename) override
 Initialize the backing storage from the given file. More...
 
void UninitializeStorage (bool removeFile) override
 Uninitialize the storage and optionally remove the backing file. More...
 
IPreferences * GetSystemPreferences () override
 Get the root preferences node. More...
 
- Public Member Functions inherited from mitk::IPreferencesService
virtual ~IPreferencesService ()
 If initialized, ask the preferences backend to flush preferences, i.e. write them to disk. More...
 
virtual bool OpenPreferencesDialog (const std::string &page={})
 Opens the preferences dialog, if available. More...
 

Detailed Description

Implementation of the IPreferencesService interface.

Manages a single IPreferencesStorage instance that persists preferences to disk. The storage is initialized lazily via InitializeStorage() and must only be initialized once during the service lifetime. On destruction, any existing storage is flushed to disk.

Only used through the IPreferencesService interface.

See also
IPreferencesService
XMLPreferencesStorage
IPreferences

Definition at line 38 of file mitkPreferencesService.h.

Constructor & Destructor Documentation

◆ PreferencesService()

mitk::PreferencesService::PreferencesService ( )

◆ ~PreferencesService()

mitk::PreferencesService::~PreferencesService ( )
override

Destructor that flushes pending preferences to disk.

Member Function Documentation

◆ GetSystemPreferences()

IPreferences* mitk::PreferencesService::GetSystemPreferences ( )
overridevirtual

Get the root preferences node.

Returns
The root IPreferences node, or nullptr if storage is not initialized.

Implements mitk::IPreferencesService.

◆ InitializeStorage()

void mitk::PreferencesService::InitializeStorage ( const fs::path &  filename)
overridevirtual

Initialize the backing storage from the given file.

Must be called exactly once. A second call will throw an exception to guarantee that preference pointers remain valid for the service lifetime.

Parameters
[in]filenamePath to the preferences XML file.
Exceptions
mitk::Exceptionif called more than once.

Implements mitk::IPreferencesService.

◆ UninitializeStorage()

void mitk::PreferencesService::UninitializeStorage ( bool  removeFile)
overridevirtual

Uninitialize the storage and optionally remove the backing file.

Parameters
[in]removeFileIf true, the preferences file is deleted from disk.

Implements mitk::IPreferencesService.


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