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-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 /****************************************************************************/
19 // Helper for parsing command line arguments and reading configuration files
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include <vector>
25 #include <string>
27 
28 
29 // ===========================================================================
30 // class declarations
31 // ===========================================================================
32 class OptionsCont;
33 
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
46 class OptionsIO {
47 public:
53  static void setArgs(int argc, char** argv);
54 
59  static void setArgs(const std::vector<std::string>& args);
60 
63  static int getArgC() {
64  return myArgC;
65  }
66 
67 
80  static void getOptions(const bool commandLineOnly = false);
81 
82 
89  static void loadConfiguration();
90 
91 
97  static std::string getRoot(const std::string& filename);
98 
99 
100 private:
101  static int myArgC;
102  static char** myArgV;
103 
104 };
A storage for options typed value containers)
Definition: OptionsCont.h:89
static void loadConfiguration()
Loads and parses the configuration.
Definition: OptionsIO.cpp:108
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
Definition: OptionsIO.cpp:58
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 std::string getRoot(const std::string &filename)
Retrieves the XML root element of a supposed configuration or net.
Definition: OptionsIO.cpp:152
static int myArgC
Definition: OptionsIO.h:101
static char ** myArgV
Definition: OptionsIO.h:102