Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitk::IPersistenceService Class Referenceabstract

#include <mitkIPersistenceService.h>

Inheritance diagram for mitk::IPersistenceService:

Public Member Functions

virtual mitk::PropertyList::Pointer GetPropertyList (std::string &id, bool *existed=0)=0
 
virtual bool RemovePropertyList (std::string &id)=0
 
virtual std::string GetDefaultPersistenceFile ()=0
 
virtual std::string GetPersistenceNodePropertyName ()=0
 
virtual DataStorage::SetOfObjects::Pointer GetDataNodes (DataStorage *ds=0)=0
 
virtual bool RestorePropertyListsFromPersistentDataNodes (const DataStorage *storage)=0
 
virtual bool Save (const std::string &fileName="", bool appendChanges=false)=0
 
virtual bool Load (const std::string &fileName="", bool enforeReload=true)=0
 
virtual void SetAutoLoadAndSave (bool autoLoadAndSave)=0
 
virtual bool GetAutoLoadAndSave ()=0
 
virtual void AddPropertyListReplacedObserver (PropertyListReplacedObserver *observer)=0
 
virtual void RemovePropertyListReplacedObserver (PropertyListReplacedObserver *observer)=0
 
virtual ~IPersistenceService ()
 

Detailed Description

The central service for the persistence module Basic idea is to create PropertyLists with a unique id using AddPropertyList(). 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 propertlists from a file in the user directory. Using SetAutoLoadAndSave(true) will cause the service to load/save the property lists 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 propertlists in/from the current ".mitk" file that is selected by the user.

Definition at line 44 of file mitkIPersistenceService.h.

Constructor & Destructor Documentation

mitk::IPersistenceService::~IPersistenceService ( )
virtual

nothing to do here

Definition at line 19 of file mitkIPersistenceService.cpp.

Member Function Documentation

virtual void mitk::IPersistenceService::AddPropertyListReplacedObserver ( PropertyListReplacedObserver observer)
pure virtual

adds a observer which is informed if a propertyList gets replaced during a Load() procedure

Implemented in mitk::PersistenceService.

Referenced by QmitkOpenCVVideoControls::QmitkOpenCVVideoControls().

virtual bool mitk::IPersistenceService::GetAutoLoadAndSave ( )
pure virtual
Returns
whether AutoLoading is activated or not

Implemented in mitk::PersistenceService.

virtual DataStorage::SetOfObjects::Pointer mitk::IPersistenceService::GetDataNodes ( DataStorage ds = 0)
pure virtual

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.

Returns
vector of DataNodes with the described attributes

Implemented in mitk::PersistenceService.

virtual std::string mitk::IPersistenceService::GetDefaultPersistenceFile ( )
pure virtual

Get the default name of the PersistenceFile (the one that is loaded at startup)

Implemented in mitk::PersistenceService.

virtual std::string mitk::IPersistenceService::GetPersistenceNodePropertyName ( )
pure virtual
Returns
The name of the Bool Property that specifies whether a DataNode is a Node carrying Persistence PropertyLists

Implemented in mitk::PersistenceService.

virtual mitk::PropertyList::Pointer mitk::IPersistenceService::GetPropertyList ( std::string &  id,
bool *  existed = 0 
)
pure virtual

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

Returns
a valid PropertyList with a StringProperty "Id" containing the passed id

Implemented in mitk::PersistenceService.

virtual bool mitk::IPersistenceService::Load ( const std::string &  fileName = "",
bool  enforeReload = true 
)
pure virtual

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!

See also
AddPropertyListReplacedObserver()
Returns
false if an error occured (cannot load from file), true otherwise

Implemented in mitk::PersistenceService.

virtual bool mitk::IPersistenceService::RemovePropertyList ( std::string &  id)
pure virtual

removes the PropertyList with the given id

Returns
true if PropertyList existed and could be removed, false otherwise

Implemented in mitk::PersistenceService.

virtual void mitk::IPersistenceService::RemovePropertyListReplacedObserver ( PropertyListReplacedObserver observer)
pure virtual

removes a specific observer

Implemented in mitk::PersistenceService.

Referenced by QmitkOpenCVVideoControls::~QmitkOpenCVVideoControls().

virtual bool mitk::IPersistenceService::RestorePropertyListsFromPersistentDataNodes ( const DataStorage storage)
pure virtual

Searches storage for persistent DataNodes, extracts and inserts the appended property lists to this service

Returns
true if at least one node was found from which a PropertyList could be restored

Implemented in mitk::PersistenceService.

virtual bool mitk::IPersistenceService::Save ( const std::string &  fileName = "",
bool  appendChanges = false 
)
pure virtual

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

Returns
false if an error occured (cannot write to file), true otherwise

Implemented in mitk::PersistenceService.

virtual void mitk::IPersistenceService::SetAutoLoadAndSave ( bool  autoLoadAndSave)
pure virtual

Using SetAutoLoadAndSave(true) will cause the service to load/save the property lists at application start/stop.

Implemented in mitk::PersistenceService.


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