From 8b1e003657340605de1dd4e4cac19de7ac840e5d Mon Sep 17 00:00:00 2001 From: sjunges Date: Wed, 29 Jul 2015 12:08:01 +0200 Subject: [PATCH] Fix Former-commit-id: 882bfd73ce3407f7d28420d94a8a226987da3e9d --- src/utility/cli.cpp | 40 ++++++++++++++++++++++++++++++++++++ src/utility/cli.h | 50 ++++++++------------------------------------- 2 files changed, 48 insertions(+), 42 deletions(-) diff --git a/src/utility/cli.cpp b/src/utility/cli.cpp index 99f425a8d..50c15e627 100644 --- a/src/utility/cli.cpp +++ b/src/utility/cli.cpp @@ -156,6 +156,46 @@ namespace storm { std::cout << "\tUser Time: " << std::setprecision(5) << userTime << "ms" << std::endl; #endif } + + bool parseOptions(const int argc, const char* argv[]) { + storm::settings::SettingsManager& manager = storm::settings::mutableManager(); + try { + manager.setFromCommandLine(argc, argv); + } catch (storm::exceptions::OptionParserException& e) { + manager.printHelp(); + throw e; + return false; + } + + if (storm::settings::generalSettings().isHelpSet()) { + storm::settings::manager().printHelp(storm::settings::generalSettings().getHelpModuleName()); + return false; + } + + if (storm::settings::generalSettings().isVersionSet()) { + storm::settings::manager().printVersion(); + return false; + } + + if (storm::settings::generalSettings().isVerboseSet()) { + logger.getAppender("mainConsoleAppender")->setThreshold(log4cplus::INFO_LOG_LEVEL); + LOG4CPLUS_INFO(logger, "Enabled verbose mode, log output gets printed to console."); + } + if (storm::settings::debugSettings().isDebugSet()) { + logger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL); + logger.getAppender("mainConsoleAppender")->setThreshold(log4cplus::DEBUG_LOG_LEVEL); + LOG4CPLUS_INFO(logger, "Enabled very verbose mode, log output gets printed to console."); + } + if (storm::settings::debugSettings().isTraceSet()) { + logger.setLogLevel(log4cplus::TRACE_LOG_LEVEL); + logger.getAppender("mainConsoleAppender")->setThreshold(log4cplus::TRACE_LOG_LEVEL); + LOG4CPLUS_INFO(logger, "Enabled trace mode, log output gets printed to console."); + } + if (storm::settings::debugSettings().isLogfileSet()) { + initializeFileLogging(); + } + return true; + } } } diff --git a/src/utility/cli.h b/src/utility/cli.h index de6db5768..5b924ea78 100644 --- a/src/utility/cli.h +++ b/src/utility/cli.h @@ -67,7 +67,11 @@ namespace storm { + std::string getCurrentWorkingDirectory(); + void printHeader(const int argc, const char* argv[]); + + void printUsage(); /*! * Parses the given command line arguments. @@ -76,45 +80,7 @@ namespace storm { * @param argv The argv argument of main(). * @return True iff the program should continue to run after parsing the options. */ - bool parseOptions(const int argc, const char* argv[]) { - storm::settings::SettingsManager& manager = storm::settings::mutableManager(); - try { - manager.setFromCommandLine(argc, argv); - } catch (storm::exceptions::OptionParserException& e) { - manager.printHelp(); - throw e; - return false; - } - - if (storm::settings::generalSettings().isHelpSet()) { - storm::settings::manager().printHelp(storm::settings::generalSettings().getHelpModuleName()); - return false; - } - - if (storm::settings::generalSettings().isVersionSet()) { - storm::settings::manager().printVersion(); - return false; - } - - if (storm::settings::generalSettings().isVerboseSet()) { - logger.getAppender("mainConsoleAppender")->setThreshold(log4cplus::INFO_LOG_LEVEL); - LOG4CPLUS_INFO(logger, "Enabled verbose mode, log output gets printed to console."); - } - if (storm::settings::debugSettings().isDebugSet()) { - logger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL); - logger.getAppender("mainConsoleAppender")->setThreshold(log4cplus::DEBUG_LOG_LEVEL); - LOG4CPLUS_INFO(logger, "Enabled very verbose mode, log output gets printed to console."); - } - if (storm::settings::debugSettings().isTraceSet()) { - logger.setLogLevel(log4cplus::TRACE_LOG_LEVEL); - logger.getAppender("mainConsoleAppender")->setThreshold(log4cplus::TRACE_LOG_LEVEL); - LOG4CPLUS_INFO(logger, "Enabled trace mode, log output gets printed to console."); - } - if (storm::settings::debugSettings().isLogfileSet()) { - initializeFileLogging(); - } - return true; - } + bool parseOptions(const int argc, const char* argv[]); template std::shared_ptr> buildExplicitModel(std::string const& transitionsFile, std::string const& labelingFile, boost::optional const& stateRewardsFile = boost::optional(), boost::optional const& transitionRewardsFile = boost::optional()) { @@ -224,7 +190,7 @@ namespace storm { #ifdef STORM_HAVE_CARL template<> - void generateCounterexample(storm::prism::Program const& program, std::shared_ptr> model, std::shared_ptr formula) { + inline void generateCounterexample(storm::prism::Program const& program, std::shared_ptr> model, std::shared_ptr formula) { STORM_LOG_THROW(false, storm::exceptions::InvalidSettingsException, "Unable to generate counterexample for parametric model."); } #endif @@ -286,7 +252,7 @@ namespace storm { #ifdef STORM_HAVE_CARL template<> - void verifySparseModel(boost::optional const& program, std::shared_ptr> model, std::shared_ptr formula) { + inline void verifySparseModel(boost::optional const& program, std::shared_ptr> model, std::shared_ptr formula) { storm::settings::modules::GeneralSettings const& settings = storm::settings::generalSettings(); STORM_LOG_THROW(model->getType() == storm::models::ModelType::Dtmc, storm::exceptions::InvalidSettingsException, "Currently parametric verification is only available for DTMCs."); @@ -402,7 +368,7 @@ namespace storm { } } - void processOptions() { + inline void processOptions() { if (storm::settings::debugSettings().isLogfileSet()) { initializeFileLogging(); }