SUMO - Simulation of Urban MObility
SystemFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // A set of actions common to all applications
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include "SystemFrame.h"
34 #include <string>
35 #include <utils/xml/XMLSubSys.h>
36 #include <utils/common/StdDefs.h>
40 #include "RandHelper.h"
41 
42 
43 // ===========================================================================
44 // method definitions
45 // ===========================================================================
46 void
48  oc.addOptionSubTopic("Configuration");
49 
50  oc.doRegister("configuration-file", 'c', new Option_FileName());
51  oc.addSynonyme("configuration-file", "configuration");
52  oc.addDescription("configuration-file", "Configuration", "Loads the named config on startup");
53  oc.addXMLDefault("configuration-file");
54 
55  oc.doRegister("save-configuration", new Option_FileName());
56  oc.addSynonyme("save-config", "save-configuration");
57  oc.addDescription("save-configuration", "Configuration", "Saves current configuration into FILE");
58 
59  oc.doRegister("save-template", new Option_FileName());
60  oc.addDescription("save-template", "Configuration", "Saves a configuration template (empty) into FILE");
61 
62  oc.doRegister("save-schema", new Option_FileName());
63  oc.addDescription("save-schema", "Configuration", "Saves the configuration schema into FILE");
64 
65  oc.doRegister("save-commented", new Option_Bool(false));
66  oc.addSynonyme("save-commented", "save-template.commented");
67  oc.addDescription("save-commented", "Configuration", "Adds comments to saved template, configuration, or schema");
68 }
69 
70 
71 void
73  oc.addOptionSubTopic("Report");
74 
75  oc.doRegister("verbose", 'v', new Option_Bool(false));
76  oc.addDescription("verbose", "Report", "Switches to verbose output");
77 
78  oc.doRegister("print-options", new Option_Bool(false));
79  oc.addDescription("print-options", "Report", "Prints option values before processing");
80 
81  oc.doRegister("help", '?', new Option_Bool(false));
82  oc.addDescription("help", "Report", "Prints this screen");
83 
84  oc.doRegister("version", 'V', new Option_Bool(false));
85  oc.addDescription("version", "Report", "Prints the current version");
86 
87  oc.doRegister("xml-validation", 'X', new Option_String("auto"));
88  oc.addDescription("xml-validation", "Report", "Set schema validation scheme of XML inputs (\"never\", \"auto\" or \"always\")");
89 
90  oc.doRegister("xml-validation.net", new Option_String("never"));
91  oc.addDescription("xml-validation.net", "Report", "Set schema validation scheme of SUMO network inputs (\"never\", \"auto\" or \"always\")");
92 
93  oc.doRegister("no-warnings", 'W', new Option_Bool(false));
94  oc.addSynonyme("no-warnings", "suppress-warnings", true);
95  oc.addDescription("no-warnings", "Report", "Disables output of warnings");
96 
97  oc.doRegister("log", 'l', new Option_FileName());
98  oc.addSynonyme("log", "log-file");
99  oc.addDescription("log", "Report", "Writes all messages to FILE (implies verbose)");
100 
101  oc.doRegister("message-log", new Option_FileName());
102  oc.addDescription("message-log", "Report", "Writes all non-error messages to FILE (implies verbose)");
103 
104  oc.doRegister("error-log", new Option_FileName());
105  oc.addDescription("error-log", "Report", "Writes all warnings and errors to FILE");
106 
107  oc.doRegister("output-prefix", new Option_String());
108  oc.addDescription("output-prefix", "Output", "Prefix which is applied to all output files. The special string 'TIME' is replaced by the current time.");
109 
110  oc.doRegister("precision", new Option_Integer(2));
111  oc.addDescription("precision", "Output", "Defines the number of digits after the comma for floating point output");
112 
113  oc.doRegister("precision.geo", new Option_Integer(6));
114  oc.addDescription("precision.geo", "Output", "Defines the number of digits after the comma for lon,lat output");
115 }
116 
117 
118 bool
121  gPrecision = oc.getInt("precision");
122  gPrecisionGeo = oc.getInt("precision.geo");
123  return true;
124 }
125 
126 
127 void
129  // close all output devices
131  // close the xml-subsystem
133  // delete build program options
135  // delete messages
137 }
138 
139 
140 /****************************************************************************/
141 
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:82
static void close()
Closes the xml-subsystem.
Definition: XMLSubSys.cpp:88
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
Definition: SystemFrame.cpp:72
int gPrecision
the precision for floating point outputs
Definition: StdDefs.cpp:30
static void close()
Closes all of an applications subsystems.
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
Definition: SystemFrame.cpp:47
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
void clear()
Removes all information from the container.
static void cleanupOnEnd()
Removes pending handler.
Definition: MsgHandler.cpp:238
static void closeAll()
int gPrecisionGeo
Definition: StdDefs.cpp:31
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
static bool checkOptions()
checks shared options and sets StdDefs
An integer-option.
Definition: Option.h:313
void addXMLDefault(const std::string &name, const std::string &xmlRoot="")
Adds an XML root element to handle by default. The special root "" denotes the default handler...
A storage for options typed value containers)
Definition: OptionsCont.h:99
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.