28 char const* buf = file.
getData();
32 bool foundDecl =
false, foundEnd =
false;
36 while (buf[0] !=
'\0') {
47 if (strncmp(buf,
"#DECLARATION", cnt) == 0) {
50 }
else if (strncmp(buf,
"#END", cnt) == 0) {
58 if (!(foundDecl && foundEnd)) {
59 STORM_LOG_ERROR(
"Error while parsing " << filename <<
": File header is corrupted (#DECLARATION or #END missing - case sensitive).");
64 throw storm::exceptions::WrongFormatException()
65 <<
"Error while parsing " << filename <<
": File header is corrupted (#DECLARATION or #END missing - case sensitive).";
76 char proposition[128];
81 while (buf[0] !=
'\0') {
89 if (cnt >=
sizeof(proposition)) {
91 STORM_LOG_ERROR(
"Error while parsing " << filename <<
": Atomic proposition with length > " << (
sizeof(proposition) - 1) <<
" was found.");
92 throw storm::exceptions::WrongFormatException()
93 <<
"Error while parsing " << filename <<
": Atomic proposition with length > " << (
sizeof(proposition) - 1) <<
" was found.";
97 if (strncmp(buf,
"#DECLARATION", cnt) == 0)
101 if (strncmp(buf,
"#END", cnt) == 0)
105 strncpy(proposition, buf, cnt);
106 proposition[cnt] =
'\0';
118 uint_fast64_t state = 0;
119 uint_fast64_t lastState = (uint_fast64_t)-1;
120 uint_fast64_t
const startIndexComparison = lastState;
124 while (buf[0] !=
'\0') {
130 if (state <= lastState && lastState != startIndexComparison) {
131 STORM_LOG_ERROR(
"Error while parsing " << filename <<
": State " << state <<
" was found but has already been read or skipped previously.");
132 throw storm::exceptions::WrongFormatException()
133 <<
"Error while parsing " << filename <<
": State " << state <<
" was found but has already been read or skipped previously.";
136 while ((buf[0] !=
'\r') && (buf[0] !=
'\n') && (buf[0] !=
'\0')) {
142 if (buf[0] ==
'\n' || buf[0] ==
'\r')
147 strncpy(proposition, buf, cnt);
148 proposition[cnt] =
'\0';
152 STORM_LOG_ERROR(
"Error while parsing " << filename <<
": Atomic proposition" << proposition <<
" was found but not declared.");
153 throw storm::exceptions::WrongFormatException()
154 <<
"Error while parsing " << filename <<
": Atomic proposition" << proposition <<
" was found but not declared.";
void addLabel(std::string const &label)
Adds a new label to the labelings.
bool containsLabel(std::string const &label) const
Checks whether a label is registered within this labeling.
This class manages the labeling of the state space with a number of (atomic) labels.
void addLabelToState(std::string const &label, storm::storage::sparse::state_type state)
Adds a label to a given state.
static storm::models::sparse::StateLabeling parseAtomicPropositionLabeling(uint_fast64_t stateCount, std::string const &filename)
Reads a label file and puts the result in an AtomicPropositionsLabeling object.
Opens a file and maps it to memory providing a char* containing the file content.
char const * getData() const
Returns a pointer to the beginning of the mapped file data.
#define STORM_LOG_ERROR(message)
char const * skipWord(char const *buf)
Skips all numbers, letters and special characters.
uint_fast64_t checked_strtol(char const *str, char const **end)
Calls strtol() internally and checks if the new pointer is different from the original one,...
char const * trimWhitespaces(char const *buf)
Skips spaces, tabs, newlines and carriage returns.