29 #include <libxml/tree.h>
90 bool isAField(std::string attName)
const;
95 std::string
getField(
unsigned int)
const;
101 int getInt(std::string attName)
const;
104 bool getBool(std::string attName)
const;
107 std::string
getString(std::string attName)
const;
110 void get(std::string attName, std::string &attVal)
const;
113 void set(std::string attName,
double val);
116 void set(std::string attName,
int val);
119 void set(std::string attName,
bool val);
122 void set(std::string attName, std::string val);
127 std::map<std::string, std::string>
fields;
139 std::map<std::string, std::string>::const_iterator it =
fields.find(attName);
140 return (it !=
fields.end());
144 std::map<std::string, std::string>::iterator it =
fields.find(attName);
147 return atof( it->second.c_str());
153 std::map<std::string, std::string>::const_iterator it =
fields.find(attName);
156 return atoi( it->second.c_str());
162 std::map<std::string, std::string>::const_iterator it =
fields.find(attName);
164 if(it ==
fields.end() || it->second ==
"false" || it->second ==
"0")
171 std::map<std::string, std::string>::const_iterator it =
fields.find(attName);
180 std::map<std::string, std::string>::const_iterator it =
fields.find(attName);
189 std::ostringstream oss;
191 std::map<std::string, std::string>::iterator it =
fields.find(attName);
194 it->second = oss.str();
196 fields.insert(std::pair<std::string, std::string>(attName, oss.str()));
200 std::ostringstream oss;
202 std::map<std::string, std::string>::iterator it =
fields.find(attName);
205 it->second = oss.str() ;
207 fields.insert(std::pair<std::string, std::string>(attName, oss.str()));
211 std::ostringstream oss;
213 std::map<std::string, std::string>::iterator it =
fields.find(attName);
216 it->second = oss.str() ;
218 fields.insert(std::pair<std::string, std::string>(attName, oss.str()));
222 std::map<std::string, std::string>::iterator it =
fields.find(attName);
227 fields.insert(std::pair<std::string, std::string>(attName, val));
235 name = std::string(n);
246 #endif //PROPERTIES_H
void domToFields(xmlNodePtr node)
convert the xml node parameters to data fields
void setPhysicalModel(PhysicalModel *)
set the physical model
Definition: Properties.h:238
int getInt(std::string attName) const
field accessor: get the field attName as an int value, if field does not exist, 0 is return ...
Definition: Properties.h:152
Properties(const std::string n="")
A nice simple constructor, with a given name.
void setName(std::string)
set the name (use the string = operator)
Definition: Properties.h:234
bool isAField(std::string attName) const
check if the field exist in the XML document, return false if it does not
Definition: Properties.h:138
std::string getName() const
get the name (be careful, this method DOES NOT return a copy, so you got the direct ptr to the name!!...
Definition: Properties.h:230
virtual ~Properties()
The default destructor.
void set(std::string attName, double val)
field modificator: set field attName using a double value
Definition: Properties.h:188
Describes the properties common to all structures and components.
Definition: Properties.h:57
std::string getField(unsigned int) const
get the name of field of given index
std::map< std::string, std::string > fields
map containing all the different fields (name, value stored as string )
Definition: Properties.h:127
bool getBool(std::string attName) const
field accessor: get the field attName as a bool value, if field does not exist, false is return ...
Definition: Properties.h:161
unsigned int numberOfFields() const
get the number of extra fields found in the PML
PhysicalModel * myPM
pointer to the physical model the object is in
Definition: Properties.h:134
double getDouble(std::string attName)
field accessor: get the field attName as a double value, if field does not exist, 0...
Definition: Properties.h:143
This is the main class of this project.
Definition: PhysicalModel.h:74
std::string name
name of the physical model object
Definition: Properties.h:131
std::string getString(std::string attName) const
field accessor: get the field attName as a string value, if field does not exist, empty string is ret...
Definition: Properties.h:170
PhysicalModel * getPhysicalModel() const
get the physical model
Definition: Properties.h:242
void get(std::string attName, std::string &attVal) const
field accessor: get the field attName as a string value in attVal, if field does not exist...
Definition: Properties.h:179