RobWorkProject  23.9.11-
Classes | Static Public Member Functions | List of all members
DOMCoreBasisTypes Class Reference

Utility class to help read in the content of a XML-files parsed with Xerces The Class is part of the core Library in a limited edition. Use DOMBasisTypes for a full implementation. More...

#include <DOMCoreBasisTypes.hpp>

Classes

class  Initializer
 Utility class which initializes local static variables. More...
 

Static Public Member Functions

static const std::string & idQ ()
 Identifier for rw::math::Q in the XML format. More...
 
static const std::string & idVector3D ()
 Identifier for rw::math::Vector3D<> in the XML format. More...
 
static const std::string & idVector2D ()
 Identifier for rw::math::Vector2D<> in the XML format. More...
 
static const std::string & idRotation3D ()
 Identifier for rw::math::Rotation3D<> in the XML format. More...
 
static const std::string & idRPY ()
 Identifier for rw::math::RPY<> in the XML format. More...
 
static const std::string & idEAA ()
 Identifier for rw::math::EAA<> in the XML format. More...
 
static const std::string & idQuaternion ()
 Identifier for rw::math::Quaternion<> in the XML format. More...
 
static const std::string & idRotation2D ()
 Identifier for rw::math::Rotation2D<> in the XML format. More...
 
static const std::string & idRotation2DAngle ()
 Identifier for single angle used to specify rw::math::Rotation2D<> in the XML format. More...
 
static const std::string & idTransform2D ()
 Identifier for rw::math::Transform2D<> in the XML format. More...
 
static const std::string & idTransform3D ()
 Identifier for rw::math::Transform3D<> in the XML format. More...
 
static const std::string & idMatrix ()
 Identifier for rw::math::MatrixXd<> in the XML format. More...
 
static const std::string & idVelocityScrew6D ()
 Identifier for rw::math::VelocityScrew6D<> in the XML format. More...
 
static const std::string & idPos ()
 Identifier for the position specification used in Transform3D. More...
 
static const std::string & idLinear ()
 Identifier for specifying the linear part in a VelocityScrew6D. More...
 
static const std::string & idAngular ()
 Identifier for specifying the angular part in a VelocityScrew6D. More...
 
static const std::string & idState ()
 Identifier for specifying a State. More...
 
static const std::string & idQState ()
 Identifier for specifying a State. More...
 
static const std::string & idTreeState ()
 Identifier for specifying a State. More...
 
static const std::string & idBoolean ()
 Identifier for specifying a boolean. More...
 
static const std::string & idDouble ()
 Identifier for specifying a double. More...
 
static const std::string & idFloat ()
 Identifier for specifying a float. More...
 
static const std::string & idInteger ()
 Identifier for specifying an integer. More...
 
static const std::string & idString ()
 Identifier for specifying a string. More...
 
static const std::string & idStringList ()
 Identifier for specifying a list of strings. More...
 
static const std::string & idIntList ()
 Identifier for specifying a list of integers. More...
 
static const std::string & idDoubleList ()
 Identifier for specifying a list of doubles. More...
 
static const std::string & idStringPair ()
 Identifier for specifying a pair of strings. More...
 
static const std::string & idUnitAttribute ()
 Identifier for the unit attribute. More...
 
static const std::string & idPlane ()
 Identifier for a Plane. More...
 
static const std::string & idBox ()
 Identifier for a Box. More...
 
static const std::string & idSphere ()
 Identifier for a Sphere. More...
 
static const std::string & idCone ()
 Identifier for a Cone. More...
 
static const std::string & idCylinder ()
 Identifier for a Cylinder. More...
 
static const std::string & idTube ()
 Identifier for a Tube. More...
 
static double getUnit (const std::string key)
 Returns the conversion value for a given unit. More...
 
static std::pair< std::string, std::string > readStringPair (rw::core::DOMElem::Ptr element, bool doCheckHeader=false)
 Returns pair of strings from element. More...
 
static std::vector< std::pair< std::string, std::string > > readStringPairs (rw::core::DOMElem::Ptr element)
 Reads in a list of string pairs that are childs of element. More...
 
static std::vector< std::string > readStringList (rw::core::DOMElem::Ptr element)
 Reads in a list of strings that are childs of element. More...
 
static std::string readString (rw::core::DOMElem::Ptr element, bool doCheckHeader=false)
 Reads in a string element. More...
 
