Computer Assisted Medical Intervention Tool Kit  version 6.0
Loading...
Searching...
No Matches
Properties Class Reference

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!!!)
PhysicalModelgetPhysicalModel () const
 get the physical model
 Properties (const std::string n="")
 A nice simple constructor, with a given name.
 Properties (PhysicalModel *, const std::string n="")
 Another nice constructor, with the PM and a name.
void setName (std::string)
 set the name (use the string = operator)
void setPhysicalModel (PhysicalModel *)
 set the physical model
virtual ~Properties ()=default
 The default destructor.

Field methods (manages any custom fields)

std::map< std::string, std::string > fields
 map containing all the different fields (name, value stored as string )
void xmlToFields (xsd::cxx::tree::attribute_set< char > attrs)
 convert the xml node parameters to data fields
unsigned int numberOfFields () const
 get the number of extra fields found in the PML
bool isAField (std::string attName) const
 check if the field exist in the XML document, return false if it does not
std::string getField (unsigned int) const
 get the name of field of given index
double getDouble (std::string attName)
 field accessor: get the field attName as a double value, if field does not exist, 0.0 is return
int getInt (std::string attName) const
 field accessor: get the field attName as an int value, if field does not exist, 0 is return
bool getBool (std::string attName) const
 field accessor: get the field attName as a bool value, if field does not exist, false is return
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
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
void set (std::string attName, double val)
 field modificator: set field attName using a double value
void set (std::string attName, int val)
 field modificator: set field attName using an int value
void set (std::string attName, bool val)
 field modificator: set field attName using a bool value
void set (std::string attName, std::string val)
 field modificator: set field attName using a string value

Detailed Description

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.

Constructor & Destructor Documentation

◆ Properties() [1/2]

◆ Properties() [2/2]

Properties::Properties ( PhysicalModel * p,
const std::string n = "" )

Another nice constructor, with the PM and a name.

◆ ~Properties()

virtual Properties::~Properties ( )
virtualdefault

The default destructor.

Member Function Documentation

◆ get()

void Properties::get ( std::string attName,
std::string & attVal ) const
inline

field accessor: get the field attName as a string value in attVal, if field does not exist, empty string is return

References fields.

◆ getBool()

bool Properties::getBool ( std::string attName) const
inline

field accessor: get the field attName as a bool value, if field does not exist, false is return

References fields.

◆ getDouble()

double Properties::getDouble ( std::string attName)
inline

field accessor: get the field attName as a double value, if field does not exist, 0.0 is return

References fields.

◆ getField()

std::string Properties::getField ( unsigned int id) const

get the name of field of given index

Returns
the field name if i is valid, otherwise return blank string ""

References fields.

◆ getInt()

int Properties::getInt ( std::string attName) const
inline

field accessor: get the field attName as an int value, if field does not exist, 0 is return

References fields.

◆ getName()

std::string Properties::getName ( ) const
inline

get the name (be careful, this method DOES NOT return a copy, so you got the direct ptr to the name!!!)

Referenced by AtomProperties::xmlPrint(), CellProperties::xmlPrint(), and StructuralComponentProperties::xmlPrint().

◆ getPhysicalModel()

PhysicalModel * Properties::getPhysicalModel ( ) const
inline

get the physical model

◆ getString()

std::string Properties::getString ( std::string attName) const
inline

field accessor: get the field attName as a string value, if field does not exist, empty string is return

References fields.

◆ isAField()

bool Properties::isAField ( std::string attName) const
inline

check if the field exist in the XML document, return false if it does not

References fields.

Referenced by PMLComponent::propertyValueChanged().

◆ numberOfFields()

unsigned int Properties::numberOfFields ( ) const

get the number of extra fields found in the PML

References fields.

◆ set() [1/4]

void Properties::set ( std::string attName,
bool val )
inline

field modificator: set field attName using a bool value

References fields.

◆ set() [2/4]

void Properties::set ( std::string attName,
double val )
inline

field modificator: set field attName using a double value

References fields.

Referenced by PMLExplorerWidget::propertyChanged(), and PMLComponent::propertyValueChanged().

◆ set() [3/4]

void Properties::set ( std::string attName,
int val )
inline

field modificator: set field attName using an int value

References fields.

◆ set() [4/4]

void Properties::set ( std::string attName,
std::string val )
inline

field modificator: set field attName using a string value

References fields.

◆ setName()

void Properties::setName ( std::string n)
inline

set the name (use the string = operator)

Referenced by AtomProperties::AtomProperties(), and StructuralComponentProperties::StructuralComponentProperties().

◆ setPhysicalModel()

void Properties::setPhysicalModel ( PhysicalModel * pm)
inline

set the physical model

◆ xmlToFields()

void Properties::xmlToFields ( xsd::cxx::tree::attribute_set< char > attrs)

Member Data Documentation

◆ fields

std::map<std::string, std::string> Properties::fields
protected

The documentation for this class was generated from the following files: