Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkPersistenceService.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #ifndef mitkPersistenceService_h
17 #define mitkPersistenceService_h
18 
21 #include "mitkSceneIO.h"
22 #include <MitkPersistenceExports.h>
23 #include <itkLightObject.h>
24 
25 namespace mitk
26 {
31  {
32  public:
33  static std::string GetPersistencePropertyName();
34 
35  static std::string GetPersistencePropertyListName();
36 
37  static void LoadModule();
38  static us::ModuleContext *GetModuleContext();
39 
41 
43 
44  std::string GetDefaultPersistenceFile() override;
45 
46  mitk::PropertyList::Pointer GetPropertyList(std::string &id, bool *existed = 0) override;
47 
48  bool RemovePropertyList(std::string &id) override;
49 
50  std::string GetPersistenceNodePropertyName() override;
51 
52  DataStorage::SetOfObjects::Pointer GetDataNodes(DataStorage *ds = 0) override;
53 
54  bool Save(const std::string &fileName = "", bool appendChanges = false) override;
55 
56  bool Load(const std::string &fileName = "", bool enforeReload = true) override;
57 
58  void SetAutoLoadAndSave(bool autoLoadAndSave) override;
59 
60  bool GetAutoLoadAndSave() override;
61 
62  void AddPropertyListReplacedObserver(PropertyListReplacedObserver *observer) override;
63 
64  void RemovePropertyListReplacedObserver(PropertyListReplacedObserver *observer) override;
65 
66  bool RestorePropertyListsFromPersistentDataNodes(const DataStorage *storage) override;
67 
68  void Clear();
69 
70  void Unitialize();
71 
72  private:
73  void ClonePropertyList(mitk::PropertyList *from, mitk::PropertyList *to) const;
74  void Initialize();
75  std::map<std::string, mitk::PropertyList::Pointer> m_PropertyLists;
76  bool m_AutoLoadAndSave;
77  std::set<PropertyListReplacedObserver *> m_PropertyListReplacedObserver;
78  SceneIO::Pointer m_SceneIO;
79  PropertyListsXmlFileReaderAndWriter::Pointer m_PropertyListsXmlFileReaderAndWriter;
80  std::map<std::string, long int> m_FileNamesToModifiedTimes;
81  bool m_Initialized;
82  bool m_InInitialized;
83  };
84 }
85 #endif
Data management class that handles 'was created by' relations.
itk::SmartPointer< Self > Pointer
DataCollection - Class to facilitate loading/accessing structured data.
Key-value list holding instances of BaseProperty.
#define MITKPERSISTENCE_EXPORT
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.