12 #ifndef mitkPersistenceService_h
13 #define mitkPersistenceService_h
19 #include <itkLightObject.h>
97 mitk::PropertyList::Pointer
GetPropertyList(std::string &
id,
bool *existed =
nullptr)
override;
138 bool Save(
const std::string &fileName =
"",
bool appendChanges =
false)
override;
154 bool Load(
const std::string &fileName =
"",
bool enforeReload =
true)
override;
218 std::map<std::string, mitk::PropertyList::Pointer> m_PropertyLists;
219 bool m_AutoLoadAndSave;
220 std::set<PropertyListReplacedObserver *> m_PropertyListReplacedObserver;
221 SceneIO::Pointer m_SceneIO;
222 PropertyListsXmlFileReaderAndWriter::Pointer m_PropertyListsXmlFileReaderAndWriter;
223 std::map<std::string, long int> m_FileNamesToModifiedTimes;
225 bool m_InInitialized;
#define MITKPERSISTENCE_EXPORT
Abstract data management class that organizes DataNode objects in a directed acyclic graph.
The central service for the persistence module.
Concrete implementation of the IPersistenceService interface.
void SetAutoLoadAndSave(bool autoLoadAndSave) override
Enable or disable automatic loading and saving of property lists.
mitk::PropertyList::Pointer GetPropertyList(std::string &id, bool *existed=nullptr) override
Retrieve or create a PropertyList identified by the given id.
bool Save(const std::string &fileName="", bool appendChanges=false) override
Save all property lists to a file.
bool RemovePropertyList(std::string &id) override
Remove the PropertyList identified by the given id.
static std::string GetPersistencePropertyListName()
Get the property list name used for internal persistence service settings.
static std::string GetPersistencePropertyName()
Get the property name used to mark DataNodes as persistence nodes.
std::string GetPersistenceNodePropertyName() override
Get the name of the boolean property used to tag persistence DataNodes.
static void LoadModule()
Trigger loading of the persistence module.
void RemovePropertyListReplacedObserver(PropertyListReplacedObserver *observer) override
Unregister a previously added PropertyListReplacedObserver.
static us::ModuleContext * GetModuleContext()
Get the micro services module context for this module.
DataStorage::SetOfObjects::Pointer GetDataNodes(DataStorage *ds=nullptr) override
Create DataNodes from all stored PropertyLists and optionally add them to a DataStorage.
bool GetAutoLoadAndSave() override
Query whether automatic loading and saving is enabled.
void AddPropertyListReplacedObserver(PropertyListReplacedObserver *observer) override
Register an observer to be notified when a PropertyList is replaced during Load().
bool RestorePropertyListsFromPersistentDataNodes(const DataStorage *storage) override
Restore property lists from persistence-tagged DataNodes in a DataStorage.
bool Load(const std::string &fileName="", bool enforeReload=true) override
Load property lists from a file.
void Unitialize()
Shut down the persistence service.
void Clear()
Clear all stored property lists and file modification time records.
std::string GetDefaultPersistenceFile() override
Get the default file path used for persisting property lists.
~PersistenceService() override
Observer that gets informed when a PropertyList with a given id is replaced during a Load() process.
Key-value list holding instances of BaseProperty.
Find image slices visible on a given plane.