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/>.
20
#ifndef ABSTRACTPETRINETBUILDER_H
21
#define ABSTRACTPETRINETBUILDER_H
26
#include "Colored/Multiset.h"
27
#include "Colored/Expressions.h"
29
namespace PetriEngine {
31
/** Abstract builder for petri nets */
32
class AbstractPetriNetBuilder {
34
bool _isColored = false;
37
/** Add a new place with a unique name */
38
virtual void addPlace(const std::string& name,
42
/** Add a new colored place with a unique name */
43
virtual void addPlace(const std::string& name,
44
Colored::ColorType* type,
45
Colored::Multiset&& tokens,
49
std::cerr << "Colored places are not supported in standard P/T nets" << std::endl;
52
/** Add a new transition with a unique name */
53
virtual void addTransition(const std::string& name,
56
/** Add a new colored transition with a unique name */
57
virtual void addTransition(const std::string& name,
58
const Colored::GuardExpression_ptr& guard,
62
std::cerr << "Colored transitions are not supported in standard P/T nets" << std::endl;
65
/** Add input arc with given weight */
66
virtual void addInputArc(const std::string& place,
67
const std::string& transition,
70
/** Add colored input arc with given arc expression */
71
virtual void addInputArc(const std::string& place,
72
const std::string& transition,
73
const Colored::ArcExpression_ptr& expr)
75
std::cerr << "Colored input arcs are not supported in standard P/T nets" << std::endl;
78
/** Add output arc with given weight */
79
virtual void addOutputArc(const std::string& transition,
80
const std::string& place,
82
/** Add output arc with given arc expression */
83
virtual void addOutputArc(const std::string& transition,
84
const std::string& place,
85
const Colored::ArcExpression_ptr& expr)
87
std::cerr << "Colored output arcs are not supported in standard P/T nets" << std::endl;
90
/** Add color types with id */
91
virtual void addColorType(const std::string& id,
92
Colored::ColorType* type)
94
std::cerr << "Color types are not supported in standard P/T nets" << std::endl;
98
virtual void enableColors() {
102
virtual bool isColored() const {
106
virtual void sort() = 0;
108
virtual ~AbstractPetriNetBuilder() {
114
#endif // ABSTRACTPETRINETBUILDER_H