Describes the properties common to all structures and components. More...
#include <Properties.h>
Public Member Functions | |
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!!!) More... | |
PhysicalModel * | getPhysicalModel () const |
get the physical model More... | |
Properties (const std::string n="") | |
A nice simple constructor, with a given name. More... | |
Properties (PhysicalModel *, const std::string n="") | |
Another nice constructor, with the PM and a name. More... | |
void | setName (std::string) |
set the name (use the string = operator) More... | |
void | setPhysicalModel (PhysicalModel *) |
set the physical model More... | |
virtual | ~Properties ()=default |
The default destructor. More... | |
Field methods (manages any custom fields) | |
std::map< std::string, std::string > | fields |
map containing all the different fields (name, value stored as string ) More... | |
std::string | name |
name of the physical model object More... | |
PhysicalModel * | myPM |
pointer to the physical model the object is in More... | |
void | xmlToFields (xsd::cxx::tree::attribute_set< char > attrs) |
convert the xml node parameters to data fields More... | |
unsigned int | numberOfFields () const |
get the number of extra fields found in the PML More... | |
bool | isAField (std::string attName) const |
check if the field exist in the XML document, return false if it does not More... | |
std::string | getField (unsigned int) const |
get the name of field of given index More... | |
double | getDouble (std::string attName) |
field accessor: get the field attName as a double value, if field does not exist, 0.0 is return More... | |
int | getInt (std::string attName) const |
field accessor: get the field attName as an int value, if field does not exist, 0 is return More... | |
bool | getBool (std::string attName) const |
field accessor: get the field attName as a bool value, if field does not exist, false is return More... | |
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 return More... | |
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, empty string is return More... | |
void | set (std::string attName, double val) |
field modificator: set field attName using a double value More... | |
void | set (std::string attName, int val) |
field modificator: set field attName using an int value More... | |
void | set (std::string attName, bool val) |
field modificator: set field attName using a bool value More... | |
void | set (std::string attName, std::string val) |
field modificator: set field attName using a string value More... | |
Describes the properties common to all structures and components.
Properties uses a generic mechanisms to store any kind of properties, henceforth called "fields". A field is a (name:string, value:string) pair.
Fields are read directly from XML, and then can be changed through the modificators methods.
The field accessors allows you to get the value in the form of different basic types (string, double, bool, int).
Method numberOfFields():usigned and getField(unsigned):string help you to get information about available fields.
Properties::Properties | ( | const std::string | n = "" | ) |
A nice simple constructor, with a given name.
Properties::Properties | ( | PhysicalModel * | p, |
const std::string | n = "" |
||
) |
Another nice constructor, with the PM and a name.
|
virtualdefault |
The default destructor.
|
inline |
field accessor: get the field attName as a string value in attVal, if field does not exist, empty string is return
References fields.
Referenced by ComponentGenerator::createFromDom().
|
inline |
field accessor: get the field attName as a bool value, if field does not exist, false is return
References fields.
|
inline |
field accessor: get the field attName as a double value, if field does not exist, 0.0 is return
References fields.
std::string Properties::getField | ( | unsigned int | id | ) | const |
get the name of field of given index
References fields.
Referenced by PMLExplorerWidget::createMCPropertyList(), PMLExplorerWidget::createSCPropertyList(), ParametersWriter::write(), MultiComponent::xmlPrint(), and PhysicalModel::xmlPrint().
|
inline |
field accessor: get the field attName as an int value, if field does not exist, 0 is return
References fields.
|
inline |
get the name (be careful, this method DOES NOT return a copy, so you got the direct ptr to the name!!!)
References name.
Referenced by Component::getName(), Structure::getName(), PhysicalModel::getName(), CellProperties::xmlPrint(), AtomProperties::xmlPrint(), and StructuralComponentProperties::xmlPrint().
|
inline |
get the physical model
References myPM.
Referenced by StructuralComponent::getAtoms(), Component::getPhysicalModel(), Atom::setIndex(), and Atom::xmlPrint().
|
inline |
field accessor: get the field attName as a string value, if field does not exist, empty string is return
References fields.
Referenced by PMLExplorerWidget::createMCPropertyList(), PMLExplorerWidget::createSCPropertyList(), ParametersWriter::write(), MultiComponent::xmlPrint(), and PhysicalModel::xmlPrint().
|
inline |
check if the field exist in the XML document, return false if it does not
References fields.
Referenced by PMLComponent::updateProperty().
unsigned int Properties::numberOfFields | ( | ) | const |
get the number of extra fields found in the PML
References fields.
Referenced by ParametersWriter::write(), MultiComponent::xmlPrint(), and PhysicalModel::xmlPrint().
|
inline |
field modificator: set field attName using a bool value
References fields.
|
inline |
field modificator: set field attName using a double value
References fields.
Referenced by PMLExplorerWidget::propertyChanged(), and PMLComponent::updateProperty().
|
inline |
field modificator: set field attName using an int value
References fields.
|
inline |
field modificator: set field attName using a string value
References fields.
|
inline |
set the name (use the string = operator)
References name.
Referenced by AtomProperties::AtomProperties(), CellProperties::CellProperties(), Component::setName(), Structure::setName(), PhysicalModel::setName(), and StructuralComponentProperties::StructuralComponentProperties().
|
inline |
set the physical model
References myPM.
Referenced by Structure::setPhysicalModel(), and Component::setPhysicalModel().
void Properties::xmlToFields | ( | xsd::cxx::tree::attribute_set< char > | attrs | ) |
convert the xml node parameters to data fields
References fields.
Referenced by AtomProperties::AtomProperties(), CellProperties::CellProperties(), PhysicalModel::parseTree(), and StructuralComponentProperties::StructuralComponentProperties().
|
protected |
map containing all the different fields (name, value stored as string )
Referenced by get(), getBool(), getDouble(), getField(), getInt(), getString(), isAField(), numberOfFields(), set(), CellProperties::xmlPrint(), AtomProperties::xmlPrint(), StructuralComponentProperties::xmlPrint(), and xmlToFields().
|
private |
pointer to the physical model the object is in
Referenced by getPhysicalModel(), and setPhysicalModel().
|
private |