21 char const* buf = file.
getData();
25 bool foundDecl =
false, foundEnd =
false;
29 while (buf[0] !=
'\0') {
40 if (strncmp(buf,
"#DECLARATION", cnt) == 0) {
43 }
else if (strncmp(buf,
"#END", cnt) == 0) {
51 if (!(foundDecl && foundEnd)) {
52 STORM_LOG_ERROR(
"Error while parsing " << filename <<
": File header is corrupted (#DECLARATION or #END missing - case sensitive).");
57 throw storm::exceptions::WrongFormatException()
58 <<
"Error while parsing " << filename <<
": File header is corrupted (#DECLARATION or #END missing - case sensitive).";
69 char proposition[128];
74 while (buf[0] !=
'\0') {
82 if (cnt >=
sizeof(proposition)) {
84 STORM_LOG_ERROR(
"Error while parsing " << filename <<
": Atomic proposition with length > " << (
sizeof(proposition) - 1) <<
" was found.");
85 throw storm::exceptions::WrongFormatException()
86 <<
"Error while parsing " << filename <<
": Atomic proposition with length > " << (
sizeof(proposition) - 1) <<
" was found.";
90 if (strncmp(buf,
"#DECLARATION", cnt) == 0)
94 if (strncmp(buf,
"#END", cnt) == 0)
98 strncpy(proposition, buf, cnt);
99 proposition[cnt] =
'\0';
111 uint_fast64_t state = 0;
112 uint_fast64_t lastState = (uint_fast64_t)-1;
113 uint_fast64_t
const startIndexComparison = lastState;
117 while (buf[0] !=
'\0') {
123 if (state <= lastState && lastState != startIndexComparison) {
124 STORM_LOG_ERROR(
"Error while parsing " << filename <<
": State " << state <<
" was found but has already been read or skipped previously.");
125 throw storm::exceptions::WrongFormatException()
126 <<
"Error while parsing " << filename <<
": State " << state <<
" was found but has already been read or skipped previously.";
129 while ((buf[0] !=
'\r') && (buf[0] !=
'\n') && (buf[0] !=
'\0')) {
135 if (buf[0] ==
'\n' || buf[0] ==
'\r')
140 strncpy(proposition, buf, cnt);
141 proposition[cnt] =
'\0';
145 STORM_LOG_ERROR(
"Error while parsing " << filename <<
": Atomic proposition" << proposition <<
" was found but not declared.");
146 throw storm::exceptions::WrongFormatException()
147 <<
"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.