ls1-MarDyn
ls1-MarDyn molecular dynamics code
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
XMLfileUnits Class Reference

XML file with unit attributes abstraction. More...

#include <xmlfileUnits.h>

Inheritance diagram for XMLfileUnits:
XMLfile

Classes

class  ValueUnit
 

Public Types

enum  UnitType {
  Unknown_Unit =-1 , No_Unit =0 , Length_Unit =1 , Mass_Unit =2 ,
  Time_Unit =3 , ElectricCurrent_Unit =4 , ThermodynamicTemperature_Unit =5 , SubstanceAmount_Unit =6 ,
  LuminousIntensity_Unit =7 , numUnitTypes
}
 

Public Member Functions

 XMLfileUnits (const std::string &filepath)
 
unsigned long getNodeValueUnit (const char *nodepath, ValueUnit &value) const
 
unsigned long getNodeValueUnit (const std::string &nodepath, ValueUnit &value) const
 
unsigned long getNodeValueReduced (const char *nodepath, double &value, UnitType ut=Unknown_Unit) const
 
unsigned long getNodeValueReduced (const std::string &nodepath, double &value, UnitType ut=Unknown_Unit) const
 
- Public Member Functions inherited from XMLfile
 XMLfile ()
 XMLfile default constructor.
 
virtual ~XMLfile ()
 XMLfile default destructor.
 
 XMLfile (const std::string &filepath)
 constructor for XML-file constructor calls initfile More...
 
bool initfile (const std::string &filepath)
 initialize with XML-file instantiating with XML file More...
 
void initstring (const char *xmlstring)
 initialize with XML-string instantiating with XML-string More...
 
const std::string getDir () const
 get XML file directory if instantiated with a XML-file, return the directory More...
 
const std::string getFilename () const
 get XML filename if instantiated with a XML-file, return the filename (without directory part of path) More...
 
long changecurrentnode (const std::string &nodepath=std::string("/"))
 set current node set a node, relative queries start with More...
 
bool changecurrentnode (const Query::const_iterator &pos)
 set current node set a node, relative queries start with More...
 
std::string getcurrentnodepath () const
 get current node path More...
 
template<typename T >
unsigned long getNodeValue (const std::string &nodepath, T &value) const
 get node value get the node content and convert it to a given type More...
 
template<typename T >
unsigned long getNodeValue (const char *nodepath, T &value) const
 get node value get the node content and convert it to a given type More...
 
std::string getNodeValue_string (const std::string &nodepath, const std::string defaultvalue=std::string()) const
 get node value as string get the node content More...
 
std::string getNodeValue_string (const char *nodepath, std::string defaultvalue=std::string()) const
 get node value as string get the node content More...
 
int getNodeValue_int (const std::string &nodepath, int defaultvalue=0) const
 get node value as int get the node content and convert it to an integer More...
 
int getNodeValue_int (const char *nodepath, int defaultvalue=0) const
 get node value as int get the node content and convert it to an integer More...
 
long getNodeValue_long (const std::string &nodepath, long defaultvalue=0) const
 get node value as long get the node content and convert it to a long More...
 
long getNodeValue_long (const char *nodepath, long defaultvalue=0) const
 get node value as long get the node content and convert it to a long More...
 
float getNodeValue_float (const std::string &nodepath, float defaultvalue=0.) const
 get node value as float get the node content and convert it to a float More...
 
float getNodeValue_float (const char *nodepath, float defaultvalue=0.) const
 get node value as float get the node content and convert it to a float More...
 
double getNodeValue_double (const std::string &nodepath, double defaultvalue=0.) const
 get node value as double get the node content and convert it to a double More...
 
double getNodeValue_double (const char *nodepath, double defaultvalue=0.) const
 get node value as double get the node content and convert it to a double More...
 
bool getNodeValue_bool (const std::string &nodepath, bool defaultvalue=false) const
 get node value as bool get the node content and convert it to a bool (an alternative of using <tag>true</tag> is to look for an occurance of an empty element like <tag>) More...
 
bool getNodeValue_bool (const char *nodepath, bool defaultvalue=false) const
 get node value as bool get the node content and convert it to a bool More...
 
void printXML (std::ostream &ostrm=std::cout) const
 print node content as XML print node content to stream using XML More...
 
void print (std::ostream &ostrm=std::cout) const
 print node content print node content and debug information to stream More...
 
void save (std::string filepath=std::string())
 save save node content as XML-file More...
 
Query query (const std::string &querystr) const
 perform a query return a query to a given query expression More...
 
 operator std::string () const
 std::string cast operator XMLfile will cast to a string with XML content
 
size_t numqueries () const
 number of registered queries return the number of active queries More...
 
void setMPIdefaults (int mpirootrank=0, MPI_Comm mpicomm=MPI_COMM_WORLD)
 

Static Public Attributes

static const char *const roottag = { "/mardyn" }
 
static const char *const refunitstag = { "refunits" }
 
static const char *const unitattributetag = { "unit" }
 
static const short int unittypequantifiers [numUnitTypes][8]
 
static const char *const unittypesymbols [numUnitTypes]
 
static const char *const unittypequalifiers [numUnitTypes]
 
static const int numPrefixes =21
 
static const char *const prefixsymbols [numPrefixes]
 
static const short int prefixquantifiers [numPrefixes]
 
- Static Public Attributes inherited from XMLfile
static const char *const includeattrtag = "include"
 
static const char *const queryattrtag = "query"
 

Detailed Description

XML file with unit attributes abstraction.

DOM representation of an XML file including unit conversion

Member Data Documentation

◆ prefixquantifiers

const short XMLfileUnits::prefixquantifiers
static
Initial value:
= { -24
,-21
,-18
,-15
,-12
,-9
,-6
,-3
,-2
,-1
,0
,1
,2
,3
,6
,9
,12
,15
,18
,21
,24
}

◆ prefixsymbols

const char *const XMLfileUnits::prefixsymbols
static
Initial value:
= { "y"
,"z"
,"a"
,"f"
,"p"
,"n"
,"u"
,"m"
,"c"
,"d"
,""
,"da"
,"h"
,"k"
,"M"
,"G"
,"T"
,"P"
,"E"
,"Z"
,"Y"
}

◆ unittypequalifiers

const char *const XMLfileUnits::unittypequalifiers
static
Initial value:
= { "no_unit"
,"length"
,"mass"
,"time"
,"current"
,"temperature"
,"substance"
,"luminous"
}

◆ unittypequantifiers

const short int XMLfileUnits::unittypequantifiers
static
Initial value:
= { { 0,0,0,0,0,0,0,0 }
,{ 0,1,0,0,0,0,0,0 }
,{ 0,0,1,0,0,0,0,0 }
,{ 0,0,0,1,0,0,0,0 }
,{ 0,0,0,0,1,0,0,0 }
,{ 0,0,0,0,0,1,0,0 }
,{ 0,0,0,0,0,0,1,0 }
,{ 0,0,0,0,0,0,0,1 }
}

◆ unittypesymbols

const char *const XMLfileUnits::unittypesymbols
static
Initial value:
= { ""
,"m"
,"g"
,"s"
,"A"
,"K"
,"mol"
,"cd"
}

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