Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
XMLLoads.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef XMLLOADS_H
27 #define XMLLOADS_H
28 
29 #include "Loads.h"
30 
31 #include <libxml/parser.h>
32 #include <libxml/tree.h>
33 
34 /* old doc
35 Usage example:
36 <pre>
37 // reading
38 main() {
39  XMLLoads data;
40  data.xmlRead("toto.lml");
41  Loads *l = data.getLoad();
42  ...
43  cout << l;
44 }
45 
46 // writing
47 main() {
48  Loads *l= new Loads();
49  Translation *t = new Translation();
50  t->setUnit(..)
51  ...
52  cout << l;
53 }
54 </pre>
55 */
68 class XMLLoads {
69 public:
70 
75  XMLLoads(std::string fileName, Loads* allLoads);
76 
78  XMLLoads();
79 
81  XMLLoads(std::string fileName);
82 
84  ~XMLLoads();
85 
87  Loads * getLoads();
88 
90  void addLoad(Load *);
91 
95  void xmlRead(std::string);
96 
97 protected:
98 
102  bool parseElement(xmlNodePtr elem);
103 
108  void readLoadAppliedTo(xmlNodePtr elem, Load *currentLoad);
109 
114  void readLoadDirection(xmlNodePtr elem, Load *currentLoad);
115 
120  void readLoadValueEvent(xmlNodePtr elem, Load *currentLoad);
121 
126  void readLoadUnit(xmlNodePtr elem, Load *currentLoad);
127 
128 
129 private:
131 
132  const char*xmlFile;
133 };
134 
135 #endif
void xmlRead(std::string)
Read the loads from an LML file.
Allows one to read loads from an XML file (LML)/.
Definition: XMLLoads.h:68
void readLoadUnit(xmlNodePtr elem, Load *currentLoad)
Read a load Unit property, from lml file Uses xmlNodePtr from libxml2 Unit contains the unit value of...
XMLLoads()
create an empty list of loads
void readLoadDirection(xmlNodePtr elem, Load *currentLoad)
Read a load Direction property, from lml file Uses xmlNodePtr from libxml2 Direction contains a 3D ve...
void addLoad(Load *)
add a new load to the list (creates one if no loads yet)
This class makes it possible to manage a list of "Load".
Definition: Loads.h:70
Loads * l
Definition: XMLLoads.h:130
const char * xmlFile
Definition: XMLLoads.h:132
void readLoadAppliedTo(xmlNodePtr elem, Load *currentLoad)
Read a load AppliedTo property, from lml file Uses xmlNodePtr from libxml2 AppliedTo contains the lis...
Loads * getLoads()
get the list of loads
bool parseElement(xmlNodePtr elem)
Read a load xml element, from lml file Uses xmlNodePtr from libxml2.
Class that describes a load to be used in the simulation.
Definition: Load.h:53
~XMLLoads()
destructor (delete all loads)
void readLoadValueEvent(xmlNodePtr elem, Load *currentLoad)
Read a load valueEvent property, from lml file Uses xmlNodePtr from libxml2 valueEvent contains a pai...