Eclipse SUMO - Simulation of Urban MObility
NLBuilder.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-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
20 // The main interface for loading a microsim
21 /****************************************************************************/
22 #include <config.h>
23 
24 #include <iostream>
25 #include <vector>
26 #include <string>
27 #include <map>
28 
32 #include <utils/options/Option.h>
37 #include <utils/common/SysUtils.h>
38 #include <utils/common/ToString.h>
41 #include <utils/xml/XMLSubSys.h>
42 #ifdef HAVE_FOX
44 #endif
48 #include <microsim/MSNet.h>
51 #include <microsim/MSEdgeControl.h>
52 #include <microsim/MSGlobals.h>
54 #include <microsim/MSFrame.h>
57 #include <microsim/MSDriverState.h>
60 
61 #include "NLHandler.h"
62 #include "NLEdgeControlBuilder.h"
64 #include "NLDetectorBuilder.h"
65 #include "NLTriggerBuilder.h"
66 #include "NLBuilder.h"
67 
68 
69 // ===========================================================================
70 // method definitions
71 // ===========================================================================
72 // ---------------------------------------------------------------------------
73 // NLBuilder::EdgeFloatTimeLineRetriever_EdgeWeight - methods
74 // ---------------------------------------------------------------------------
75 void
77  double value, double begTime, double endTime) const {
78  MSEdge* edge = MSEdge::dictionary(id);
79  if (edge != nullptr) {
80  myNet.getWeightsStorage().addEffort(edge, begTime, endTime, value);
81  } else {
82  WRITE_ERROR("Trying to set the effort for the unknown edge '" + id + "'.");
83  }
84 }
85 
86 
87 // ---------------------------------------------------------------------------
88 // NLBuilder::EdgeFloatTimeLineRetriever_EdgeTravelTime - methods
89 // ---------------------------------------------------------------------------
90 void
92  double value, double begTime, double endTime) const {
93  MSEdge* edge = MSEdge::dictionary(id);
94  if (edge != nullptr) {
95  myNet.getWeightsStorage().addTravelTime(edge, begTime, endTime, value);
96  } else {
97  WRITE_ERROR("Trying to set the travel time for the unknown edge '" + id + "'.");
98  }
99 }
100 
101 
102 // ---------------------------------------------------------------------------
103 // NLBuilder - methods
104 // ---------------------------------------------------------------------------
106  MSNet& net,
109  NLDetectorBuilder& db,
110  NLHandler& xmlHandler)
111  : myOptions(oc), myEdgeBuilder(eb), myJunctionBuilder(jb),
112  myDetectorBuilder(db),
113  myNet(net), myXMLHandler(xmlHandler) {}
114 
115 
117 
118 
119 bool
121  // try to build the net
122  if (!load("net-file", true)) {
123  return false;
124  }
125  if (myXMLHandler.networkVersion() == 0.) {
126  throw ProcessError("Invalid network, no network version declared.");
127  }
128  // check whether the loaded net agrees with the simulation options
129  if ((myOptions.getBool("no-internal-links") || myOptions.getBool("mesosim")) && myXMLHandler.haveSeenInternalEdge() && myXMLHandler.haveSeenDefaultLength()) {
130  WRITE_WARNING("Network contains internal links which are ignored. Vehicles will 'jump' across junctions and thus underestimate route lengths and travel times.");
131  }
132  buildNet();
133  // @note on loading order constraints:
134  // - additional-files before route-files and state-files due to referencing
135  // - additional-files before weight-files since the latter might contain intermodal edge data and the intermodal net depends on the stops and public transport from the additionals
136 
137  bool stateBeginMismatch = false;
138  if (myOptions.isSet("load-state")) {
139  // first, load only the time
141  if (myOptions.isDefault("begin")) {
142  myOptions.set("begin", time2string(stateTime));
143  if (TraCIServer::getInstance() != nullptr) {
145  }
146  } else {
147  if (stateTime != string2time(myOptions.getString("begin"))) {
148  WRITE_WARNING("State was written at a different time=" + time2string(stateTime) + " than the begin time " + myOptions.getString("begin") + "!");
149  stateBeginMismatch = true;
150  }
151  }
152  }
153 
154  // load additional net elements (sources, detectors, ...)
155  if (myOptions.isSet("additional-files")) {
156  if (!load("additional-files")) {
157  return false;
158  }
159  // load shapes with separate handler
161  if (!ShapeHandler::loadFiles(myOptions.getStringVector("additional-files"), sh)) {
162  return false;
163  }
166  }
170  tll->initMesoTLSPenalties();
171  }
172  }
174  }
175  if (stateBeginMismatch && myNet.getVehicleControl().getLoadedVehicleNo() > 0) {
176  throw ProcessError("Loading vehicles ahead of a state file is not supported. Correct --begin option or load vehicles with option --route-files");
177  }
178 
179  if (myOptions.getBool("junction-taz")) {
180  // create a TAZ for every junction
181  const MSJunctionControl& junctions = myNet.getJunctionControl();
182  for (auto it = junctions.begin(); it != junctions.end(); it++) {
183  const std::string sinkID = it->first + "-sink";
184  const std::string sourceID = it->first + "-source";
185  if (MSEdge::dictionary(sinkID) == nullptr && MSEdge::dictionary(sourceID) == nullptr) {
186  // sink must be built and addd before source
187  MSEdge* sink = myEdgeBuilder.buildEdge(sinkID, SumoXMLEdgeFunc::CONNECTOR, "", "", -1, 0);
188  MSEdge* source = myEdgeBuilder.buildEdge(sourceID, SumoXMLEdgeFunc::CONNECTOR, "", "", -1, 0);
189  sink->setOtherTazConnector(source);
190  source->setOtherTazConnector(sink);
191  MSEdge::dictionary(sinkID, sink);
192  MSEdge::dictionary(sourceID, source);
193  sink->initialize(new std::vector<MSLane*>());
194  source->initialize(new std::vector<MSLane*>());
195  const MSJunction* junction = it->second;
196  for (const MSEdge* edge : junction->getIncoming()) {
197  if (!edge->isInternal()) {
198  const_cast<MSEdge*>(edge)->addSuccessor(sink);
199  }
200  }
201  for (const MSEdge* edge : junction->getOutgoing()) {
202  if (!edge->isInternal()) {
203  source->addSuccessor(const_cast<MSEdge*>(edge));
204  }
205  }
206  } else {
207  WRITE_WARNINGF("A TAZ with id '%' already exists. Not building junction TAZ.", it->first)
208  }
209  }
210  }
211  // load weights if wished
212  if (myOptions.isSet("weight-files")) {
213  if (!myOptions.isUsableFileList("weight-files")) {
214  return false;
215  }
216  // build and prepare the weights handler
217  std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
218  // travel time, first (always used)
220  retrieverDefs.push_back(new SAXWeightsHandler::ToRetrieveDefinition("traveltime", true, ttRetriever));
221  // the measure to use, then
223  std::string measure = myOptions.getString("weight-attribute");
224  if (!myOptions.isDefault("weight-attribute")) {
225  if (measure == "CO" || measure == "CO2" || measure == "HC" || measure == "PMx" || measure == "NOx" || measure == "fuel" || measure == "electricity") {
226  measure += "_perVeh";
227  }
228  retrieverDefs.push_back(new SAXWeightsHandler::ToRetrieveDefinition(measure, true, eRetriever));
229  }
230  // set up handler
231  SAXWeightsHandler handler(retrieverDefs, "");
232  // start parsing; for each file in the list
233  std::vector<std::string> files = myOptions.getStringVector("weight-files");
234  for (std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) {
235  // report about loading when wished
236  WRITE_MESSAGE("Loading weights from '" + *i + "'...");
237  // parse the file
238  if (!XMLSubSys::runParser(handler, *i)) {
239  return false;
240  }
241  }
242  }
243  // load the previous state if wished
244  if (myOptions.isSet("load-state")) {
245  const std::string& f = myOptions.getString("load-state");
246  long before = PROGRESS_BEGIN_TIME_MESSAGE("Loading state from '" + f + "'");
247  MSStateHandler h(f, string2time(myOptions.getString("load-state.offset")));
248  XMLSubSys::runParser(h, f);
249  if (MsgHandler::getErrorInstance()->wasInformed()) {
250  return false;
251  }
252  PROGRESS_TIME_MESSAGE(before);
253  }
254  // load routes
255  if (myOptions.isSet("route-files") && string2time(myOptions.getString("route-steps")) <= 0) {
256  if (!load("route-files")) {
257  return false;
258  }
259  }
260  // optionally switch off traffic lights
261  if (myOptions.getBool("tls.all-off")) {
263  }
264  WRITE_MESSAGE("Loading done.");
265  return true;
266 }
267 
268 
269 MSNet*
270 NLBuilder::init(const bool isLibsumo) {
272  oc.clear();
275  if (oc.processMetaOptions(OptionsIO::getArgC() < 2)) {
277  return nullptr;
278  }
280  std::string validation = oc.getString("xml-validation");
281  std::string routeValidation = oc.getString("xml-validation.routes");
282  if (isLibsumo) {
283  if (oc.isDefault("xml-validation")) {
284  validation = "never";
285  }
286  if (oc.isDefault("xml-validation.routes")) {
287  routeValidation = "never";
288  }
289  }
290  XMLSubSys::setValidation(validation, oc.getString("xml-validation.net"), routeValidation);
291  if (!MSFrame::checkOptions()) {
292  throw ProcessError();
293  }
294 #ifdef HAVE_FOX
295  if (oc.getInt("threads") > 1) {
296  // make the output aware of threading
298  }
299 #endif
301  initRandomness();
303  MSVehicleControl* vc = nullptr;
305  vc = new MEVehicleControl();
306  } else {
307  vc = new MSVehicleControl();
308  }
309  MSNet* net = new MSNet(vc, new MSEventControl(), new MSEventControl(), new MSEventControl());
310  // need to init TraCI-Server before loading routes to catch VehicleState::BUILT
311  TraCIServer::openSocket(std::map<int, TraCIServer::CmdExecutor>());
312  if (isLibsumo) {
314  }
315 
317  NLDetectorBuilder db(*net);
318  NLJunctionControlBuilder jb(*net, db);
319  NLTriggerBuilder tb;
320  NLHandler handler("", *net, db, tb, eb, jb);
321  tb.setHandler(&handler);
322  NLBuilder builder(oc, *net, eb, jb, db, handler);
326  if (builder.build()) {
327  // preload the routes especially for TraCI
328  net->loadRoutes();
329  return net;
330  }
331  delete net;
332  throw ProcessError();
333 }
334 
335 void
343 }
344 
345 void
347  MSEdgeControl* edges = nullptr;
348  MSJunctionControl* junctions = nullptr;
349  SUMORouteLoaderControl* routeLoaders = nullptr;
350  MSTLLogicControl* tlc = nullptr;
351  std::vector<SUMOTime> stateDumpTimes;
352  std::vector<std::string> stateDumpFiles;
353  try {
354  MSFrame::buildStreams(); // ensure streams are ready for output during building
356  junctions = myJunctionBuilder.build();
357  junctions->postloadInitContainer();
358  routeLoaders = buildRouteLoaderControl(myOptions);
360  for (std::string timeStr : myOptions.getStringVector("save-state.times")) {
361  stateDumpTimes.push_back(string2time(timeStr));
362  }
363  if (myOptions.isSet("save-state.files")) {
364  stateDumpFiles = myOptions.getStringVector("save-state.files");
365  if (stateDumpFiles.size() != stateDumpTimes.size()) {
366  throw ProcessError("Wrong number of state file names!");
367  }
368  } else {
369  const std::string prefix = myOptions.getString("save-state.prefix");
370  const std::string suffix = myOptions.getString("save-state.suffix");
371  for (std::vector<SUMOTime>::iterator i = stateDumpTimes.begin(); i != stateDumpTimes.end(); ++i) {
372  std::string timeStamp = time2string(*i);
373  std::replace(timeStamp.begin(), timeStamp.end(), ':', '-');
374  stateDumpFiles.push_back(prefix + "_" + timeStamp + suffix);
375  }
376  }
377  } catch (IOError& e) {
378  delete edges;
379  delete junctions;
380  delete routeLoaders;
381  delete tlc;
382  throw ProcessError(e.what());
383  } catch (ProcessError&) {
384  delete edges;
385  delete junctions;
386  delete routeLoaders;
387  delete tlc;
388  throw;
389  }
390  // if anthing goes wrong after this point, the net is responsible for cleaning up
391  myNet.closeBuilding(myOptions, edges, junctions, routeLoaders, tlc, stateDumpTimes, stateDumpFiles,
395 }
396 
397 
398 bool
399 NLBuilder::load(const std::string& mmlWhat, const bool isNet) {
400  if (!myOptions.isUsableFileList(mmlWhat)) {
401  return false;
402  }
403  std::vector<std::string> files = myOptions.getStringVector(mmlWhat);
404  for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
405  const long before = PROGRESS_BEGIN_TIME_MESSAGE("Loading " + mmlWhat + " from '" + *fileIt + "'");
406  if (!XMLSubSys::runParser(myXMLHandler, *fileIt, isNet)) {
407  WRITE_MESSAGE("Loading of " + mmlWhat + " failed.");
408  return false;
409  }
410  PROGRESS_TIME_MESSAGE(before);
411  }
412  return true;
413 }
414 
415 
418  // build the loaders
419  SUMORouteLoaderControl* loaders = new SUMORouteLoaderControl(string2time(oc.getString("route-steps")));
420  // check whether a list is existing
421  if (oc.isSet("route-files") && string2time(oc.getString("route-steps")) > 0) {
422  std::vector<std::string> files = oc.getStringVector("route-files");
423  for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
424  if (!FileHelpers::isReadable(*fileIt)) {
425  throw ProcessError("The route file '" + *fileIt + "' is not accessible.");
426  }
427  }
428  // open files for reading
429  for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
430  loaders->add(new SUMORouteLoader(new MSRouteHandler(*fileIt, false)));
431  }
432  }
433  return loaders;
434 }
435 
436 
437 /****************************************************************************/
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:281
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:282
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:288
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
#define PROGRESS_BEGIN_TIME_MESSAGE(msg)
Definition: MsgHandler.h:285
#define PROGRESS_TIME_MESSAGE(before)
Definition: MsgHandler.h:286
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
long long int SUMOTime
Definition: SUMOTime.h:32
static bool isReadable(std::string path)
Checks whether the given file is readable.
Definition: FileHelpers.cpp:49
The class responsible for building and deletion of vehicles (gui-version)
static SumoRNG * getResponseTimeRNG()
Definition: MSDevice_ToC.h:176
static SumoRNG * getEquipmentRNG()
Definition: MSDevice.h:88
Stores edges and lanes, performs moving of vehicle.
Definition: MSEdgeControl.h:81
void setMesoTypes()
update meso edge type parameters
void setAdditionalRestrictions()
apply additional restrictions
A road/street connecting two junctions.
Definition: MSEdge.h:77
void setOtherTazConnector(const MSEdge *edge)
Definition: MSEdge.h:289
void addSuccessor(MSEdge *edge, const MSEdge *via=nullptr)
Adds an edge to the list of edges which may be reached from this edge and to the incoming of the othe...
Definition: MSEdge.cpp:1069
void initialize(const std::vector< MSLane * > *lanes)
Initialize the edge.
Definition: MSEdge.cpp:99
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary....
Definition: MSEdge.cpp:885
void addTravelTime(const MSEdge *const e, double begin, double end, double value)
Adds a travel time information for an edge and a time span.
void addEffort(const MSEdge *const e, double begin, double end, double value)
Adds an effort information for an edge and a time span.
Stores time-dependant events and executes them at the proper time.
static void buildStreams()
Builds the streams used possibly by the simulation.
Definition: MSFrame.cpp:688
static void setMSGlobals(OptionsCont &oc)
Sets the global microsim-options.
Definition: MSFrame.cpp:922
static void fillOptions()
Inserts options used by the simulation into the OptionsCont-singleton.
Definition: MSFrame.cpp:60
static bool checkOptions()
Checks the set options.
Definition: MSFrame.cpp:730
static bool gUseMesoSim
Definition: MSGlobals.h:94
Container for junctions; performs operations on all stored junctions.
void postloadInitContainer()
Closes building of junctions.
The base class for an intersection.
Definition: MSJunction.h:58
const ConstMSEdgeVector & getIncoming() const
Definition: MSJunction.h:105
const ConstMSEdgeVector & getOutgoing() const
Definition: MSJunction.h:111
static void initRNGs(const OptionsCont &oc)
initialize rngs
Definition: MSLane.cpp:4019
The simulated network and simulation perfomer.
Definition: MSNet.h:88
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition: MSNet.h:449
void closeBuilding(const OptionsCont &oc, MSEdgeControl *edges, MSJunctionControl *junctions, SUMORouteLoaderControl *routeLoaders, MSTLLogicControl *tlc, std::vector< SUMOTime > stateDumpTimes, std::vector< std::string > stateDumpFiles, bool hasInternalLinks, bool junctionHigherSpeeds, double version)
Closes the network's building process.
Definition: MSNet.cpp:247
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:376
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition: MSNet.h:499
MSJunctionControl & getJunctionControl()
Returns the junctions control.
Definition: MSNet.h:459
MSEdgeControl & getEdgeControl()
Returns the edge control.
Definition: MSNet.h:419
MSEdgeWeightsStorage & getWeightsStorage()
Returns the net's internal edge travel times/efforts container.
Definition: MSNet.cpp:1082
void loadRoutes()
loads routes for the next few steps
Definition: MSNet.cpp:417
Parser and container for routes during their loading.
static SumoRNG * getParsingRNG()
get parsing RNG
static SUMOTime getTime(const std::string &fileName)
parse time from state file
Parser and output filter for routes and vehicles state saving and loading.
A class that stores and controls tls and switching of their programs.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
void switchOffAll()
switch all logic variants to 'off'
The parent class for traffic light logics.
static void checkParkingRerouteConsistency()
issues warning for incomplete parkingReroute relationships
The class responsible for building and deletion of vehicles.
int getLoadedVehicleNo() const
Returns the number of build vehicles.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
Definition: MsgHandler.cpp:80
static void initOutputOptions()
init output options
Definition: MsgHandler.cpp:228
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
Definition: MsgHandler.cpp:67
static void setFactory(Factory func)
Sets the factory function to use for new MsgHandlers.
Definition: MsgHandler.h:62
virtual void clear(bool resetInformed=true)
Clears information whether an error occurred previously and print aggregated message summary.
Definition: MsgHandler.cpp:162
static MsgHandler * getMessageInstance()
Returns the instance to add normal messages to.
Definition: MsgHandler.cpp:54
static MsgHandler * create(MsgType type)
MSNet & myNet
The network edges shall be obtained from.
Definition: NLBuilder.h:164
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds an effort for a given edge and time period.
Definition: NLBuilder.cpp:76
Obtains edge efforts from a weights handler and stores them within the edges.
Definition: NLBuilder.h:174
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds a travel time for a given edge and time period.
Definition: NLBuilder.cpp:91
The main interface for loading a microsim.
Definition: NLBuilder.h:58
static MSNet * init(const bool isLibsumo=false)
Definition: NLBuilder.cpp:270
MSNet & myNet
The net to fill.
Definition: NLBuilder.h:214
bool load(const std::string &mmlWhat, const bool isNet=false)
Loads a described subpart form the given list of files.
Definition: NLBuilder.cpp:399
NLDetectorBuilder & myDetectorBuilder
The detector control builder to use.
Definition: NLBuilder.h:211
virtual bool build()
Builds and initialises the simulation.
Definition: NLBuilder.cpp:120
virtual ~NLBuilder()
Destructor.
Definition: NLBuilder.cpp:116
void buildNet()
Closes the net building process.
Definition: NLBuilder.cpp:346
NLBuilder(OptionsCont &oc, MSNet &net, NLEdgeControlBuilder &eb, NLJunctionControlBuilder &jb, NLDetectorBuilder &db, NLHandler &xmlHandler)
Constructor.
Definition: NLBuilder.cpp:105
NLJunctionControlBuilder & myJunctionBuilder
The junction control builder to use.
Definition: NLBuilder.h:208
SUMORouteLoaderControl * buildRouteLoaderControl(const OptionsCont &oc)
Builds the route loader control.
Definition: NLBuilder.cpp:417
NLEdgeControlBuilder & myEdgeBuilder
The edge control builder to use.
Definition: NLBuilder.h:205
OptionsCont & myOptions
The options to get the names of the files to load and further information from.
Definition: NLBuilder.h:202
static void initRandomness()
initializes all RNGs
Definition: NLBuilder.cpp:336
NLHandler & myXMLHandler
The handler used to parse the net.
Definition: NLBuilder.h:217
Builds detectors for microsim.
Interface for building edges.
MSEdgeControl * build(double networkVersion)
builds the MSEdgeControl-class which holds all edges
virtual MSEdge * buildEdge(const std::string &id, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, const int priority, const double distance)
Builds an edge instance (MSEdge in this case)
The XML-Handler for network loading.
Definition: NLHandler.h:79
bool haveSeenAdditionalSpeedRestrictions() const
Definition: NLHandler.h:119
bool haveSeenInternalEdge() const
Definition: NLHandler.h:103
bool hasJunctionHigherSpeeds() const
Definition: NLHandler.h:107
double networkVersion() const
Definition: NLHandler.h:127
bool haveSeenDefaultLength() const
Definition: NLHandler.h:111
bool haveSeenMesoEdgeType() const
Definition: NLHandler.h:123
Builder of microsim-junctions and tls.
MSTLLogicControl * buildTLLogics()
Returns the built tls-logic control.
MSJunctionControl * build() const
Builds the MSJunctionControl which holds all of the simulations junctions.
The XML-Handler for shapes loading network loading.
Definition: NLHandler.h:55
Builds trigger objects for microsim.
void setHandler(NLHandler *handler)
Sets the parent handler to use for nested parsing.
IDMap::const_iterator begin() const
Returns a reference to the begin iterator for the internal map.
IDMap::const_iterator end() const
Returns a reference to the end iterator for the internal map.
static SumoRNG * getRNG()
Definition: MSDriverState.h:78
A storage for options typed value containers)
Definition: OptionsCont.h:89
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
void clear()
Removes all information from the container.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
bool isUsableFileList(const std::string &name) const
Checks whether the named option is usable as a file list (with at least a single file)
static int getArgC()
Return the number of command line arguments.
Definition: OptionsIO.h:63
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
Definition: OptionsIO.cpp:85
static void initRandGlobal(SumoRNG *which=nullptr)
Reads the given random number options and initialises the random number generator in accordance.
Definition: RandHelper.cpp:75
Complete definition about what shall be retrieved and where to store it.
An XML-handler for network weights.
void add(SUMORouteLoader *loader)
add another loader
static bool loadFiles(const std::vector< std::string > &files, ShapeHandler &sh)
loads all of the given files
static void close()
Closes all of an applications subsystems.
static bool checkOptions()
checks shared options and sets StdDefs
void stateLoaded(SUMOTime targetTime)
updates myTargetTime and resets vehicle state changes after loading a simulation state
static void openSocket(const std::map< int, CmdExecutor > &execs)
Initialises the server.
static TraCIServer * getInstance()
Definition: TraCIServer.h:68
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme, const std::string &routeValidationScheme)
Enables or disables validation.
Definition: XMLSubSys.cpp:65
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false)
Runs the given handler on the given file; returns if everything's ok.
Definition: XMLSubSys.cpp:149
static void registerVehicleStateListener()
Definition: Helper.cpp:689