Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
cli.cpp
Go to the documentation of this file.
1#include "cli.h"
2
6#include "storm/io/file.h"
15
17
18namespace storm {
19namespace cli {
20
21bool parseOptions(const int argc, const char* argv[]) {
22 try {
24 } catch (storm::exceptions::OptionParserException& e) {
25 STORM_LOG_ERROR("Unable to parse command line options. Type '" + std::string(argv[0]) + " --help' or '" + std::string(argv[0]) +
26 " --help all' for help.");
27 return false;
28 }
29
31
32 bool result = true;
33 if (general.isHelpSet()) {
35 result = false;
36 }
37
38 if (general.isVersionSet()) {
40 result = false;
41 }
42
43 return result;
44}
45
48
49 // If we were given a time limit, we put it in place now.
50 if (resources.isTimeoutSet()) {
52 }
53
54 // register signal handler to handle aborts
56}
57
64
80
81int process(std::string const& name, std::string const& executableName, std::function<void(std::string const&, std::string const&)> initSettingsFunc,
82 std::function<void(void)> processOptionsFunc, const int argc, const char** argv) {
84 storm::cli::printHeader(name, argc, argv);
85
86 // Initialize settings
87 initSettingsFunc(name, executableName);
88
89 storm::utility::Stopwatch totalTimer(true);
90 if (!parseOptions(argc, argv)) {
91 return -1;
92 }
93
94 // Start by setting some urgent options (log levels, resources, etc.)
98 // Set output precision
100
101 // Process options and start computations
102 processOptionsFunc();
103
104 totalTimer.stop();
107 }
108
109 // All operations have been performed, so we clean up everything and terminate.
111 return 0;
112}
113
114} // namespace cli
115} // namespace storm
void setFromCommandLine(int const argc, char const *const argv[])
This function parses the given command line arguments and sets all registered options accordingly.
void printHelp(std::string const &filter="frequent") const
This function prints a help message to the standard output.
This class represents the debug settings.
bool isDebugSet() const
Retrieves whether the debug option was set.
bool isLogfileSet() const
Retrieves whether the logfile option was set.
std::string getLogfilename() const
Retrieves the name of the log file if the logfile option was set.
bool isTraceSet() const
Retrieves whether the trace option was set.
This class represents the general settings.
bool isHelpSet() const
Retrieves whether the help option was set.
bool isVerboseSet() const
Retrieves whether the verbose option was set.
bool isVersionSet() const
Retrieves whether the version option was set.
This class represents the resource settings.
uint_fast64_t getTimeoutInSeconds() const
Retrieves the time after which the computation has to be aborted in case the timeout option was set.
bool isTimeoutSet() const
Retrieves whether the timeout option was set.
A class that provides convenience operations to display run times.
Definition Stopwatch.h:14
MilisecondType getTimeInMilliseconds() const
Gets the measured time in milliseconds.
Definition Stopwatch.cpp:21
void stop()
Stop stopwatch and add measured time to total time.
Definition Stopwatch.cpp:42
#define STORM_LOG_ERROR(message)
Definition logging.h:31
void setResourceLimits()
Definition cli.cpp:46
void setFileLogging()
Definition cli.cpp:58
void printTimeAndMemoryStatistics(uint64_t wallclockMilliseconds)
Definition print.cpp:143
void printHeader(std::string const &name, const int argc, const char **argv)
Definition print.cpp:62
void printVersion()
Definition print.cpp:84
bool parseOptions(const int argc, const char *argv[])
Definition cli.cpp:21
void setLogLevel()
Definition cli.cpp:65
SettingsType const & getModule()
Get module.
SettingsManager const & manager()
Retrieves the settings manager.
SettingsManager & mutableManager()
Retrieves the settings manager.
void setTimeoutAlarm(uint_fast64_t timeout)
Set timeout by raising an alarm after timeout seconds.
void installSignalHandler(int maximalWaitTime)
Register some signal handlers to detect and correctly handle abortion (due to timeout for example).
void initializeFileLogging(std::string const &logfileName)
Sets up the logging to file.
void cleanUp()
Performs some necessary clean-up.
void setLogLevel(l3pp::LogLevel level)
Set the global log level.
void setUp()
Performs some necessary initializations.
void setOutputDigitsFromGeneralPrecision(double precision)
Set number of digits for printing output from given precision requirement.
LabParser.cpp.
Definition cli.cpp:18
void process()