diff --git a/src/parser/NonDeterministicSparseTransitionParser.cpp b/src/parser/NonDeterministicSparseTransitionParser.cpp index c0029834d..e632b3dd9 100644 --- a/src/parser/NonDeterministicSparseTransitionParser.cpp +++ b/src/parser/NonDeterministicSparseTransitionParser.cpp @@ -209,6 +209,11 @@ NonDeterministicSparseTransitionParser::NonDeterministicSparseTransitionParser(s } this->matrix->initialize(nonzero); + /* + * Create row mapping. + */ + this->rowMapping = std::shared_ptr(new RowMapping()); + /* * Parse file content. */ @@ -234,11 +239,12 @@ NonDeterministicSparseTransitionParser::NonDeterministicSparseTransitionParser(s /* * Check if we have skipped any source node, i.e. if any node has no * outgoing transitions. If so, insert a self-loop. + * Also add self-loops to rowMapping. */ for (uint_fast64_t node = lastsource + 1; node < source; node++) { hadDeadlocks = true; if (fixDeadlocks) { - // TODO: add (curRow <-> (node,"")) to rowMapping + this->rowMapping->insert( RowMapping::value_type( curRow, std::pair(node, "")) ); this->matrix->addNextValue(curRow, node, 1); curRow++; LOG4CPLUS_WARN(logger, "Warning while parsing " << filename << ": node " << node << " has no outgoing transitions. A self-loop was inserted."); @@ -248,7 +254,10 @@ NonDeterministicSparseTransitionParser::NonDeterministicSparseTransitionParser(s } lastsource = source; - // TODO: add (curRow <-> (node,choice)) to rowMapping + /* + * Add this source-choice pair to rowMapping. + */ + this->rowMapping->insert( RowMapping::value_type( curRow, std::pair(source, choice)) ); /* * Skip name of choice. diff --git a/src/parser/NonDeterministicSparseTransitionParser.h b/src/parser/NonDeterministicSparseTransitionParser.h index 004885a42..5b487d5a2 100644 --- a/src/parser/NonDeterministicSparseTransitionParser.h +++ b/src/parser/NonDeterministicSparseTransitionParser.h @@ -6,6 +6,8 @@ #include "src/parser/Parser.h" #include "src/utility/OsDetection.h" +#include +#include #include #include @@ -20,12 +22,18 @@ class NonDeterministicSparseTransitionParser : public Parser { public: NonDeterministicSparseTransitionParser(std::string const &filename); - std::shared_ptr> getMatrix() { + inline std::shared_ptr> getMatrix() const { return this->matrix; } + + typedef boost::bimap> RowMapping; + inline std::shared_ptr getRowMapping() const { + return this->rowMapping; + } private: std::shared_ptr> matrix; + std::shared_ptr rowMapping; uint_fast64_t firstPass(char* buf, uint_fast64_t& choices, uint_fast64_t& maxnode);