SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Parameterised.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // A super class for objects with additional parameters
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2002-2016 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef Parameterised_h
24 #define Parameterised_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <map>
37 #include <string>
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
48 public:
51  Parameterised();
52 
53 
57  Parameterised(const std::map<std::string, std::string>& mapArg);
58 
59 
62 
63 
64 
69  void addParameter(const std::string& key, const std::string& value);
70 
71 
75  void addParameter(const std::map<std::string, std::string>& mapArg);
76 
77 
81  void addParameter(const Parameterised& p);
82 
83 
88  bool knowsParameter(const std::string& key) const;
89 
90 
96  const std::string& getParameter(const std::string& key, const std::string& defaultValue) const;
97 
98 
101  void clearParameter();
102 
103 
107  const std::map<std::string, std::string>& getMap() const {
108  return myMap;
109  }
110 
111 
112 private:
114  std::map<std::string, std::string> myMap;
115 
116 };
117 
118 
119 #endif
120 
121 /****************************************************************************/
122 
std::map< std::string, std::string > myMap
The key->value map.
const std::map< std::string, std::string > & getMap() const
Returns the inner key/value map.
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
~Parameterised()
Destructor.
An upper class for objects with additional parameters.
Definition: Parameterised.h:47
void addParameter(const std::string &key, const std::string &value)
Adds a parameter.
Parameterised()
Constructor.
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.
void clearParameter()
Clears the parameter map.