Browse Source

Changed name of class "Labelling" to "Labeling".

tempestpy_adaptions
Thomas Heinemann 12 years ago
committed by Lanchid
parent
commit
765689c40a
  1. 4
      src/dtmc/atomic_proposition.h
  2. 29
      src/dtmc/labeling.h
  3. 2
      src/mrmc-cpp.cpp
  4. 6
      src/parser/read_lab_file.cpp
  5. 4
      src/parser/read_lab_file.h
  6. 6
      test/parser/read_lab_file_test.cpp

4
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));
}
}

29
src/dtmc/labelling.h → 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 <map>
#define MAP std::map
#else
#include "boost/unordered_map.hpp"
#define MAP boost::unordered_map
#endif
#include <stdexcept>
@ -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<std::string, AtomicProposition*>::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<std::string, AtomicProposition*> proposition_map;
//AtomicProposition** propositions;
//boost::unordered_map<std::string, AtomicProposition*> proposition_map;
};
@ -91,4 +96,4 @@ class labelling {
} //namespace mrmc
#endif /* MRMC_DTMC_LABELLING_H_ */
#endif /* MRMC_DTMC_LABELING_H_ */

2
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();

6
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)) {

4
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);
}
}

6
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"));

Loading…
Cancel
Save