36 #include <xsd/cxx/tree/containers-wildcard.hxx> 85 void xmlToFields(xsd::cxx::tree::attribute_set<char> attrs);
92 bool isAField(std::string attName)
const;
97 std::string
getField(
unsigned int)
const;
103 int getInt(std::string attName)
const;
106 bool getBool(std::string attName)
const;
109 std::string
getString(std::string attName)
const;
112 void get(std::string attName, std::string &attVal)
const;
115 void set(std::string attName,
double val);
118 void set(std::string attName,
int val);
121 void set(std::string attName,
bool val);
124 void set(std::string attName, std::string val);
129 std::map<std::string, std::string>
fields;
141 std::map<std::string, std::string>::const_iterator it =
fields.find(attName);
142 return (it !=
fields.end());
146 std::map<std::string, std::string>::iterator it =
fields.find(attName);
149 return atof( it->second.c_str());
155 std::map<std::string, std::string>::const_iterator it =
fields.find(attName);
158 return std::atoi( it->second.c_str());
164 std::map<std::string, std::string>::const_iterator it =
fields.find(attName);
166 if(it ==
fields.end() || it->second ==
"false" || it->second ==
"0")
173 std::map<std::string, std::string>::const_iterator it =
fields.find(attName);
182 std::map<std::string, std::string>::const_iterator it =
fields.find(attName);
191 std::ostringstream oss;
193 std::map<std::string, std::string>::iterator it =
fields.find(attName);
196 it->second = oss.str();
198 fields.insert(std::pair<std::string, std::string>(attName, oss.str()));
202 std::ostringstream oss;
204 std::map<std::string, std::string>::iterator it =
fields.find(attName);
207 it->second = oss.str() ;
209 fields.insert(std::pair<std::string, std::string>(attName, oss.str()));
213 std::ostringstream oss;
215 std::map<std::string, std::string>::iterator it =
fields.find(attName);
218 it->second = oss.str() ;
220 fields.insert(std::pair<std::string, std::string>(attName, oss.str()));
224 std::map<std::string, std::string>::iterator it =
fields.find(attName);
229 fields.insert(std::pair<std::string, std::string>(attName, val));
237 name = std::string(n);
248 #endif //PROPERTIES_H void setPhysicalModel(PhysicalModel *)
set the physical model
Definition: Properties.h:240
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:172
Properties(const std::string n="")
A nice simple constructor, with a given name.
Definition: Properties.cpp:34
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:154
void setName(std::string)
set the name (use the string = operator)
Definition: Properties.h:236
void set(std::string attName, double val)
field modificator: set field attName using a double value
Definition: Properties.h:190
bool isAField(std::string attName) const
check if the field exist in the XML document, return false if it does not
Definition: Properties.h:140
Describes the properties common to all structures and components.
Definition: Properties.h:59
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:181
std::map< std::string, std::string > fields
map containing all the different fields (name, value stored as string )
Definition: Properties.h:129
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:163
void xmlToFields(xsd::cxx::tree::attribute_set< char > attrs)
convert the xml node parameters to data fields
Definition: Properties.cpp:49
std::string getField(unsigned int) const
get the name of field of given index
Definition: Properties.cpp:77
PhysicalModel * myPM
pointer to the physical model the object is in
Definition: Properties.h:136
double getDouble(std::string attName)
field accessor: get the field attName as a double value, if field does not exist, 0...
Definition: Properties.h:145
This is the main class of this project.
Definition: PhysicalModel.h:86
std::string name
name of the physical model object
Definition: Properties.h:133
virtual ~Properties()
The default destructor.
Definition: Properties.cpp:45
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:232
unsigned int numberOfFields() const
get the number of extra fields found in the PML
Definition: Properties.cpp:72
PhysicalModel * getPhysicalModel() const
get the physical model
Definition: Properties.h:244