diff --git a/src/mrmc.cpp b/src/mrmc.cpp index 9bb62172a..6659b8e13 100644 --- a/src/mrmc.cpp +++ b/src/mrmc.cpp @@ -25,7 +25,7 @@ #include "src/modelChecker/EigenDtmcPrctlModelChecker.h" #include "src/modelChecker/GmmxxDtmcPrctlModelChecker.h" #include "src/parser/LabParser.h" -#include "src/parser/TraParser.h" +#include "src/parser/DeterministicSparseTransitionParser.h" #include "src/parser/PrctlParser.h" #include "src/solver/GraphAnalyzer.h" #include "src/utility/Settings.h" @@ -101,7 +101,7 @@ int main(const int argc, const char* argv[]) { LOG4CPLUS_INFO(logger, "Enable verbose mode, log output gets printed to console."); } - mrmc::parser::TraParser traparser(s->getString("trafile").c_str()); + mrmc::parser::DeterministicSparseTransitionParser traparser(s->getString("trafile").c_str()); mrmc::parser::LabParser labparser(traparser.getMatrix()->getRowCount(), s->getString("labfile").c_str()); mrmc::models::Dtmc dtmc(traparser.getMatrix(), labparser.getLabeling()); diff --git a/src/parser/TraParser.cpp b/src/parser/DeterministicSparseTransitionParser.cpp similarity index 95% rename from src/parser/TraParser.cpp rename to src/parser/DeterministicSparseTransitionParser.cpp index 7f38187d7..636d43655 100644 --- a/src/parser/TraParser.cpp +++ b/src/parser/DeterministicSparseTransitionParser.cpp @@ -5,7 +5,7 @@ * Author: Gereon Kremer */ -#include "src/parser/TraParser.h" +#include "src/parser/DeterministicSparseTransitionParser.h" #include "src/exceptions/FileIoException.h" #include "src/exceptions/WrongFileFormatException.h" #include "boost/integer/integer_mask.hpp" @@ -42,7 +42,7 @@ namespace parser{ * @param buf Data to scan. Is expected to be some char array. * @param maxnode Is set to highest id of all nodes. */ -uint_fast64_t TraParser::firstPass(char* buf, uint_fast64_t &maxnode) { +uint_fast64_t DeterministicSparseTransitionParser::firstPass(char* buf, uint_fast64_t &maxnode) { uint_fast64_t non_zero = 0; /* @@ -106,7 +106,7 @@ uint_fast64_t TraParser::firstPass(char* buf, uint_fast64_t &maxnode) { * @return a pointer to the created sparse matrix. */ -TraParser::TraParser(const char * filename) +DeterministicSparseTransitionParser::DeterministicSparseTransitionParser(const char * filename) : matrix(nullptr) { /* diff --git a/src/parser/TraParser.h b/src/parser/DeterministicSparseTransitionParser.h similarity index 73% rename from src/parser/TraParser.h rename to src/parser/DeterministicSparseTransitionParser.h index a7079ea66..561f9aa50 100644 --- a/src/parser/TraParser.h +++ b/src/parser/DeterministicSparseTransitionParser.h @@ -12,15 +12,15 @@ namespace mrmc { namespace parser { /*! - * @brief Load transition system from file and return initialized - * StaticSparseMatrix object. + * @brief Load a deterministic transition system from file and create a + * sparse adjacency matrix whose entries represent the weights of the edges * * Note that this class creates a new StaticSparseMatrix object that can be * accessed via getMatrix(). However, it does not delete this object! */ -class TraParser : Parser { +class DeterministicSparseTransitionParser : Parser { public: - TraParser(const char* filename); + DeterministicSparseTransitionParser(const char* filename); std::shared_ptr> getMatrix() { return this->matrix; diff --git a/src/utility/IoUtility.cpp b/src/utility/IoUtility.cpp index 299527044..73f0f7d17 100644 --- a/src/utility/IoUtility.cpp +++ b/src/utility/IoUtility.cpp @@ -6,7 +6,7 @@ */ #include "src/utility/IoUtility.h" -#include "src/parser/TraParser.h" +#include "src/parser/DeterministicSparseTransitionParser.h" #include "src/parser/LabParser.h" #include @@ -61,7 +61,7 @@ void dtmcToDot(mrmc::models::Dtmc* dtmc, std::string filename) { //TODO: Should this stay here or be integrated in the new parser structure? mrmc::models::Dtmc* parseDTMC(const char* tra_file, const char* lab_file) { - mrmc::parser::TraParser tp(tra_file); + mrmc::parser::DeterministicSparseTransitionParser tp(tra_file); uint_fast64_t node_count = tp.getMatrix()->getRowCount(); mrmc::parser::LabParser lp(node_count, lab_file); diff --git a/test/parser/ReadTraFileTest.cpp b/test/parser/ReadTraFileTest.cpp index 99c374a6b..9f4793dc0 100644 --- a/test/parser/ReadTraFileTest.cpp +++ b/test/parser/ReadTraFileTest.cpp @@ -8,7 +8,7 @@ #include "gtest/gtest.h" #include "mrmc-config.h" #include "src/storage/SquareSparseMatrix.h" -#include "src/parser/TraParser.h" +#include "src/parser/DeterministicSparseTransitionParser.h" #include "src/exceptions/FileIoException.h" #include "src/exceptions/WrongFileFormatException.h" @@ -16,14 +16,14 @@ TEST(ReadTraFileTest, NonExistingFileTest) { //No matter what happens, please don't create a file with the name "nonExistingFile.not"! :-) - ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::FileIoException); + ASSERT_THROW(mrmc::parser::DeterministicSparseTransitionParser(MRMC_CPP_TESTS_BASE_PATH "/nonExistingFile.not"), mrmc::exceptions::FileIoException); } /* The following test case is based on one of the original MRMC test cases */ TEST(ReadTraFileTest, ParseFileTest1) { - mrmc::parser::TraParser* parser; - ASSERT_NO_THROW(parser = new mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/csl_general_input_01.tra")); + mrmc::parser::DeterministicSparseTransitionParser* parser; + ASSERT_NO_THROW(parser = new mrmc::parser::DeterministicSparseTransitionParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/csl_general_input_01.tra")); std::shared_ptr> result = parser->getMatrix(); if (result != NULL) { @@ -69,13 +69,13 @@ TEST(ReadTraFileTest, ParseFileTest1) { } TEST(ReadTraFileTest, WrongFormatTestHeader1) { - ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header1.tra"), mrmc::exceptions::WrongFileFormatException); + ASSERT_THROW(mrmc::parser::DeterministicSparseTransitionParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header1.tra"), mrmc::exceptions::WrongFileFormatException); } TEST(ReadTraFileTest, WrongFormatTestHeader2) { - ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header2.tra"), mrmc::exceptions::WrongFileFormatException); + ASSERT_THROW(mrmc::parser::DeterministicSparseTransitionParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_header2.tra"), mrmc::exceptions::WrongFileFormatException); } TEST(ReadTraFileTest, WrongFormatTestTransition) { - ASSERT_THROW(mrmc::parser::TraParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_transition.tra"), mrmc::exceptions::WrongFileFormatException); + ASSERT_THROW(mrmc::parser::DeterministicSparseTransitionParser(MRMC_CPP_TESTS_BASE_PATH "/parser/tra_files/wrong_format_transition.tra"), mrmc::exceptions::WrongFileFormatException); }