Browse Source

Some cleanups, removing memleaks

tempestpy_adaptions
gereon 12 years ago
parent
commit
062960b94c
  1. 13
      src/parser/AutoParser.cpp
  2. 2
      src/parser/AutoParser.h
  3. 2
      src/parser/DtmcParser.cpp
  4. 2
      src/utility/Settings.cpp

13
src/parser/AutoParser.cpp

@ -27,15 +27,15 @@ AutoParser::AutoParser(std::string const & transitionSystemFile, std::string con
// Do actual parsing
switch (type) {
case storm::models::DTMC: {
DtmcParser* parser = new DtmcParser(transitionSystemFile, labelingFile, stateRewardFile, transitionRewardFile);
this->model = parser->getDtmc();
DtmcParser parser(transitionSystemFile, labelingFile, stateRewardFile, transitionRewardFile);
this->model = parser.getDtmc();
break;
}
case storm::models::CTMC:
break;
case storm::models::MDP: {
MdpParser* parser = new MdpParser(transitionSystemFile, labelingFile, stateRewardFile, transitionRewardFile);
this->model = parser->getMdp();
MdpParser parser(transitionSystemFile, labelingFile, stateRewardFile, transitionRewardFile);
this->model = parser.getMdp();
break;
}
case storm::models::CTMDP:
@ -43,7 +43,10 @@ AutoParser::AutoParser(std::string const & transitionSystemFile, std::string con
default: ; // Unknown
}
if (!this->model) std::cout << "model is still null" << std::endl;
if (!this->model) {
LOG4CPLUS_WARN(logger, "Model is still null.");
}
}
storm::models::ModelType AutoParser::analyzeHint(const std::string& filename) {

2
src/parser/AutoParser.h

@ -14,7 +14,7 @@ namespace parser {
/*!
* @brief Checks the given files and parses the model within these files.
*
* This parser analyzes the format hitn in the first line of the transition
* This parser analyzes the format hint in the first line of the transition
* file. If this is a valid format, it will use the parser for this format,
* otherwise it will throw an exception.
*

2
src/parser/DtmcParser.cpp

@ -45,7 +45,7 @@ DtmcParser::DtmcParser(std::string const & transitionSystemFile, std::string con
transitionRewards = trp.getMatrix();
}
dtmc = std::shared_ptr<storm::models::Dtmc<double>>(new storm::models::Dtmc<double>(tp.getMatrix(), lp.getLabeling(), stateRewards, transitionRewards));
this->dtmc = std::shared_ptr<storm::models::Dtmc<double>>(new storm::models::Dtmc<double>(tp.getMatrix(), lp.getLabeling(), stateRewards, transitionRewards));
}
} /* namespace parser */

2
src/utility/Settings.cpp

@ -51,7 +51,7 @@ Settings::Settings(int const argc, char const * const argv[], char const * const
try {
// Initially fill description objects.
this->initDescriptions();
// Take care of positional arguments.
Settings::positional.add("trafile", 1);
Settings::positional.add("labfile", 1);

Loading…
Cancel
Save