ALBA
albaProsthesesDBManager.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaProsthesisDBManager
5 Authors: Gianluigi Crimi
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16
17#ifndef __albaProsthesisDBManager_H__
18#define __albaProsthesisDBManager_H__
19
20//----------------------------------------------------------------------------
21// includes :
22//----------------------------------------------------------------------------
23#include "albaDefines.h"
24#include <xercesc/util/XercesDefs.hpp>
25#include <xercesc/dom/DOM.hpp>
26#include <set>
27#include "albaServiceClient.h"
28#include "albaMatrix.h"
29
30//----------------------------------------------------------------------------
31// forward reference
32//----------------------------------------------------------------------------
35class vtkPolyData;
36
38{
39public:
40 virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) = 0;
41 virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) = 0;
42 virtual void Clear() = 0;
43
44protected:
45 bool CheckNodeElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const char *elementName);
46 albaString GetElementAttribute(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const char *attributeName);
47};
48
53{
54
55public:
56 albaString GetName() const { return m_Name; }
57 void SetName(albaString val) { m_Name = val; }
60 albaString GetWebSite() const { return m_WebSite; }
61 void SetWebSite(albaString val) { m_WebSite = val; }
62
63 // Inherited via ProStorable
64 virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) override;
65 virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) override;
66 virtual void Clear() override;
67
68protected:
72};
73
78{
79public:
80 albaString GetName() const { return m_Name; }
81 void SetName(albaString val) { m_Name = val; }
82
83 // Inherited via ProStorable
84 virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) override;
85 virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) override;
86 virtual void Clear() override;
87
88protected:
90};
91
92class albaProDBComponent : public ProStorable, public albaServiceClient
93{
94public:
95 albaMatrix GetMatrix() const { return m_Matrix; }
96 void SetMatrix(albaMatrix val) { m_Matrix = val; }
97 albaString GetName() const { return m_Name; }
98 void SetName(albaString val) { m_Name = val; }
99 vtkPolyData *GetVTKData();
100 void SetVTKData(vtkPolyData *vtkData);
102
103 // Inherited via ProStorable
104 virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) override;
105 virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) override;
106 virtual void Clear() override;
107
108protected:
112};
113
118{
119public:
120 albaString GetName() const { return m_Name; }
121 void SetName(albaString val) { m_Name = val; }
122
123 // Inherited via ProStorable
124 virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) override;
125 virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) override;
126 virtual void Clear() override;
127
129 std::vector<albaProDBComponent *> *GetComponents() { return &m_Components; }
131protected:
133 std::vector<albaProDBComponent *> m_Components;
134};
135
136
138{
139public:
140
142 {
147 };
148
149 albaString GetName() const { return m_Name; }
150 void SetName(albaString val) { m_Name = val; }
153 albaString GetType() const { return m_Type; }
154 void SetType(albaString val) { m_Type = val; }
156 void SetProducer(albaString val) { m_Producer = val; }
159 double GetBendingAngle() const { return m_BendingAngle; }
160 void SetBendingAngle(double val) { m_BendingAngle = val; }
161
162
163 // Inherited via ProStorable
164 virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) override;
165 virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) override;
166 virtual void Clear() override;
167
169 static char *GetSideAsStr(PRO_SIDES side);
170
172 std::vector<albaProDBCompGroup *> *GetCompGroups() { return &m_CompGroups; }
174protected:
181
182 std::vector<albaProDBCompGroup *> m_CompGroups;
183
184};
185
189class ALBA_EXPORT albaProsthesesDBManager : public ProStorable
190{
191public:
192
195
198
199 // Inherited via ProStorable
200
201 int LoadDB();
202 int SaveDB();
203
204 virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) override;
205 virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) override;
206
207 virtual void Clear() override;
208
210
211 //This function decrease the count for stored files and delete the file if there will be no components that uses it
213
216
217 std::vector<albaProDBProsthesis *> SearchProstheses(albaString producer, albaString type, albaString side);
218 std::vector<albaProDBProsthesis *>& GetProstheses() { return m_Prostheses; };
223
224 std::vector<albaProDBProducer *>& GetProducers() { return m_Producers; };
225 bool HasProducer(albaString producer);
227
228 std::vector<albaProDBType *>& GetTypes() { return m_Types; };
229 bool HasType(albaString type);
231
232
233
234
235// void LoadDBFromFile(albaString DBFile) { Clear(); m_DBFilename = DBFile; LoadDB(); };
236 void LoadDBFromFile(albaString DBFile, bool append = true) { if(!append) Clear(); m_DBFilename = DBFile; LoadDB(); };
237 void SaveDBToFile(albaString DBFile) { m_DBFilename = DBFile; SaveDB(); };
238//
239 albaString GetDBDir() const { return m_DBDir; }
241 albaString GetPassPhrase() const { return m_PassPhrase; }
242 void SetPassPhrase(albaString val) { m_PassPhrase = val; }
243private:
244 albaString m_DBDir;
245 albaString m_DBFilename;
246 albaString m_PassPhrase;
247
248 std::vector<albaProDBProducer *> m_Producers;
249 std::vector<albaProDBType *> m_Types;
250 std::vector<albaProDBProsthesis *> m_Prostheses;
251
252 std::vector<albaString> m_ComponentsFiles;
253 std::vector<int> m_CompFilesNum;
254
255
256};
257#endif
albaString GetElementAttribute(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const char *attributeName)
bool CheckNodeElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node, const char *elementName)
virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node)=0
virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node)=0
virtual void Clear()=0
class name: albaGUISettingsDialog.
albaMatrix - Time stamped 4x4 Matrix.
Definition: albaMatrix.h:44
Class Name: albaProsthesisDBManager.
virtual void Clear() override
void SetName(albaString val)
virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) override
albaString GetName() const
virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) override
std::vector< albaProDBComponent * > * GetComponents()
Returns the components list.
void AddComponent(albaProDBComponent *component)
std::vector< albaProDBComponent * > m_Components
albaMatrix GetMatrix() const
albaString GetName() const
void SetName(albaString val)
virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) override
void SetMatrix(albaMatrix val)
vtkPolyData * GetVTKData()
albaString GetDataFileName() const
virtual void Clear() override
void SetVTKData(vtkPolyData *vtkData)
virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) override
Class Name: ProProducer.
albaString GetWebSite() const
void SetImgFileName(albaString val)
virtual void Clear() override
void SetName(albaString val)
albaString GetImgFileName() const
virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) override
void SetWebSite(albaString val)
virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) override
albaString GetName() const
static PRO_SIDES GetSideByString(albaString sideName)
void AddCompGroup(albaProDBCompGroup *group)
void SetBendingAngle(double val)
albaString GetType() const
virtual void Clear() override
void SetProducer(albaString val)
std::vector< albaProDBCompGroup * > m_CompGroups
std::vector< albaProDBCompGroup * > * GetCompGroups()
returns the vector of components
static char * GetSideAsStr(PRO_SIDES side)
void SetImgFileName(albaString val)
void SetName(albaString val)
virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) override
albaString GetImgFileName() const
void SetSide(albaProDBProsthesis::PRO_SIDES val)
albaString GetProducer() const
void SetType(albaString val)
albaString GetName() const
albaProDBProsthesis::PRO_SIDES GetSide() const
virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) override
Class Name: ProType.
virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) override
void SetName(albaString val)
albaString GetName() const
virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) override
virtual void Clear() override
Class Name: albaProsthesesDBManager.
virtual void Store(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc, XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *node) override
virtual void Clear() override
albaProsthesesDBManager()
Default constructor.
std::vector< albaProDBProsthesis * > & GetProstheses()
void SaveDBToFile(albaString DBFile)
void RemoveComponentFile(albaString fileName)
~albaProsthesesDBManager()
Default destructor.
int GetComponentFileCount(albaString fileName)
returns the number of components that uses the file, zero if there are no components
void AddProsthesis(albaProDBProsthesis *prosthesis)
void AddComponentFile(albaString fileName)
void SetPassPhrase(albaString val)
std::vector< albaProDBType * > & GetTypes()
bool HasProducer(albaString producer)
void LoadDBFromFile(albaString DBFile, bool append=true)
std::vector< albaProDBProducer * > & GetProducers()
void AddType(albaProDBType *type)
albaProDBProsthesis * GetProsthesis(albaString prosthesis, albaProDBProsthesis::PRO_SIDES side)
void DeleteProsthesis(albaString prosthesis, albaProDBProsthesis::PRO_SIDES side)
bool HasType(albaString type)
void AddProducer(albaProDBProducer *producer)
std::vector< albaProDBProsthesis * > SearchProstheses(albaString producer, albaString type, albaString side)
virtual int Load(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node) override
void SetDBDir(albaString val)
bool HasProsthesis(albaString prosthesis, albaProDBProsthesis::PRO_SIDES side)
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
class name: albaOpWizardWait Simple op with only an next-step button create to insert pause during wi...