Parser of XML datasets.
More...
#include <XmlReader.h>
|
void | readDatasetFromXmlFile () |
| It parses the XML dataset (specified in Settings::DATASET_FILE) and checks it against schema.
|
|
void | processRootNode (const xmlpp::Node *rootNode) |
| It parses all the dataset and stores the data to member variables. More...
|
|
void | processInstanceNode (const xmlpp::Node *node) |
| It parses the problem instance specified by the node. More...
|
|
Robot * | processRobotNode (const xmlpp::Node *robotNode) |
| It parses the data related to the robot, and creates the instance of Robot class. More...
|
|
StaticActivity * | processStaticActivityNode (const xmlpp::Node *node, const std::vector< RobotPowerMode * > &robotModes) |
| An instance of the static activity is created from the parsed data and power saving modes of the robot. More...
|
|
DynamicActivity * | processDynamicActivityNode (const xmlpp::Node *node) |
| An instance of the dynamic activity is created from the parsed data. More...
|
|
InterRobotOperation * | processInterRobotOperationNode (const xmlpp::Node *interRobotOperationNode) const |
| It creates a new inter-robot operation from parsed data. More...
|
|
std::pair< ActivityMode *, ActivityMode * > | processCollisionPairNode (const xmlpp::Node *collisionPairNode) const |
| It parses an element containing time disjunctive pair, and returns the pointers to colliding locations/movements. More...
|
|
const xmlpp::Element * | castToElement (const xmlpp::Node *node) const |
| The method casts xmlpp::Node to xmlpp::Element, and in case of success the result is returned, otherwise an exception is thrown. More...
|
|
std::string | getAttribute (const xmlpp::Element *node, const std::string &attributeName, bool required=true) const |
| It parses the value assigned to the specified attribute and returns it in the form of string. More...
|
|
std::string | getTextFromElement (const xmlpp::Element *element, const std::string &childName, bool required=true) const |
| It tries to extract the text from the child element, e.g. getTextFromElement(instanceElement, "name", false) returns the name of the instance or an empty string if the name is not specified. More...
|
|
|
class | InstancesReader |
| Only InstancesReader is allowed to use the data and methods of this class.
|
|
Parser of XML datasets.
Instance of XmlReader class parses XML datasets with problem instances, and fills data structures connected with the robotic cell. During the reading some elemental checks are performed, however, more complex checking and post-processing is accomplished by InstancesReader class.
- See also
- RoboticLine, InstancesReader
Definition at line 45 of file XmlReader.h.
const Element * XmlReader::castToElement |
( |
const xmlpp::Node * |
node | ) |
const |
|
private |
The method casts xmlpp::Node to xmlpp::Element, and in case of success the result is returned, otherwise an exception is thrown.
- Parameters
-
node | A node of a document tree. |
- Returns
- A pointer to an element, i.e. '<x>...</x>'.
Definition at line 365 of file XmlReader.cpp.
string XmlReader::getAttribute |
( |
const xmlpp::Element * |
node, |
|
|
const std::string & |
attributeName, |
|
|
bool |
required = true |
|
) |
| const |
|
private |
It parses the value assigned to the specified attribute and returns it in the form of string.
- Parameters
-
node | An element from which the attribute is extracted. |
attributeName | The name of the attribute. |
required | Specifies whether the attribute is mandatory. |
- Returns
- String containing the attribute value, e.g. "hello" if element is '<x attr="hello"/>'.
- Note
- If the attribute is not mandatory and also not present, then an empty string is returned.
Definition at line 372 of file XmlReader.cpp.
string XmlReader::getTextFromElement |
( |
const xmlpp::Element * |
element, |
|
|
const std::string & |
childName, |
|
|
bool |
required = true |
|
) |
| const |
|
private |
It tries to extract the text from the child element, e.g. getTextFromElement(instanceElement, "name", false) returns the name of the instance or an empty string if the name is not specified.
- Parameters
-
element | An element that may contain an inner element called childName. |
childName | An element containing the text. |
required | Indicates whether the child element is mandatory. |
- Returns
- A text extracted from the child element or an empty string.
- Note
- If the child element is optional, then an empty string can be returned.
Definition at line 385 of file XmlReader.cpp.
pair< ActivityMode *, ActivityMode * > XmlReader::processCollisionPairNode |
( |
const xmlpp::Node * |
collisionPairNode | ) |
const |
|
private |
It parses an element containing time disjunctive pair, and returns the pointers to colliding locations/movements.
- Parameters
-
collisionPairNode | The node of a document tree corresponding to '<collision-pair>...</collision-pair>' elements. |
- Returns
- A pair containing the parsed collision pair.
Definition at line 319 of file XmlReader.cpp.
DynamicActivity * XmlReader::processDynamicActivityNode |
( |
const xmlpp::Node * |
node | ) |
|
|
private |
An instance of the dynamic activity is created from the parsed data.
- Parameters
-
node | The node of a document tree corresponding to '<dynamic-activity>...</dynamic-activity>' elements. |
- Returns
- Pointer to a newly created dynamic activity.
Definition at line 185 of file XmlReader.cpp.
void XmlReader::processInstanceNode |
( |
const xmlpp::Node * |
node | ) |
|
|
private |
It parses the problem instance specified by the node.
- Parameters
-
node | The node of a document tree corresponding to '<instance>...</instance>' elements. |
Definition at line 64 of file XmlReader.cpp.
InterRobotOperation * XmlReader::processInterRobotOperationNode |
( |
const xmlpp::Node * |
interRobotOperationNode | ) |
const |
|
private |
It creates a new inter-robot operation from parsed data.
- Parameters
-
interRobotOperationNode | The node of a document tree corresponding to '<operation>...</operation>' elements. |
- Returns
- Pointer to a newly created inter-robot operation.
Definition at line 257 of file XmlReader.cpp.
Robot * XmlReader::processRobotNode |
( |
const xmlpp::Node * |
robotNode | ) |
|
|
private |
It parses the data related to the robot, and creates the instance of Robot class.
- Parameters
-
robotNode | The node of a document tree corresponding to '<robot>...</robot>' elements. |
- Returns
- Pointer to a newly created robot.
Definition at line 100 of file XmlReader.cpp.
void XmlReader::processRootNode |
( |
const xmlpp::Node * |
rootNode | ) |
|
|
private |
It parses all the dataset and stores the data to member variables.
- Parameters
-
rootNode | The node of a document tree corresponding to '<dataset>...</dataset>' elements. |
Definition at line 53 of file XmlReader.cpp.
An instance of the static activity is created from the parsed data and power saving modes of the robot.
- Parameters
-
node | The node of a document tree corresponding to '<static-activity>...</static-activity>' elements. |
robotModes | The vector containing the power saving modes of the robot that performs the activity specified by the node. |
- Returns
- Pointer to a newly created static activity.
Definition at line 134 of file XmlReader.cpp.
The documentation for this class was generated from the following files:
- /home/bukatlib/Downloads/SolverEquationsGeneratedAsImages/inc/InstancesReader/XmlReader.h
- /home/bukatlib/Downloads/SolverEquationsGeneratedAsImages/src/InstancesReader/XmlReader.cpp