Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
GspnJsonExporter.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace storm {
8namespace gspn {
9
14 public:
15 typedef typename storm::json<double> Json;
16 static void toStream(storm::gspn::GSPN const& gspn, std::ostream& os);
17
18 static Json translate(storm::gspn::GSPN const& gspn);
19
20 private:
21 enum ArcType { INPUT, OUTPUT, INHIBITOR };
22
23 static Json translatePlace(storm::gspn::Place const& place, double x, double y);
24
25 static Json translateImmediateTransition(storm::gspn::ImmediateTransition<double> const& transition, double x, double y);
26
27 static Json translateTimedTransition(storm::gspn::TimedTransition<double> const& transition, double x, double y);
28
29 static Json translateArc(storm::gspn::Transition const& transition, storm::gspn::Place const& place, uint64_t multiplicity, bool immediate,
30 ArcType arctype);
31
32 std::string static inline toJsonString(storm::gspn::Place const& place) {
33 std::stringstream stream;
34 stream << "p" << place.getID();
35 return stream.str();
36 }
37
38 std::string static inline toJsonString(storm::gspn::Transition const& transition, bool immediate) {
39 std::stringstream stream;
40 stream << (immediate ? "i" : "t") << transition.getID();
41 return stream.str();
42 }
43
44 std::string static inline toJsonString(storm::gspn::Transition const& transition, storm::gspn::Place const& place, ArcType arctype) {
45 std::stringstream stream;
46 stream << place.getID();
47 switch (arctype) {
48 case INPUT:
49 stream << "i";
50 break;
51 case OUTPUT:
52 stream << "o";
53 break;
54 case INHIBITOR:
55 stream << "h";
56 break;
57 default:
58 STORM_LOG_ASSERT(false, "Unknown type " << arctype << " used.");
59 }
60 stream << transition.getID();
61 return stream.str();
62 }
63};
64
65} // namespace gspn
66} // namespace storm
Exports a GSPN into the JSON format for visualizing it.
static Json translate(storm::gspn::GSPN const &gspn)
static void toStream(storm::gspn::GSPN const &gspn, std::ostream &os)
This class provides methods to store and retrieve data for a place in a gspn.
Definition Place.h:12
uint64_t getID() const
Returns the id of this place.
Definition Place.cpp:18
This class represents a transition in a gspn.
Definition Transition.h:14
uint64_t getID() const
Definition Transition.h:171
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
LabParser.cpp.
Definition cli.cpp:18
nlohmann::basic_json< std::map, std::vector, std::string, bool, int64_t, uint64_t, ValueType > json
Definition JsonForward.h:10