solver  1.0
XmlReader.h
Go to the documentation of this file.
1 /*
2  This file is part of the EnergyOptimizatorOfRoboticCells program.
3 
4  EnergyOptimizatorOfRoboticCells is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  EnergyOptimizatorOfRoboticCells is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with EnergyOptimizatorOfRoboticCells. If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef HLIDAC_PES_XML_READER_H
19 #define HLIDAC_PES_XML_READER_H
20 
28 #include <cassert>
29 #include <map>
30 #include <string>
31 #include <vector>
32 #include <libxml++/libxml++.h>
33 #include "Settings.h"
34 #include "RoboticLine.h"
36 
45 class XmlReader {
46  private:
47  XmlReader() { }
50 
55  void processRootNode(const xmlpp::Node *rootNode);
60  void processInstanceNode(const xmlpp::Node *node);
66  Robot* processRobotNode(const xmlpp::Node *robotNode);
73  StaticActivity* processStaticActivityNode(const xmlpp::Node *node, const std::vector<RobotPowerMode*>& robotModes);
79  DynamicActivity* processDynamicActivityNode(const xmlpp::Node *node);
85  InterRobotOperation* processInterRobotOperationNode(const xmlpp::Node *interRobotOperationNode) const;
91  std::pair<ActivityMode*, ActivityMode*> processCollisionPairNode(const xmlpp::Node *collisionPairNode) const;
92 
98  const xmlpp::Element* castToElement(const xmlpp::Node *node) const;
107  std::string getAttribute(const xmlpp::Element* node, const std::string& attributeName, bool required = true) const;
117  std::string getTextFromElement(const xmlpp::Element* element, const std::string& childName, bool required = true) const;
118 
120  std::vector<RoboticLine> mLines;
122  std::vector<PrecalculatedMapping> mMapping;
124  std::string mDatasetName;
126  std::string mDatasetDescription;
127 
129  std::map<uint32_t, Activity*> mAidToActivity;
131  std::map<uint32_t, Location*> mPointToLocation;
133  std::map<Movement*, std::pair<uint32_t, uint32_t>> mMovementToPoints;
134 
136  friend class InstancesReader;
137 };
138 
139 #endif
140 
std::map< uint32_t, Location * > mPointToLocation
Unique mapping of coordinate identifications (called points) to the related location.
Definition: XmlReader.h:131
std::vector< RoboticLine > mLines
Vector of problem instances, i.e. robotic cells.
Definition: XmlReader.h:120
Instance of this class includes all the data structures and methods related to a robot.
Definition: RoboticLine.h:432
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...
Definition: XmlReader.cpp:365
Collection of movements between two static activities.
Definition: RoboticLine.h:261
std::map< Movement *, std::pair< uint32_t, uint32_t > > mMovementToPoints
It maps the movement to start and end coordinates of the movement.
Definition: XmlReader.h:133
The class is intended to be used by users for the dataset parsing and checking.
void readDatasetFromXmlFile()
It parses the XML dataset (specified in Settings::DATASET_FILE) and checks it against schema...
Definition: XmlReader.cpp:39
The structures and methods suitable for fast searching in the data structure of the robotic cell...
void processInstanceNode(const xmlpp::Node *node)
It parses the problem instance specified by the node.
Definition: XmlReader.cpp:64
std::pair< ActivityMode *, ActivityMode * > processCollisionPairNode(const xmlpp::Node *collisionPairNode) const
It parses an element containing time disjunctive pair, and returns the pointers to colliding location...
Definition: XmlReader.cpp:319
std::string mDatasetDescription
Description of the dataset.
Definition: XmlReader.h:126
Collection of locations in which a robot operation (or waiting) can be performed. ...
Definition: RoboticLine.h:304
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 robo...
Definition: XmlReader.cpp:134
It declares the namespace for program settings.
std::vector< PrecalculatedMapping > mMapping
Vector of precalculated mappings for fast access by a key.
Definition: XmlReader.h:122
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.
Definition: XmlReader.cpp:385
The inter-robot operation corresponding to the workpiece/weldment handling.
Definition: RoboticLine.h:518
Robot * processRobotNode(const xmlpp::Node *robotNode)
It parses the data related to the robot, and creates the instance of Robot class. ...
Definition: XmlReader.cpp:100
Parser of XML datasets.
Definition: XmlReader.h:45
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...
Definition: XmlReader.cpp:372
DynamicActivity * processDynamicActivityNode(const xmlpp::Node *node)
An instance of the dynamic activity is created from the parsed data.
Definition: XmlReader.cpp:185
void processRootNode(const xmlpp::Node *rootNode)
It parses all the dataset and stores the data to member variables.
Definition: XmlReader.cpp:53
std::string mDatasetName
Name of the dataset.
Definition: XmlReader.h:124
The file contains various classes devoted to abstract representation of the robotic cell...
InterRobotOperation * processInterRobotOperationNode(const xmlpp::Node *interRobotOperationNode) const
It creates a new inter-robot operation from parsed data.
Definition: XmlReader.cpp:257
std::map< uint32_t, Activity * > mAidToActivity
A map mapping the activity identification to the pointer to the related activity. ...
Definition: XmlReader.h:129