CustusX  20.03-rc1
An IGT application
cxPatientStorage.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXPATIENTSTORAGE_H
13 #define CXPATIENTSTORAGE_H
14 
15 #include "cxResourceExport.h"
16 
17 #include <QObject>
18 #include <boost/shared_ptr.hpp>
19 #include <boost/function.hpp>
20 #include <boost/bind.hpp>
21 
22 class QDomElement;
23 class QDomNode;
24 
25 namespace cx
26 {
27 typedef boost::shared_ptr<class PatientStorage> PatientStoragePtr;
28 typedef boost::shared_ptr<class SessionStorageService> SessionStorageServicePtr;
29 
43 class cxResource_EXPORT PatientStorage : public QObject
44 {
45  Q_OBJECT
46 public:
47  PatientStorage(SessionStorageServicePtr sessionStorageService, QString baseNodeName, bool delayedLoad = false);
54  void storeVariable(QString nodeName, boost::function<QString ()> getValueFunction, boost::function<void (QString)> setValueFunction);
55 private slots:
56  void duringSavePatientSlot(QDomElement &node);
57  void duringLoadPatientSlot(QDomElement &node);
58 private:
59  QString mBaseNodeName;
60  std::map<QString, boost::function<QString()> > mGetFunctions;
61  std::map<QString, boost::function<void(QString value)> > mSetFunctions;
62  void addXml(QDomNode &parentNode);
63  void parseXml(QDomNode &dataNode);
64 };
65 
66 } //cx
67 #endif // CXPATIENTSTORAGE_H
Helper class for storing variables in the patient file.
boost::shared_ptr< class PatientStorage > PatientStoragePtr
Definition: cxVBWidget.h:34
boost::shared_ptr< class SessionStorageService > SessionStorageServicePtr
Namespace for all CustusX production code.