ALBA
albaXMLElement.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaXMLElement
5 Authors: Marco Petrone
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#ifndef __albaXMLElement_h__
17#define __albaXMLElement_h__
18
19#include "albaStorageElement.h"
20
21//----------------------------------------------------------------------------
22// forward declarations :
23//----------------------------------------------------------------------------
24class albaXMLStorage;
25class albaXMLString;
27
41class ALBA_EXPORT albaXMLElement : public albaStorageElement
42{
43public:
45 virtual ~albaXMLElement();
46
48 virtual const char *GetName();
49
51 virtual int StoreText(const char *name, const char *text);
52
54 virtual int StoreMatrix(const char *name,const albaMatrix *matrix);
55
57 virtual int StoreVectorN(const char *name,const std::vector<double> &comps,int num);
58 virtual int StoreVectorN(const char *name,double *comps,int num);
59
61 virtual int StoreVectorN(const char *name,const std::vector<int> &comps,int num);
62 virtual int StoreVectorN(const char *name,int *comps,int num);
63
65 virtual int StoreVectorN(const char *name,const std::vector<albaString> &comps,int num,const char *tag);
66
68 //virtual int StoreData(const char *name,const char *data, const int size);
69
71 //virtual int StoreData16(const char *name,const short *data, const int size);
72
74 //virtual int StoreData32(const char *name,const long *data, const int size);
75
77 //virtual int RestoreData(const char *name,char *data, const int size);
78
80 //virtual int RestoreData16(const char *name,short *data, const int size);
81
83 //virtual int RestoreData32(const char *name,long *data, const int size);
84
86 virtual int RestoreMatrix(albaMatrix *matrix);
87
89 virtual int RestoreVectorN(std::vector<double> &comps,unsigned int num);
90 virtual int RestoreVectorN(double *comps,unsigned int num);
91
93 virtual int RestoreVectorN(std::vector<int> &comps,unsigned int num);
94 virtual int RestoreVectorN(int *comps,unsigned int num);
95
97 virtual int RestoreVectorN(std::vector<albaString> &comps,unsigned int num,const char *tag);
98
100 virtual int RestoreText(albaString &buffer);
101
104
107
112
117 virtual albaStorageElement *AppendChild(const char *name);
118 albaXMLElement *AppendXMLChild(const char *name);
119
122
125
130 virtual void SetAttribute(const char *name,const char *value);
131
136 virtual bool GetAttribute(const char *name,albaString &value);
137
139 void WriteXMLText(const char *text);
140
142 int ParseData(std::vector<double> &vector,int size);
143 int ParseData(std::vector<int> &vector,int size);
144 int ParseData(double *vector,int size);
145 int ParseData(int *vector,int size);
146
148 bool ExistElement(const char *name);
149
150protected:
151
154
155};
156#endif // _albaXMLElement_h_
157
albaMatrix - Time stamped 4x4 Matrix.
Definition: albaMatrix.h:44
Abstract class representing the interface for the unit of information stored in the storage.
std::vector< albaStorageElement * > ChildrenVector
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
concrete implementation of albaStorageElement as an XML-DOM element This class represent a concrete i...
bool ExistElement(const char *name)
return true if an element with that name exists
virtual bool GetAttribute(const char *name, albaString &value)
Return find an attribute given its name and return its value.
int ParseData(std::vector< double > &vector, int size)
Internally used to extract vector values from Text data.
virtual ChildrenVector & GetChildren()
Return the list of children.
virtual int RestoreVectorN(std::vector< double > &comps, unsigned int num)
Restore a vectorN from an XML document.
albaXMLElement * GetXMLParent()
return a pointer to the parent element, i.e.
virtual const char * GetName()
get the name of this XML element
albaXMLElement * AppendXMLChild(const char *name)
int ParseData(double *vector, int size)
albaXMLStorage * GetXMLStorage()
return a pointer to the storage who created this element
virtual int StoreVectorN(const char *name, int *comps, int num)
albaXMLElement * FindNestedXMLElement(const char *name)
Find a nested XML element by Name.
virtual void SetAttribute(const char *name, const char *value)
Append an XML attribute to this element.
virtual int RestoreText(albaString &buffer)
Restore a generic text string from an XML document.
albaXMLString * m_Name
Convenient copy of etagName.
virtual int RestoreVectorN(std::vector< albaString > &comps, unsigned int num, const char *tag)
Restore a vectorN from an XML document.
virtual albaStorageElement * AppendChild(const char *name)
Create a new XML child element and return its pointer.
virtual int StoreText(const char *name, const char *text)
Store a generic text into an XML document.
virtual int StoreVectorN(const char *name, double *comps, int num)
void WriteXMLText(const char *text)
this writes text inside a DOM-XML element
virtual int StoreVectorN(const char *name, const std::vector< int > &comps, int num)
Store a vectorN into an XML document.
virtual int RestoreVectorN(double *comps, unsigned int num)
virtual int RestoreMatrix(albaMatrix *matrix)
Store 8bit binary data.
albaXMLElement(mmuXMLDOMElement *element, albaXMLElement *parent, albaXMLStorage *storage)
mmuXMLDOMElement * m_DOMElement
XML element wrapped by this object (USING PIMPL due to Internal Compile errors of VS7)
int ParseData(int *vector, int size)
virtual ~albaXMLElement()
virtual int RestoreVectorN(int *comps, unsigned int num)
virtual int StoreVectorN(const char *name, const std::vector< albaString > &comps, int num, const char *tag)
Store a vectorN into an XML document.
virtual int RestoreVectorN(std::vector< int > &comps, unsigned int num)
Restore a vectorN from an XML document.
int ParseData(std::vector< int > &vector, int size)
virtual int StoreMatrix(const char *name, const albaMatrix *matrix)
Store a matrix into an XML document.
mmuXMLDOMElement * GetXMLElement()
return DOM-XML element stored inside this albaXMLElement
virtual int StoreVectorN(const char *name, const std::vector< double > &comps, int num)
Store a vectorN into an XML document.
Concrete implementation of Storage object using Xerces-C for storing in XML.
string type for converting const char * to and from XMLString types This is an internal string type t...
Definition: albaXMLString.h:39
mmuXMLDOMElement utility class for PIMPL of XML DOMElement types.