1
/* PeTe - Petri Engine exTremE
2
* Copyright (C) 2011 Jonas Finnemann Jensen <jopsen@gmail.com>,
3
* Thomas Søndersø Nielsen <primogens@gmail.com>,
4
* Lars Kærlund Østergaard <larsko@gmail.com>,
5
* Peter Gjøl Jensen <root@petergjoel.dk>
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
27
#include <rapidxml.hpp>
29
#include "../PetriEngine/AbstractPetriNetBuilder.h"
30
#include "../PetriEngine/PQL/PQL.h"
31
#include "../PetriEngine/Colored/ColoredNetStructures.h"
32
#include "../PetriEngine/Colored/Expressions.h"
33
#include "../PetriEngine/Colored/Colors.h"
41
PetriEngine::Colored::ArcExpression_ptr expr;
43
typedef std::vector<Arc> ArcList;
44
typedef ArcList::iterator ArcIter;
49
PetriEngine::Colored::GuardExpression_ptr expr;
51
typedef std::vector<Transition> TransitionList;
52
typedef TransitionList::iterator TransitionIter;
58
typedef std::unordered_map<std::string, NodeName> NodeNameMap;
60
typedef std::unordered_map<std::string, PetriEngine::Colored::ColorType*> ColorTypeMap;
61
typedef std::unordered_map<std::string, PetriEngine::Colored::Variable*> VariableMap;
66
std::string name, text;
72
void parse(std::ifstream& xml,
73
PetriEngine::AbstractPetriNetBuilder* builder);
75
std::vector<Query> getQueries() {
80
void parseElement(rapidxml::xml_node<>* element);
81
void parsePlace(rapidxml::xml_node<>* element);
82
void parseArc(rapidxml::xml_node<>* element, bool inhibitor = false);
83
void parseTransition(rapidxml::xml_node<>* element);
84
void parseDeclarations(rapidxml::xml_node<>* element);
85
void parseNamedSort(rapidxml::xml_node<>* element);
86
PetriEngine::Colored::ArcExpression_ptr parseArcExpression(rapidxml::xml_node<>* element);
87
PetriEngine::Colored::GuardExpression_ptr parseGuardExpression(rapidxml::xml_node<>* element);
88
PetriEngine::Colored::ColorExpression_ptr parseColorExpression(rapidxml::xml_node<>* element);
89
PetriEngine::Colored::AllExpression_ptr parseAllExpression(rapidxml::xml_node<>* element);
90
PetriEngine::Colored::ColorType* parseUserSort(rapidxml::xml_node<>* element);
91
PetriEngine::Colored::NumberOfExpression_ptr parseNumberOfExpression(rapidxml::xml_node<>* element);
92
void parseTransportArc(rapidxml::xml_node<>* element);
93
void parseValue(rapidxml::xml_node<>* element, std::string& text);
94
uint32_t parseNumberConstant(rapidxml::xml_node<>* element);
95
void parsePosition(rapidxml::xml_node<>* element, double& x, double& y);
96
void parseQueries(rapidxml::xml_node<>* element);
97
const PetriEngine::Colored::Color* findColor(const char* name) const;
98
PetriEngine::AbstractPetriNetBuilder* builder;
102
TransitionList transitions;
103
ColorTypeMap colorTypes;
104
VariableMap variables;
106
std::vector<Query> queries;
109
#endif // PNMLPARSER_H