diff --git a/src/dtmc/atomic_proposition.h b/src/dtmc/atomic_proposition.h index 3af284cc9..7b8e75690 100644 --- a/src/dtmc/atomic_proposition.h +++ b/src/dtmc/atomic_proposition.h @@ -54,9 +54,7 @@ class AtomicProposition { int n = (int) std::ceil(nodeCount / 64.0); node_array = new uint_fast64_t[n]; //Initialization with 0 is crucial! - for (int i = 0; i < n; i++) { - node_array[i] = 0L; - } + memset(node_array, 0, n*sizeof(uint_fast64_t)); } } diff --git a/src/dtmc/labelling.h b/src/dtmc/labeling.h similarity index 82% rename from src/dtmc/labelling.h rename to src/dtmc/labeling.h index ee3ce4199..f236bfaa4 100644 --- a/src/dtmc/labelling.h +++ b/src/dtmc/labeling.h @@ -5,19 +5,23 @@ * Author: Thomas Heinemann */ -#ifndef MRMC_DTMC_LABELLING_H_ -#define MRMC_DTMC_LABELLING_H_ +#ifndef MRMC_DTMC_LABELING_H_ +#define MRMC_DTMC_LABELING_H_ #include "atomic_proposition.h" -#define UNORDERED_MAP -#ifdef UNORDERED_MAP -#include "boost/unordered_map.hpp" -#define MAP boost::unordered_map -#else + +/* Map types: By default, the boost hash map is used. + * When the macro DEFAULT_MAP is defined, the default C++ class (std::map) + * is used instead. + */ +#ifdef DEFAULT_MAP #include #define MAP std::map +#else +#include "boost/unordered_map.hpp" +#define MAP boost::unordered_map #endif #include @@ -27,16 +31,16 @@ namespace mrmc { namespace dtmc { -class labelling { +class labeling { public: - labelling(const uint_fast32_t p_nodes) { + labeling(const uint_fast32_t p_nodes) { nodes = p_nodes; } - virtual ~labelling() { - //deleting all the labelling vectors in the map. + virtual ~labeling() { + //deleting all the labeling vectors in the map. MAP::iterator it; for (it = proposition_map.begin(); it != proposition_map.end(); ++it) { if (it->second != NULL) { @@ -84,6 +88,7 @@ class labelling { private: uint_fast32_t nodes; MAP proposition_map; + //AtomicProposition** propositions; //boost::unordered_map proposition_map; }; @@ -91,4 +96,4 @@ class labelling { } //namespace mrmc -#endif /* MRMC_DTMC_LABELLING_H_ */ +#endif /* MRMC_DTMC_LABELING_H_ */ diff --git a/src/mrmc-cpp.cpp b/src/mrmc-cpp.cpp index 5b9bd59ef..666723a18 100644 --- a/src/mrmc-cpp.cpp +++ b/src/mrmc-cpp.cpp @@ -32,7 +32,7 @@ int main(int argc, char* argv[]) { pantheios_be_file_setFilePath("log.all"); pantheios::log_INFORMATIONAL("MRMC-Cpp started."); - mrmc::dtmc::labelling *lab; + mrmc::dtmc::labeling *lab; time_t start = std::clock(); diff --git a/src/parser/read_lab_file.cpp b/src/parser/read_lab_file.cpp index 27da49622..3a8c7244d 100644 --- a/src/parser/read_lab_file.cpp +++ b/src/parser/read_lab_file.cpp @@ -9,8 +9,6 @@ #include "read_lab_file.h" -#include "src/dtmc/labelling.h" - #include "src/exceptions/wrong_file_format.h" #include "src/exceptions/file_IO_exception.h" @@ -30,7 +28,7 @@ namespace parser { * @param filename input .lab file's name. * @return returns a pointer to a labelling object. */ -mrmc::dtmc::labelling * read_lab_file(int node_count, const char * filename) +mrmc::dtmc::labeling * read_lab_file(int node_count, const char * filename) { /* Note that this function uses strtok_r on char-array s. * This function will modify this string. @@ -57,7 +55,7 @@ mrmc::dtmc::labelling * read_lab_file(int node_count, const char * filename) } - mrmc::dtmc::labelling* result = new mrmc::dtmc::labelling(node_count); + mrmc::dtmc::labeling* result = new mrmc::dtmc::labeling(node_count); //Here, all propositions are to be declared... if (fgets(s, BUFFER_SIZE, P)) { diff --git a/src/parser/read_lab_file.h b/src/parser/read_lab_file.h index f4a2d0077..f51595af4 100644 --- a/src/parser/read_lab_file.h +++ b/src/parser/read_lab_file.h @@ -8,14 +8,14 @@ #ifndef READ_LAB_FILE_H_ #define READ_LAB_FILE_H_ -#include "src/dtmc/labelling.h" +#include "src/dtmc/labeling.h" namespace mrmc { namespace parser { -mrmc::dtmc::labelling * read_lab_file(int node_count, const char * filename); +mrmc::dtmc::labeling * read_lab_file(int node_count, const char * filename); } } diff --git a/test/parser/read_lab_file_test.cpp b/test/parser/read_lab_file_test.cpp index 2702ddf3f..bee571f4a 100644 --- a/test/parser/read_lab_file_test.cpp +++ b/test/parser/read_lab_file_test.cpp @@ -6,7 +6,7 @@ */ #include "gtest/gtest.h" -#include "src/dtmc/labelling.h" +#include "src/dtmc/labeling.h" #include "src/parser/read_lab_file.h" #include "src/exceptions/file_IO_exception.h" #include "src/exceptions/wrong_file_format.h" @@ -17,8 +17,8 @@ TEST(ReadLabFileTest, NonExistingFileTest) { } TEST(ReadLabFileTest, ParseTest) { - //This test is based on a testcase from the original MRMC. - mrmc::dtmc::labelling* labelling; + //This test is based on a test case from the original MRMC. + mrmc::dtmc::labeling* labelling; //Parsing the file ASSERT_NO_THROW(labelling = mrmc::parser::read_lab_file(12,"test/parser/lab_files/pctl_general_input_01.lab"));