SUMO - Simulation of Urban MObility
OptionsIO.h
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 /****************************************************************************/
18 // Helper for parsing command line arguments and reading configuration files
19 /****************************************************************************/
20 #ifndef OptionsIO_h
21 #define OptionsIO_h
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 <vector>
34 #include <string>
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class OptionsCont;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
55 class OptionsIO {
56 public:
62  static void setArgs(int argc, char** argv);
63 
68  static void setArgs(const std::vector<std::string>& args);
69 
72  static int getArgC() {
73  return myArgC;
74  }
75 
76 
89  static void getOptions(const bool commandLineOnly = false);
90 
91 
98  static void loadConfiguration();
99 
100 
101 private:
107  static std::string getRoot(const std::string& filename);
108 
109 
110 private:
111  static int myArgC;
112  static char** myArgV;
113 
114 };
115 
116 
117 #endif
118 
119 /****************************************************************************/
120 
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
Definition: OptionsIO.cpp:82
static char ** myArgV
Definition: OptionsIO.h:112
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
Definition: OptionsIO.cpp:61
static void loadConfiguration()
Loads and parses the configuration.
Definition: OptionsIO.cpp:108
static int myArgC
Definition: OptionsIO.h:111
static int getArgC()
Return the number of command line arguments.
Definition: OptionsIO.h:72
A storage for options typed value containers)
Definition: OptionsCont.h:98
static std::string getRoot(const std::string &filename)
Retrieves the XML root element of a supposed configuration or net.
Definition: OptionsIO.cpp:141