Lanchid
12 years ago
15 changed files with 136 additions and 68 deletions
-
2src/models/Dtmc.h
-
13src/mrmc.cpp
-
9src/parser/AtomicPropositionLabelingParser.cpp
-
4src/parser/AtomicPropositionLabelingParser.h
-
26src/parser/DeterministicSparseTransitionParser.cpp
-
8src/parser/DeterministicSparseTransitionParser.h
-
33src/parser/DtmcParser.cpp
-
39src/parser/DtmcParser.h
-
5src/parser/Parser.cpp
-
2src/parser/Parser.h
-
22src/utility/IoUtility.cpp
-
4src/utility/IoUtility.h
-
9test/parser/ParseDtmcTest.cpp
-
14test/parser/ReadLabFileTest.cpp
-
14test/parser/ReadTraFileTest.cpp
@ -0,0 +1,33 @@ |
|||||
|
/*
|
||||
|
* DtmcParser.cpp |
||||
|
* |
||||
|
* Created on: 19.12.2012 |
||||
|
* Author: thomas |
||||
|
*/ |
||||
|
|
||||
|
#include "DtmcParser.h"
|
||||
|
#include "DeterministicSparseTransitionParser.h"
|
||||
|
#include "AtomicPropositionLabelingParser.h"
|
||||
|
|
||||
|
namespace mrmc { |
||||
|
namespace parser { |
||||
|
|
||||
|
/*!
|
||||
|
* Parses a transition file and a labeling file and produces a DTMC out of them; a pointer to the dtmc |
||||
|
* is saved in the field "dtmc" |
||||
|
* Note that the labeling file may have at most as many nodes as the transition file! |
||||
|
* |
||||
|
* @param transitionSystemFile String containing the location of the transition file (....tra) |
||||
|
* @param labelingFile String containing the location of the labeling file (....lab) |
||||
|
*/ |
||||
|
DtmcParser::DtmcParser(std::string const & transitionSystemFile, std::string const & labelingFile) { |
||||
|
mrmc::parser::DeterministicSparseTransitionParser tp(transitionSystemFile); |
||||
|
uint_fast64_t nodeCount = tp.getMatrix()->getRowCount(); |
||||
|
|
||||
|
mrmc::parser::AtomicPropositionLabelingParser lp(nodeCount, labelingFile); |
||||
|
|
||||
|
dtmc = std::shared_ptr<mrmc::models::Dtmc<double> >(new mrmc::models::Dtmc<double>(tp.getMatrix(), lp.getLabeling())); |
||||
|
} |
||||
|
|
||||
|
} /* namespace parser */ |
||||
|
} /* namespace mrmc */ |
@ -0,0 +1,39 @@ |
|||||
|
/* |
||||
|
* DtmcParser.h |
||||
|
* |
||||
|
* Created on: 19.12.2012 |
||||
|
* Author: thomas |
||||
|
*/ |
||||
|
|
||||
|
#ifndef DTMCPARSER_H_ |
||||
|
#define DTMCPARSER_H_ |
||||
|
|
||||
|
#include "Parser.h" |
||||
|
#include "models/Dtmc.h" |
||||
|
|
||||
|
namespace mrmc { |
||||
|
namespace parser { |
||||
|
|
||||
|
/*! |
||||
|
* @brief Load label and transition file and return initialized dtmc object |
||||
|
* |
||||
|
* @Note This class creates a new Dtmc object that can |
||||
|
* be accessed via getDtmc(). However, it will not delete this object! |
||||
|
* |
||||
|
* @Note The labeling representation in the file may use at most as much nodes as are specified in the dtmc. |
||||
|
*/ |
||||
|
class DtmcParser: public mrmc::parser::Parser { |
||||
|
public: |
||||
|
DtmcParser(std::string const & transitionSystemFile, std::string const & labelingFile); |
||||
|
|
||||
|
std::shared_ptr<mrmc::models::Dtmc<double>> getDtmc() { |
||||
|
return this->dtmc; |
||||
|
} |
||||
|
|
||||
|
private: |
||||
|
std::shared_ptr<mrmc::models::Dtmc<double>> dtmc; |
||||
|
}; |
||||
|
|
||||
|
} /* namespace parser */ |
||||
|
} /* namespace mrmc */ |
||||
|
#endif /* DTMCPARSER_H_ */ |
Write
Preview
Loading…
Cancel
Save
Reference in new issue