Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
OptionsIO.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 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>
26#include <chrono>
27
28
29// ===========================================================================
30// class declarations
31// ===========================================================================
32class OptionsCont;
33
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
46class OptionsIO {
47public:
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 (int)myArgs.size();
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
101 static const std::chrono::time_point<std::chrono::system_clock>& getLoadTime() {
102 return myLoadTime;
103 }
104
105
106private:
107 static std::vector<std::string> myArgs;
108 static std::chrono::time_point<std::chrono::system_clock> myLoadTime;
109
110};
A storage for options typed value containers)
Definition OptionsCont.h:89
static void loadConfiguration()
Loads and parses the configuration.
Definition OptionsIO.cpp:98
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:74
static const std::chrono::time_point< std::chrono::system_clock > & getLoadTime()
Return the time stamp of the last init.
Definition OptionsIO.h:101
static std::vector< std::string > myArgs
Definition OptionsIO.h:107
static std::string getRoot(const std::string &filename)
Retrieves the XML root element of a supposed configuration or net.
static std::chrono::time_point< std::chrono::system_clock > myLoadTime
Definition OptionsIO.h:108