Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // Helper for parsing command line arguments and reading configuration files
17 /****************************************************************************/
18 #ifndef OptionsIO_h
19 #define OptionsIO_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <vector>
28 #include <string>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class OptionsCont;
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
49 class OptionsIO {
50 public:
56  static void setArgs(int argc, char** argv);
57 
62  static void setArgs(const std::vector<std::string>& args);
63 
66  static int getArgC() {
67  return myArgC;
68  }
69 
70 
83  static void getOptions(const bool commandLineOnly = false);
84 
85 
92  static void loadConfiguration();
93 
94 
95 private:
101  static std::string getRoot(const std::string& filename);
102 
103 
104 private:
105  static int myArgC;
106  static char** myArgV;
107 
108 };
109 
110 
111 #endif
112 
113 /****************************************************************************/
114 
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
Definition: OptionsIO.cpp:76
static char ** myArgV
Definition: OptionsIO.h:106
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
Definition: OptionsIO.cpp:55
static void loadConfiguration()
Loads and parses the configuration.
Definition: OptionsIO.cpp:102
static int myArgC
Definition: OptionsIO.h:105
static int getArgC()
Return the number of command line arguments.
Definition: OptionsIO.h:66
A storage for options typed value containers)
Definition: OptionsCont.h:90
static std::string getRoot(const std::string &filename)
Retrieves the XML root element of a supposed configuration or net.
Definition: OptionsIO.cpp:135