Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
#include <mitkPersistenceService.h>
Public Member Functions | |
PersistenceService () | |
~PersistenceService () override | |
std::string | GetDefaultPersistenceFile () override |
mitk::PropertyList::Pointer | GetPropertyList (std::string &id, bool *existed=nullptr) override |
bool | RemovePropertyList (std::string &id) override |
std::string | GetPersistenceNodePropertyName () override |
DataStorage::SetOfObjects::Pointer | GetDataNodes (DataStorage *ds=nullptr) override |
bool | Save (const std::string &fileName="", bool appendChanges=false) override |
bool | Load (const std::string &fileName="", bool enforeReload=true) override |
void | SetAutoLoadAndSave (bool autoLoadAndSave) override |
bool | GetAutoLoadAndSave () override |
void | AddPropertyListReplacedObserver (PropertyListReplacedObserver *observer) override |
void | RemovePropertyListReplacedObserver (PropertyListReplacedObserver *observer) override |
bool | RestorePropertyListsFromPersistentDataNodes (const DataStorage *storage) override |
void | Clear () |
void | Unitialize () |
![]() | |
virtual | ~IPersistenceService () |
Static Public Member Functions | |
static std::string | GetPersistencePropertyName () |
static std::string | GetPersistencePropertyListName () |
static void | LoadModule () |
static us::ModuleContext * | GetModuleContext () |
implementation of the IPersistenceService
Definition at line 26 of file mitkPersistenceService.h.
mitk::PersistenceService::PersistenceService | ( | ) |
Definition at line 31 of file mitkPersistenceService.cpp.
|
override |
Definition at line 42 of file mitkPersistenceService.cpp.
References MITK_DEBUG.
|
overridevirtual |
adds a observer which is informed if a propertyList gets replaced during a Load() procedure
Implements mitk::IPersistenceService.
Definition at line 266 of file mitkPersistenceService.cpp.
void mitk::PersistenceService::Clear | ( | ) |
Definition at line 35 of file mitkPersistenceService.cpp.
Referenced by RemovePropertyList().
|
overridevirtual |
Implements mitk::IPersistenceService.
Definition at line 373 of file mitkPersistenceService.cpp.
Referenced by Unitialize().
|
overridevirtual |
Creates a vector of DataNodes that contain all PropertyLists. Additionally, 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 DS.
Implements mitk::IPersistenceService.
Definition at line 294 of file mitkPersistenceService.cpp.
References mitk::DataStorage::Add(), GetPersistencePropertyName(), MITK_DEBUG, and mitk::DataNode::New().
Referenced by Save().
|
overridevirtual |
Get the default name of the PersistenceFile (the one that is loaded at startup)
Implements mitk::IPersistenceService.
Definition at line 47 of file mitkPersistenceService.cpp.
References us::GetModuleContext().
|
static |
Definition at line 283 of file mitkPersistenceService.cpp.
References us::GetModuleContext().
|
overridevirtual |
Implements mitk::IPersistenceService.
Definition at line 288 of file mitkPersistenceService.cpp.
References GetPersistencePropertyName().
|
static |
Definition at line 26 of file mitkPersistenceService.cpp.
Referenced by RemovePropertyList(), and SetAutoLoadAndSave().
|
static |
Definition at line 21 of file mitkPersistenceService.cpp.
Referenced by GetDataNodes(), GetPersistenceNodePropertyName(), and RestorePropertyListsFromPersistentDataNodes().
|
overridevirtual |
If 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 true if the PropertyList with that id existed, false otherwise
Implements mitk::IPersistenceService.
Definition at line 61 of file mitkPersistenceService.cpp.
References mitk::PropertyList::Clear(), mitk::PropertyList::GetMap(), mitk::UIDGenerator::GetUID(), mitk::PropertyList::New(), and mitk::PropertyList::SetProperty().
Referenced by RemovePropertyList(), RestorePropertyListsFromPersistentDataNodes(), and SetAutoLoadAndSave().
|
overridevirtual |
Load PropertyLists from fileName. If fileName is empty, a special file in the users 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 ATTENTION: If there are PropertyLists with the same id contained in the file, existing PropertyLists will be overwritten!
Implements mitk::IPersistenceService.
Definition at line 190 of file mitkPersistenceService.cpp.
References GetDefaultPersistenceFile(), MITK_DEBUG, mitk::SceneIO::New(), and RestorePropertyListsFromPersistentDataNodes().
Referenced by RemovePropertyList().
|
static |
Definition at line 278 of file mitkPersistenceService.cpp.
References MITK_DEBUG.
|
overridevirtual |
removes the PropertyList with the given id
Implements mitk::IPersistenceService.
Definition at line 379 of file mitkPersistenceService.cpp.
References Clear(), GetPersistencePropertyListName(), GetPropertyList(), Load(), MITK_DEBUG, mitk::PropertyListsXmlFileReaderAndWriter::New(), and SetAutoLoadAndSave().
|
overridevirtual |
removes a specific observer
Implements mitk::IPersistenceService.
Definition at line 272 of file mitkPersistenceService.cpp.
|
overridevirtual |
Searches storage for persistent DataNodes, extracts and inserts the appended property lists to this service
Implements mitk::IPersistenceService.
Definition at line 320 of file mitkPersistenceService.cpp.
References mitk::DataStorage::GetAll(), mitk::DataNode::GetBoolProperty(), mitk::DataNode::GetName(), GetPersistencePropertyName(), GetPropertyList(), mitk::DataNode::GetPropertyList(), and MITK_DEBUG.
|
overridevirtual |
Save the current PropertyLists to fileName. If fileName is empty, a special file in the users home directory will be used. if appendchanges is true, the file will not replaced but first loaded, then overwritten and then replaced
Implements mitk::IPersistenceService.
Definition at line 104 of file mitkPersistenceService.cpp.
References GetDataNodes(), GetDefaultPersistenceFile(), MITK_ERROR, mitk::SceneIO::New(), mitk::StandaloneDataStorage::New(), and RestorePropertyListsFromPersistentDataNodes().
Referenced by SetAutoLoadAndSave(), and Unitialize().
|
overridevirtual |
Using SetAutoLoadAndSave(true) will cause the service to load/save the property lists at application start/stop.
Implements mitk::IPersistenceService.
Definition at line 255 of file mitkPersistenceService.cpp.
References GetPersistencePropertyListName(), GetPropertyList(), and Save().
Referenced by RemovePropertyList().
void mitk::PersistenceService::Unitialize | ( | ) |
Definition at line 418 of file mitkPersistenceService.cpp.
References GetAutoLoadAndSave(), and Save().