Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 #ifndef mitkPersistenceService_h
13 #define mitkPersistenceService_h
14 
17 #include "mitkSceneIO.h"
18 #include <MitkPersistenceExports.h>
19 #include <itkLightObject.h>
20 
21 namespace mitk
22 {
27  {
28  public:
29  static std::string GetPersistencePropertyName();
30 
31  static std::string GetPersistencePropertyListName();
32 
33  static void LoadModule();
34  static us::ModuleContext *GetModuleContext();
35 
37 
38  ~PersistenceService() override;
39 
40  std::string GetDefaultPersistenceFile() override;
41 
42  mitk::PropertyList::Pointer GetPropertyList(std::string &id, bool *existed = nullptr) override;
43 
44  bool RemovePropertyList(std::string &id) override;
45 
46  std::string GetPersistenceNodePropertyName() override;
47 
48  DataStorage::SetOfObjects::Pointer GetDataNodes(DataStorage *ds = nullptr) override;
49 
50  bool Save(const std::string &fileName = "", bool appendChanges = false) override;
51 
52  bool Load(const std::string &fileName = "", bool enforeReload = true) override;
53 
54  void SetAutoLoadAndSave(bool autoLoadAndSave) override;
55 
56  bool GetAutoLoadAndSave() override;
57 
58  void AddPropertyListReplacedObserver(PropertyListReplacedObserver *observer) override;
59 
60  void RemovePropertyListReplacedObserver(PropertyListReplacedObserver *observer) override;
61 
62  bool RestorePropertyListsFromPersistentDataNodes(const DataStorage *storage) override;
63 
64  void Clear();
65 
66  void Unitialize();
67 
68  private:
69  void ClonePropertyList(mitk::PropertyList *from, mitk::PropertyList *to) const;
70  void Initialize();
71  std::map<std::string, mitk::PropertyList::Pointer> m_PropertyLists;
72  bool m_AutoLoadAndSave;
73  std::set<PropertyListReplacedObserver *> m_PropertyListReplacedObserver;
74  SceneIO::Pointer m_SceneIO;
75  PropertyListsXmlFileReaderAndWriter::Pointer m_PropertyListsXmlFileReaderAndWriter;
76  std::map<std::string, long int> m_FileNamesToModifiedTimes;
77  bool m_Initialized;
78  bool m_InInitialized;
79  };
80 }
81 #endif
mitkPropertyListsXmlFileReaderAndWriter.h
mitk::PropertyListReplacedObserver
Definition: mitkPropertyListReplacedObserver.h:28
mitkIPersistenceService.h
MitkPersistenceExports.h
mitk::PersistenceService
Definition: mitkPersistenceService.h:26
us::GetModuleContext
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
Definition: usGetModuleContext.h:50
itk::SmartPointer< Self >
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::PropertyList
Key-value list holding instances of BaseProperty.
Definition: mitkPropertyList.h:56
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
MITKPERSISTENCE_EXPORT
#define MITKPERSISTENCE_EXPORT
Definition: MitkPersistenceExports.h:15
mitkSceneIO.h
mitk::IPersistenceService
Definition: mitkIPersistenceService.h:40