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 /****************************************************************************/
15 // Helper for parsing command line arguments and reading configuration files
16 /****************************************************************************/
17 #ifndef OptionsIO_h
18 #define OptionsIO_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <vector>
27 #include <string>
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class OptionsCont;
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
48 class OptionsIO {
49 public:
55  static void setArgs(int argc, char** argv);
56 
61  static void setArgs(const std::vector<std::string>& args);
62 
65  static int getArgC() {
66  return myArgC;
67  }
68 
69 
82  static void getOptions(const bool commandLineOnly = false);
83 
84 
91  static void loadConfiguration();
92 
93 
94 private:
100  static std::string getRoot(const std::string& filename);
101 
102 
103 private:
104  static int myArgC;
105  static char** myArgV;
106 
107 };
108 
109 
110 #endif
111 
112 /****************************************************************************/
113 
UtilExceptions.h
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
OptionsIO::myArgV
static char ** myArgV
Definition: OptionsIO.h:105
OptionsIO::myArgC
static int myArgC
Definition: OptionsIO.h:104
OptionsIO::getOptions
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
Definition: OptionsIO.cpp:75
OptionsIO::loadConfiguration
static void loadConfiguration()
Loads and parses the configuration.
Definition: OptionsIO.cpp:101
OptionsIO::getArgC
static int getArgC()
Return the number of command line arguments.
Definition: OptionsIO.h:65
OptionsIO
Definition: OptionsIO.h:48
OptionsIO::setArgs
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
Definition: OptionsIO.cpp:54
OptionsIO::getRoot
static std::string getRoot(const std::string &filename)
Retrieves the XML root element of a supposed configuration or net.
Definition: OptionsIO.cpp:134
config.h