|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
The central service for the persistence module. More...
#include <mitkIPersistenceService.h>

Public Member Functions | |
| virtual mitk::PropertyList::Pointer | GetPropertyList (std::string &id, bool *existed=nullptr)=0 |
| Get or create a PropertyList with the given id. More... | |
| virtual bool | RemovePropertyList (std::string &id)=0 |
| Remove the PropertyList with the given id. More... | |
| virtual std::string | GetDefaultPersistenceFile ()=0 |
| Get the default name of the persistence file (the one that is loaded at startup). More... | |
| virtual std::string | GetPersistenceNodePropertyName ()=0 |
| Get the name of the BoolProperty that marks persistence DataNodes. More... | |
| virtual DataStorage::SetOfObjects::Pointer | GetDataNodes (DataStorage *ds=nullptr)=0 |
| Create DataNodes containing all PropertyLists. More... | |
| virtual bool | RestorePropertyListsFromPersistentDataNodes (const DataStorage *storage)=0 |
| Restore PropertyLists from persistent DataNodes in the given storage. More... | |
| virtual bool | Save (const std::string &fileName="", bool appendChanges=false)=0 |
| Save the current PropertyLists to a file. More... | |
| virtual bool | Load (const std::string &fileName="", bool enforeReload=true)=0 |
| Load PropertyLists from a file. More... | |
| virtual void | SetAutoLoadAndSave (bool autoLoadAndSave)=0 |
| Enable or disable automatic loading/saving of PropertyLists at application start/stop. More... | |
| virtual bool | GetAutoLoadAndSave ()=0 |
| Check whether automatic loading/saving is activated. More... | |
| virtual void | AddPropertyListReplacedObserver (PropertyListReplacedObserver *observer)=0 |
| Add an observer that is notified when a PropertyList is replaced during Load(). More... | |
| virtual void | RemovePropertyListReplacedObserver (PropertyListReplacedObserver *observer)=0 |
| Remove a previously added PropertyList replacement observer. More... | |
| virtual | ~IPersistenceService () |
| Destructor. More... | |
The central service for the persistence module.
Basic idea is to create PropertyLists with a unique id using GetPropertyList(). A consumer of this interface can write arbitrary information into this PropertyList. Calling Save() and Load() will cause the service to save and load the current set of PropertyLists from a file in the user directory. Using SetAutoLoadAndSave(true) will cause the service to load/save the PropertyLists at application start/stop. Moreover, depending on the backend type, the service is connected to the SceneSerialization module, i.e. the user will be asked whether to save/load the PropertyLists in/from the current ".mitk" file that is selected by the user.
Definition at line 44 of file mitkIPersistenceService.h.
|
virtual |
Destructor.
|
pure virtual |
Add an observer that is notified when a PropertyList is replaced during Load().
| observer | The observer to add. |
Implemented in mitk::PersistenceService.
|
pure virtual |
Check whether automatic loading/saving is activated.
true if auto-load and auto-save are enabled, false otherwise. Implemented in mitk::PersistenceService.
|
pure virtual |
Create DataNodes containing all PropertyLists.
The DataNodes will have the property name set to the PropertyList's id and a BoolProperty equal to GetPersistenceNodePropertyName() set to true. If ds is set, the returned DataNodes will also be added to that DataStorage.
| ds | Optional DataStorage to add the nodes to. |
Implemented in mitk::PersistenceService.
|
pure virtual |
Get the default name of the persistence file (the one that is loaded at startup).
Implemented in mitk::PersistenceService.
|
pure virtual |
Get the name of the BoolProperty that marks persistence DataNodes.
Implemented in mitk::PersistenceService.
|
pure virtual |
Get or create a PropertyList with the given id.
If a PropertyList with the given id exists, returns it. Otherwise creates a new one and returns it. If id is empty, a UUID will be created and set on the variable. If existed was passed, it is set to true if the PropertyList with that id existed, false otherwise.
| id | The unique identifier for the PropertyList. May be modified if empty. |
| existed | Optional output parameter indicating whether the PropertyList already existed. |
Implemented in mitk::PersistenceService.
|
pure virtual |
Load PropertyLists from a file.
If fileName is empty, a special file in the user's home directory will be used. If enforeReload is false, the service will take care of modified time flags, i.e. it will not load a file that was loaded before and did not change in the meantime or that was modified by the service itself.
| fileName | The file path to load from. Empty for the default location. |
| enforeReload | If true, reload regardless of modification timestamps. |
false if an error occurred (cannot load from file), true otherwise.Implemented in mitk::PersistenceService.
|
pure virtual |
Remove the PropertyList with the given id.
| id | The identifier of the PropertyList to remove. |
true if the PropertyList existed and could be removed, false otherwise. Implemented in mitk::PersistenceService.
|
pure virtual |
Remove a previously added PropertyList replacement observer.
| observer | The observer to remove. |
Implemented in mitk::PersistenceService.
|
pure virtual |
Restore PropertyLists from persistent DataNodes in the given storage.
Searches the storage for persistent DataNodes, extracts and inserts the appended PropertyLists to this service.
| storage | The DataStorage to search for persistent DataNodes. |
true if at least one node was found from which a PropertyList could be restored. Implemented in mitk::PersistenceService.
|
pure virtual |
Save the current PropertyLists to a file.
If fileName is empty, a special file in the user's home directory will be used. If appendChanges is true, the file will not be replaced but first loaded, then overwritten and then replaced.
| fileName | The file path to save to. Empty for the default location. |
| appendChanges | If true, merge changes with the existing file contents. |
false if an error occurred (cannot write to file), true otherwise. Implemented in mitk::PersistenceService.
|
pure virtual |
Enable or disable automatic loading/saving of PropertyLists at application start/stop.
| autoLoadAndSave | If true, enable automatic load and save. |
Implemented in mitk::PersistenceService.