|
Computer Assited Medical Intervention Tool Kit
version 5.0
|
|
Go to the documentation of this file.
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 auto it =
fields.find(attName);
142 return (it !=
fields.end());
146 auto it =
fields.find(attName);
149 return atof(it->second.c_str());
157 auto it =
fields.find(attName);
160 return std::atoi(it->second.c_str());
168 auto it =
fields.find(attName);
170 if (it ==
fields.end() || it->second ==
"false" || it->second ==
"0") {
179 auto it =
fields.find(attName);
190 auto it =
fields.find(attName);
201 std::ostringstream oss;
203 auto it =
fields.find(attName);
206 it->second = oss.str();
209 fields.insert(std::pair<std::string, std::string>(attName, oss.str()));
214 std::ostringstream oss;
216 auto it =
fields.find(attName);
219 it->second = oss.str() ;
222 fields.insert(std::pair<std::string, std::string>(attName, oss.str()));
227 std::ostringstream oss;
229 auto it =
fields.find(attName);
232 it->second = oss.str() ;
235 fields.insert(std::pair<std::string, std::string>(attName, oss.str()));
240 auto it =
fields.find(attName);
246 fields.insert(std::pair<std::string, std::string>(attName, val));
255 name = std::string(n);
266 #endif //PROPERTIES_H
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:189
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
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:167
void xmlToFields(xsd::cxx::tree::attribute_set< char > attrs)
convert the xml node parameters to data fields
Definition: Properties.cpp:41
std::string getField(unsigned int) const
get the name of field of given index
Definition: Properties.cpp:68
PhysicalModel * myPM
pointer to the physical model the object is in
Definition: Properties.h:136
std::string name
name of the physical model object
Definition: Properties.h:133
unsigned int numberOfFields() const
get the number of extra fields found in the PML
Definition: Properties.cpp:63
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:250
This is the main class of this project. Following a nice concept, a physical model is able to represe...
Definition: PhysicalModel.h:86
PhysicalModel * getPhysicalModel() const
get the physical model
Definition: Properties.h:262
void setPhysicalModel(PhysicalModel *)
set the physical model
Definition: Properties.h:258
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:178
void setName(std::string)
set the name (use the string = operator)
Definition: Properties.h:254
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:156
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 set(std::string attName, double val)
field modificator: set field attName using a double value
Definition: Properties.h:200
virtual ~Properties()=default
The default destructor.
std::map< std::string, std::string > fields
map containing all the different fields (name, value stored as string )
Definition: Properties.h:129