SUMO - Simulation of Urban MObility
SystemFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // A set of actions common to all applications
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include "SystemFrame.h"
33 #include <string>
34 #include <utils/xml/XMLSubSys.h>
35 #include <utils/common/StdDefs.h>
39 #include "RandHelper.h"
40 
41 
42 // ===========================================================================
43 // method definitions
44 // ===========================================================================
45 void
47  oc.addOptionSubTopic("Configuration");
48 
49  oc.doRegister("configuration-file", 'c', new Option_FileName());
50  oc.addSynonyme("configuration-file", "configuration");
51  oc.addDescription("configuration-file", "Configuration", "Loads the named config on startup");
52  oc.addXMLDefault("configuration-file");
53 
54  oc.doRegister("save-configuration", new Option_FileName());
55  oc.addSynonyme("save-config", "save-configuration");
56  oc.addDescription("save-configuration", "Configuration", "Saves current configuration into FILE");
57 
58  oc.doRegister("save-template", new Option_FileName());
59  oc.addDescription("save-template", "Configuration", "Saves a configuration template (empty) into FILE");
60 
61  oc.doRegister("save-schema", new Option_FileName());
62  oc.addDescription("save-schema", "Configuration", "Saves the configuration schema into FILE");
63 
64  oc.doRegister("save-commented", new Option_Bool(false));
65  oc.addSynonyme("save-commented", "save-template.commented");
66  oc.addDescription("save-commented", "Configuration", "Adds comments to saved template, configuration, or schema");
67 }
68 
69 
70 void
72  oc.addOptionSubTopic("Report");
73 
74  oc.doRegister("verbose", 'v', new Option_Bool(false));
75  oc.addDescription("verbose", "Report", "Switches to verbose output");
76 
77  oc.doRegister("print-options", new Option_Bool(false));
78  oc.addDescription("print-options", "Report", "Prints option values before processing");
79 
80  oc.doRegister("help", '?', new Option_Bool(false));
81  oc.addDescription("help", "Report", "Prints this screen");
82 
83  oc.doRegister("version", 'V', new Option_Bool(false));
84  oc.addDescription("version", "Report", "Prints the current version");
85 
86  oc.doRegister("xml-validation", 'X', new Option_String("auto"));
87  oc.addDescription("xml-validation", "Report", "Set schema validation scheme of XML inputs (\"never\", \"auto\" or \"always\")");
88 
89  oc.doRegister("xml-validation.net", new Option_String("never"));
90  oc.addDescription("xml-validation.net", "Report", "Set schema validation scheme of SUMO network inputs (\"never\", \"auto\" or \"always\")");
91 
92  oc.doRegister("no-warnings", 'W', new Option_Bool(false));
93  oc.addSynonyme("no-warnings", "suppress-warnings", true);
94  oc.addDescription("no-warnings", "Report", "Disables output of warnings");
95 
96  oc.doRegister("log", 'l', new Option_FileName());
97  oc.addSynonyme("log", "log-file");
98  oc.addDescription("log", "Report", "Writes all messages to FILE (implies verbose)");
99 
100  oc.doRegister("message-log", new Option_FileName());
101  oc.addDescription("message-log", "Report", "Writes all non-error messages to FILE (implies verbose)");
102 
103  oc.doRegister("error-log", new Option_FileName());
104  oc.addDescription("error-log", "Report", "Writes all warnings and errors to FILE");
105 
106  oc.doRegister("output-prefix", new Option_String());
107  oc.addDescription("output-prefix", "Output", "Prefix which is applied to all output files. The special string 'TIME' is replaced by the current time.");
108 
109  oc.doRegister("precision", new Option_Integer(2));
110  oc.addDescription("precision", "Output", "Defines the number of digits after the comma for floating point output");
111 
112  oc.doRegister("precision.geo", new Option_Integer(6));
113  oc.addDescription("precision.geo", "Output", "Defines the number of digits after the comma for lon,lat output");
114 }
115 
116 
117 bool
120  gPrecision = oc.getInt("precision");
121  gPrecisionGeo = oc.getInt("precision.geo");
122  return true;
123 }
124 
125 
126 void
128  // close all output devices
130  // close the xml-subsystem
132  // delete build program options
134  // delete messages
136 }
137 
138 
139 /****************************************************************************/
140 
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
Definition: OptionsCont.cpp:81
static void close()
Closes the xml-subsystem.
Definition: XMLSubSys.cpp:87
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:71
int gPrecision
the precision for floating point outputs
Definition: StdDefs.cpp:29
static void close()
Closes all of an applications subsystems.
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
Definition: SystemFrame.cpp:46
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:64
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:237
static void closeAll()
int gPrecisionGeo
Definition: StdDefs.cpp:30
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:312
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:98
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.