static double readDouble (rw::core::DOMElem::Ptr element, bool doCheckHeader=false)
 Reads in a double element. More...
 
static float readFloat (rw::core::DOMElem::Ptr element, bool doCheckHeader=false)
 Reads in a double element. More...
 
static int readInt (rw::core::DOMElem::Ptr element, bool doCheckHeader=false)
 Reads in an integer element. More...
 
static std::vector< int > readIntList (rw::core::DOMElem::Ptr element, bool doCheckHeader=false)
 Reads in a list of integers from element. More...
 
static std::vector< double > readDoubleList (rw::core::DOMElem::Ptr element, bool doCheckHeader=false)
 Reads in a list of doubles from element. More...
 
static bool readBool (rw::core::DOMElem::Ptr element, bool doCheckHeader=false)
 Reads in a boolean element. More...
 
static rw::core::DOMElem::Ptr write (int val, rw::core::DOMElem::Ptr elem, bool addHeader=true)
 Writes val to elem. More...
 
static rw::core::DOMElem::Ptr write (double val, rw::core::DOMElem::Ptr elem, bool addHeader=true)
 Writes val to elem. More...
 
static rw::core::DOMElem::Ptr write (const std::string &str, rw::core::DOMElem::Ptr elem, bool addHeader=true)
 Writes str to elem. More...
 
static rw::core::DOMElem::Ptr createElement (const std::string &id, const std::string &value, rw::core::DOMElem::Ptr doc)
 Create an element with name id and content value in the DOMDocument doc. More...
 
static rw::core::DOMElem::Ptr createBoolean (bool value, rw::core::DOMElem::Ptr doc)
 Creates an element to represent value. More...
 
static rw::core::DOMElem::Ptr createDouble (double value, rw::core::DOMElem::Ptr doc)
 Creates an element to represent value. More...
 
static rw::core::DOMElem::Ptr createFloat (float value, rw::core::DOMElem::Ptr doc)
 Creates an element to represent value. More...
 
static rw::core::DOMElem::Ptr createInteger (int value, rw::core::DOMElem::Ptr doc)
 Creates an element to represent value. More...
 
static rw::core::DOMElem::Ptr createString (const std::string &string, rw::core::DOMElem::Ptr doc)
 Creates an element to represent string. More...
 
static rw::core::DOMElem::Ptr createStringList (const std::vector< std::string > &strings, rw::core::DOMElem::Ptr doc)
 Creates an element to represent strings. More...
 
static rw::core::DOMElem::Ptr createIntList (const std::vector< int > &ints, rw::core::DOMElem::Ptr doc)
 Creates an element to represent ints. More...
 
static rw::core::DOMElem::Ptr createDoubleList (const std::vector< double > &doubles, rw::core::DOMElem::Ptr doc)
 Creates an element to represent doubles. More...
 
static rw::core::DOMElem::Ptr createStringPair (const std::string &first, const std::string &second, rw::core::DOMElem::Ptr doc)
 Creates an element to represent strings first and second. More...
 

Detailed Description

Utility class to help read in the content of a XML-files parsed with Xerces The Class is part of the core Library in a limited edition. Use DOMBasisTypes for a full implementation.

Member Function Documentation

◆ createBoolean()

static rw::core::DOMElem::Ptr createBoolean ( bool  value,
rw::core::DOMElem::Ptr  doc 
)
static

Creates an element to represent value.

Creates a DOMElement owned by doc and representing value

The method may throw a rw::core::Exception in case of errors

Parameters
value[in] Value to represent
doc[in] Document which should contain the element
Returns
Pointer to the newly created DOMElement

◆ createDouble()

static rw::core::DOMElem::Ptr createDouble ( double  value,
rw::core::DOMElem::Ptr  doc 
)
static

Creates an element to represent value.

Creates a DOMElement owned by doc and representing value

The method may throw a rw::core::Exception in case of errors

Parameters
value[in] Value to represent
doc[in] Document which should contain the element
Returns
Pointer to the newly created DOMElement

◆ createDoubleList()

static rw::core::DOMElem::Ptr createDoubleList ( const std::vector< double > &  doubles,
rw::core::DOMElem::Ptr  doc 
)
static

Creates an element to represent doubles.

Creates a DOMElement owned by doc and representing doubles

The method may throw a rw::core::Exception in case of errors

Parameters
doubles[in] Value to represent
doc[in] Document which should contain the element
Returns
Pointer to the newly created DOMElement

