8 changed files with 96 additions and 5 deletions
-
9src/storm-gspn/settings/modules/GSPNExportSettings.cpp
-
8src/storm-gspn/settings/modules/GSPNExportSettings.h
-
8src/storm-gspn/storage/gspn/GSPN.cpp
-
7src/storm-gspn/storage/gspn/GSPN.h
-
24src/storm-gspn/storage/gspn/GspnJsonExporter.cpp
-
32src/storm-gspn/storage/gspn/GspnJsonExporter.h
-
7src/storm-gspn/storm-gspn.h
@ -0,0 +1,24 @@ |
|||||
|
#include "GspnJsonExporter.h"
|
||||
|
|
||||
|
#include "storm/exceptions/NotImplementedException.h"
|
||||
|
#include "storm/exceptions/FileIoException.h"
|
||||
|
|
||||
|
#include <algorithm>
|
||||
|
#include <string>
|
||||
|
|
||||
|
namespace storm { |
||||
|
namespace gspn { |
||||
|
|
||||
|
size_t GspnJsonExporter::currentId = 0; |
||||
|
|
||||
|
void GspnJsonExporter::toStream(storm::gspn::GSPN const& gspn, std::ostream& os) { |
||||
|
os << translate(gspn).dump(4) << std::endl; |
||||
|
} |
||||
|
|
||||
|
modernjson::json GspnJsonExporter::translate(storm::gspn::GSPN const& gspn) { |
||||
|
modernjson::json jsonGspn; |
||||
|
currentId = 0; |
||||
|
return jsonGspn; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include "storm/utility/macros.h" |
||||
|
|
||||
|
#include "storm-gspn/storage/gspn/GSPN.h" |
||||
|
|
||||
|
// JSON parser |
||||
|
#include "json.hpp" |
||||
|
namespace modernjson { |
||||
|
using json = nlohmann::basic_json<std::map, std::vector, std::string, bool, int64_t, uint64_t, double, std::allocator>; |
||||
|
} |
||||
|
|
||||
|
namespace storm { |
||||
|
namespace gspn { |
||||
|
|
||||
|
/** |
||||
|
* Exports a GSPN into the JSON format for visualizing it. |
||||
|
*/ |
||||
|
class GspnJsonExporter { |
||||
|
|
||||
|
public: |
||||
|
static void toStream(storm::gspn::GSPN const& gspn, std::ostream& os); |
||||
|
|
||||
|
static modernjson::json translate(storm::gspn::GSPN const& gspn); |
||||
|
|
||||
|
private: |
||||
|
static size_t currentId; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue