From 062960b94ccdd87cd701f421ae650518c0272a26 Mon Sep 17 00:00:00 2001 From: gereon Date: Fri, 18 Jan 2013 19:52:49 +0100 Subject: [PATCH] Some cleanups, removing memleaks --- src/parser/AutoParser.cpp | 13 ++++++++----- src/parser/AutoParser.h | 2 +- src/parser/DtmcParser.cpp | 2 +- src/utility/Settings.cpp | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/parser/AutoParser.cpp b/src/parser/AutoParser.cpp index f2d161559..6aaab5693 100644 --- a/src/parser/AutoParser.cpp +++ b/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) { diff --git a/src/parser/AutoParser.h b/src/parser/AutoParser.h index d609f10dc..1424cb9b7 100644 --- a/src/parser/AutoParser.h +++ b/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. * diff --git a/src/parser/DtmcParser.cpp b/src/parser/DtmcParser.cpp index b47b982e8..3aee7b46a 100644 --- a/src/parser/DtmcParser.cpp +++ b/src/parser/DtmcParser.cpp @@ -45,7 +45,7 @@ DtmcParser::DtmcParser(std::string const & transitionSystemFile, std::string con transitionRewards = trp.getMatrix(); } - dtmc = std::shared_ptr>(new storm::models::Dtmc(tp.getMatrix(), lp.getLabeling(), stateRewards, transitionRewards)); + this->dtmc = std::shared_ptr>(new storm::models::Dtmc(tp.getMatrix(), lp.getLabeling(), stateRewards, transitionRewards)); } } /* namespace parser */ diff --git a/src/utility/Settings.cpp b/src/utility/Settings.cpp index 0ba962f20..675a9ae8e 100644 --- a/src/utility/Settings.cpp +++ b/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);