◆ createElement()

static rw::core::DOMElem::Ptr createElement ( const std::string &  id,
const std::string &  value,
rw::core::DOMElem::Ptr  doc 
)
static

Create an element with name id and content value in the DOMDocument doc.

Create an element named id and adds a DOMText-node containing value as a child to it.

Parameters
id[in] Name of the new element
value[in] Text value of the new element
doc[in] Document for which the new element shall be created
Returns
The new element.

◆ createFloat()

static rw::core::DOMElem::Ptr createFloat ( float  value,
rw::core::DOMElem::Ptr  doc 
)
static

Creates an element to represent value.

Creates a DOMElement owned by doc and representing value

The method may throw a rw::core::Exception in case of errors

Parameters
value[in] Value to represent
doc[in] Document which should contain the element
Returns
Pointer to the newly created DOMElement

◆ createInteger()

static rw::core::DOMElem::Ptr createInteger ( int  value,
rw::core::DOMElem::Ptr  doc 
)
static

Creates an element to represent value.

Creates a DOMElement owned by doc and representing value

The method may throw a rw::core::Exception in case of errors

Parameters
value[in] Value to represent
doc[in] Document which should contain the element
Returns
Pointer to the newly created DOMElement

◆ createIntList()

static rw::core::DOMElem::Ptr createIntList ( const std::vector< int > &  ints,
rw::core::DOMElem::Ptr  doc 
)
static

Creates an element to represent ints.

Creates a DOMElement owned by doc and representing ints

The method may throw a rw::core::Exception in case of errors

Parameters
ints[in] Value to represent
doc[in] Document which should contain the element
Returns
Pointer to the newly created DOMElement

◆ createString()

static rw::core::DOMElem::Ptr createString ( const std::string &  string,
rw::core::DOMElem::Ptr  doc 
)
static

Creates an element to represent string.

Creates a DOMElement owned by doc and representing string

The method may throw a rw::core::Exception in case of errors

Parameters
string[in] Value to represent
doc[in] Document which should contain the element
Returns
Pointer to the newly created DOMElement

◆ createStringList()

static rw::core::DOMElem::Ptr createStringList ( const std::vector< std::string > &  strings,
rw::core::DOMElem::Ptr  doc 
)
static

Creates an element to represent strings.

Creates a DOMElement owned by doc and representing strings

The method may throw a rw::core::Exception in case of errors

Parameters
strings[in] Value to represent
doc[in] Document which should contain the element
Returns
Pointer to the newly created DOMElement

◆ createStringPair()

static rw::core::DOMElem::Ptr createStringPair ( const std::string &  first,
const std::string &  second,
rw::core::DOMElem::Ptr  doc 
)
static

Creates an element to represent strings first and second.

Creates a DOMElement owned by doc and representing strings first and second

The method may throw a rw::core::Exception in case of errors

Parameters
first[in] First string in the pair
second[in] Second string in the pair
doc[in] Document which should contain the element
Returns
Pointer to the newly created DOMElement

◆ getUnit()

static double getUnit ( const std::string  key)
static

Returns the conversion value for a given unit.

The value returned can be used to convert the values specified in the element to the standard units used in RobWork.

Throws an exception if key cannot be matched to a unit

Parameters
key[in] The key for which the get the unit
Returns
Conversion value

◆ idAngular()

static const std::string& idAngular ( )
static

Identifier for specifying the angular part in a VelocityScrew6D.

Returns
the identifier.

◆ idBoolean()

static const std::string& idBoolean ( )
static

Identifier for specifying a boolean.

Returns
the identifier.

◆ idBox()

static const std::string& idBox ( )
static

Identifier for a Box.

Returns
the identifier.

◆ idCone()

static const std::string& idCone ( )
static

Identifier for a Cone.

Returns
the identifier.

◆ idCylinder()

static const std::string& idCylinder ( )
static

Identifier for a Cylinder.

Returns
the identifier.

◆ idDouble()

static const std::string& idDouble ( )
static

Identifier for specifying a double.

Returns
the identifier.

◆ idDoubleList()

static const std::string& idDoubleList ( )
static

Identifier for specifying a list of doubles.

Returns
the identifier.

◆ idEAA()

static const std::string& idEAA ( )
static

Identifier for rw::math::EAA<> in the XML format.

Returns
the identifier.

◆ idFloat()

