Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ModelExportFormat.cpp
Go to the documentation of this file.
1
#include "
ModelExportFormat.h
"
2
3
#include "
storm/exceptions/InvalidArgumentException.h
"
4
#include "
storm/utility/macros.h
"
5
6
namespace
storm
{
7
namespace
io {
8
9
ModelExportFormat
getModelExportFormatFromString
(std::string
const
& input) {
10
if
(input ==
"dot"
) {
11
return
ModelExportFormat::Dot
;
12
}
else
if
(input ==
"drdd"
) {
13
return
ModelExportFormat::Drdd
;
14
}
else
if
(input ==
"drn"
) {
15
return
ModelExportFormat::Drn
;
16
}
else
if
(input ==
"json"
) {
17
return
ModelExportFormat::Json
;
18
}
19
STORM_LOG_THROW
(
false
, storm::exceptions::InvalidArgumentException,
"The model export format '"
<< input <<
"' does not match any known format."
);
20
}
21
22
std::string
toString
(
ModelExportFormat
const
& input) {
23
switch
(input) {
24
case
ModelExportFormat::Dot
:
25
return
"dot"
;
26
case
ModelExportFormat::Drdd
:
27
return
"drdd"
;
28
case
ModelExportFormat::Drn
:
29
return
"drn"
;
30
case
ModelExportFormat::Json
:
31
return
"json"
;
32
}
33
STORM_LOG_THROW
(
false
, storm::exceptions::InvalidArgumentException,
"Unhandled model export format."
);
34
}
35
36
ModelExportFormat
getModelExportFormatFromFileExtension
(std::string
const
& filename) {
37
auto
pos = filename.find_last_of(
'.'
);
38
STORM_LOG_THROW
(pos != std::string::npos, storm::exceptions::InvalidArgumentException,
39
"Couldn't detect a file extension from input filename '"
<< filename <<
"'."
);
40
++pos;
41
return
getModelExportFormatFromString
(filename.substr(pos));
42
}
43
44
}
// namespace io
45
}
// namespace storm
InvalidArgumentException.h
ModelExportFormat.h
macros.h
STORM_LOG_THROW
#define STORM_LOG_THROW(cond, exception, message)
Definition
macros.h:30
storm::io::ModelExportFormat
ModelExportFormat
Definition
ModelExportFormat.h:8
storm::io::ModelExportFormat::Drdd
@ Drdd
storm::io::ModelExportFormat::Drn
@ Drn
storm::io::ModelExportFormat::Dot
@ Dot
storm::io::ModelExportFormat::Json
@ Json
storm::io::toString
std::string toString(ModelExportFormat const &input)
Definition
ModelExportFormat.cpp:22
storm::io::getModelExportFormatFromString
ModelExportFormat getModelExportFormatFromString(std::string const &input)
Definition
ModelExportFormat.cpp:9
storm::io::getModelExportFormatFromFileExtension
ModelExportFormat getModelExportFormatFromFileExtension(std::string const &filename)
Definition
ModelExportFormat.cpp:36
storm
LabParser.cpp.
Definition
cli.cpp:18
src
storm
io
ModelExportFormat.cpp
Generated by
1.9.8