static const std::string& idFloat ( )
static

Identifier for specifying a float.

Returns
the identifier.

◆ idInteger()

static const std::string& idInteger ( )
static

Identifier for specifying an integer.

Returns
the identifier.

◆ idIntList()

static const std::string& idIntList ( )
static

Identifier for specifying a list of integers.

Returns
the identifier.

◆ idLinear()

static const std::string& idLinear ( )
static

Identifier for specifying the linear part in a VelocityScrew6D.

Returns
the identifier.

◆ idMatrix()

static const std::string& idMatrix ( )
static

Identifier for rw::math::MatrixXd<> in the XML format.

Returns
the identifier.

◆ idPlane()

static const std::string& idPlane ( )
static

Identifier for a Plane.

Returns
the identifier.

◆ idPos()

static const std::string& idPos ( )
static

Identifier for the position specification used in Transform3D.

Returns
the identifier.

◆ idQ()

static const std::string& idQ ( )
static

Identifier for rw::math::Q in the XML format.

Returns
the identifier.

◆ idQState()

static const std::string& idQState ( )
static

Identifier for specifying a State.

Returns
the identifier.

◆ idQuaternion()

static const std::string& idQuaternion ( )
static

Identifier for rw::math::Quaternion<> in the XML format.

Returns
the identifier.

◆ idRotation2D()

static const std::string& idRotation2D ( )
static

Identifier for rw::math::Rotation2D<> in the XML format.

Returns
the identifier.

◆ idRotation2DAngle()

static const std::string& idRotation2DAngle ( )
static

Identifier for single angle used to specify rw::math::Rotation2D<> in the XML format.

Returns
the identifier.

◆ idRotation3D()

static const std::string& idRotation3D ( )
static

Identifier for rw::math::Rotation3D<> in the XML format.

Returns
the identifier.

◆ idRPY()

static const std::string& idRPY ( )
static

Identifier for rw::math::RPY<> in the XML format.

Returns
the identifier.

◆ idSphere()

static const std::string& idSphere ( )
static

Identifier for a Sphere.

Returns
the identifier.

◆ idState()

static const std::string& idState ( )
static

Identifier for specifying a State.

Returns
the identifier.

◆ idString()

static const std::string& idString ( )
static

Identifier for specifying a string.

Returns
the identifier.

◆ idStringList()

static const std::string& idStringList ( )
static

Identifier for specifying a list of strings.

Returns
the identifier.

◆ idStringPair()

static const std::string& idStringPair ( )
static

Identifier for specifying a pair of strings.

Returns
the identifier.

◆ idTransform2D()

static const std::string& idTransform2D ( )
static

Identifier for rw::math::Transform2D<> in the XML format.

Returns
the identifier.

◆ idTransform3D()

static const std::string& idTransform3D ( )
static

Identifier for rw::math::Transform3D<> in the XML format.

Returns
the identifier.

◆ idTreeState()

static const std::string& idTreeState ( )
static

Identifier for specifying a State.

Returns
the identifier.

◆ idTube()

static const std::string& idTube ( )
static

Identifier for a Tube.

Returns
the identifier.
the identifier.

◆ idUnitAttribute()

static const std::string& idUnitAttribute ( )
static

Identifier for the unit attribute.

Returns
the identifier.

◆ idVector2D()

static const std::string& idVector2D ( )
static

Identifier for rw::math::Vector2D<> in the XML format.

Returns
the identifier.

◆ idVector3D()

static const std::string& idVector3D ( )
static

Identifier for rw::math::Vector3D<> in the XML format.

Returns
the identifier.

◆ idVelocityScrew6D()

static const std::string& idVelocityScrew6D ( )
static

Identifier for rw::math::VelocityScrew6D<> in the XML format.

Returns
the identifier.

◆ readBool()

static bool readBool ( rw::core::DOMElem::Ptr  element,
bool  doCheckHeader = false 
)
static

Reads in a boolean element.

Read in element and converts the content to a bool. Only if the content of the node equals "true" is true returned. Otherwise the method returns false.

Throws a rw::core::Exception if failing to read or parse.

Parameters
element[in] Element to read in
doCheckHeader[in] True if the element name should be checked
Returns
bool represented in element

◆ readDouble()

static double readDouble ( rw::core::DOMElem::Ptr  element,
bool  doCheckHeader = false 
)
static

Reads in a double element.

Read in element and converts the content to a double Throws a rw::core::Exception if failing to read or parse.

Parameters
element[in] Element to read in
doCheckHeader[in] True if the element name should be checked
Returns
double represented in element

◆ readDoubleList()

static std::vector<double> readDoubleList ( rw::core::DOMElem::Ptr  element,
bool  doCheckHeader = false 
)
static

Reads in a list of doubles from element.

Read in element and converts the content to a list of doubles Throws a rw::core::Exception if failing to read or parse.

Parameters
element[in] Element to read in
doCheckHeader[in] True if the element name should be checked
Returns
std::vector<double> represented in element

◆ readFloat()

static float readFloat ( rw::core::DOMElem::Ptr  element,
bool  doCheckHeader = false 
)
static

Reads in a double element.

Read in element and converts the content to a double Throws a rw::core::Exception if failing to read or parse.

Parameters
element[in] Element to read in
doCheckHeader[in] True if the element name should be checked
Returns
double represented in element

◆ readInt()

static int readInt ( rw::core::DOMElem::Ptr  element,
bool  doCheckHeader = false 
)
static

Reads in an integer element.

Read in element and converts the content to an integer Throws a rw::core::Exception if failing to read or parse.

Parameters
element[in] Element to read in
doCheckHeader[in] True if the element name should be checked
Returns
int represented in element

◆ readIntList()

static std::vector<int> readIntList ( rw::core::DOMElem::Ptr  element,
bool  doCheckHeader = false 
)
static

Reads in a list of integers from element.

Read in element and converts the content to a list of integers Throws a rw::core::Exception if failing to read or parse.

Parameters
element[in] Element to read in
doCheckHeader[in] True if the element name should be checked
Returns
std::vector<int> represented in element

◆ readString()

static std::string readString ( rw::core::DOMElem::Ptr  element,
bool  doCheckHeader = false 
)
static

Reads in a string element.

Reads in element as a string element. Throws a rw::core::Exception on error

Parameters
element[in] Element to parse
doCheckHeader[in] True if the element name should be checked
Returns
String giving the content of element

◆ readStringList()

static std::vector<std::string> readStringList ( rw::core::DOMElem::Ptr  element)
static

Reads in a list of strings that are childs of element.

Reads in all strings which are childs of the element element.

Throws rw::core::Exception if failing to read and parse content.

Parameters
element[in] Element which string pairs as children
Returns
List of strings

◆ readStringPair()

static std::pair<std::string, std::string> readStringPair ( rw::core::DOMElem::Ptr  element,
bool  doCheckHeader = false 
)
static

Returns pair of strings from element.

Reads in element and returns a pair of strings. If doCheckHeader = true it checks that the element tag name matches XMLBasicTypes::StringPairId. Throws a rw::core::Exception if header does not match or if failing to read two strings.

Parameters
element[in] Element to read
doCheckHeader[in] True if the element name should be checked
Returns
Pair of strings

◆ readStringPairs()

static std::vector<std::pair<std::string, std::string> > readStringPairs ( rw::core::DOMElem::Ptr  element)
static

Reads in a list of string pairs that are childs of element.

Reads in all string pairs which are childs of the element element. This is for example used when reading in DAF setups.

Throws rw::core::Exception if failing to read and parse content.

Parameters
element[in] Element which string pairs as children
Returns
List of string pairs

◆ write() [1/3]

static rw::core::DOMElem::Ptr write ( const std::string &  str,
rw::core::DOMElem::Ptr  elem,
bool  addHeader = true 
)
static

Writes str to elem.

Parameters
str[in] Value to write
elem[in] Element to which to write
addHeader[in] Whether or not to set the header of elem
Returns
newly created DOMElem

◆ write() [2/3]

static rw::core::DOMElem::Ptr write ( double  val,
rw::core::DOMElem::Ptr  elem,
bool  addHeader = true 
)
static

Writes val to elem.

Parameters
val[in] Value to write
elem[in] Element to which to write
addHeader[in] Whether or not to set the header of elem
Returns
newly created DOMElem

◆ write() [3/3]

static rw::core::DOMElem::Ptr write ( int  val,
rw::core::DOMElem::Ptr  elem,
bool  addHeader = true 
)
static

Writes val to elem.

Parameters
val[in] Value to write
elem[in] Element to which to write
addHeader[in] Whether or not to set the header of elem
Returns
newly created DOMElem

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