 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
59 for (
auto i : mapArg) {
60 myMap[i.first] = i.second;
73 std::map<std::string, std::string>::const_iterator i =
myMap.find(key);
74 if (i !=
myMap.end()) {
83 std::map<std::string, std::string>::const_iterator i =
myMap.find(key);
84 if (i !=
myMap.end()) {
88 WRITE_WARNING(
"Invalid conversion from string to double (" + i->second +
")");
91 WRITE_WARNING(
"Invalid conversion from string to double (empty value)");
105 const std::map<std::string, std::string>&
115 for (
const auto& i :
myMap) {
116 result += i.first +
"=" + i.second +
"|";
119 if (!result.empty()) {
145 for (
const auto& i : parameters) {
148 myMap[keyValue.front()] = keyValue.back();
156 for (
auto i :
myMap) {
170 for (
const auto& i : parameters) {
191 if (std::find(value.begin(), value.end(),
'|') != value.end()) {
195 if (std::find(value.begin(), value.end(),
'=') == value.end()) {
201 if (keyValue.size() == 2) {
static bool isParameterValid(const std::string &value, bool report)
check if given string can be parsed to a parameter of type "key=value"
std::string getParametersStr() const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
#define WRITE_WARNING(msg)
An upper class for objects with additional parameters.
Static storage of an output device and its base (abstract) implementation.
@ SUMO_TAG_PARAM
parameter associated to a certain key
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
Parameterised()
Constructor.
void setParameters(const Parameterised ¶ms)
set the inner key/value map in map<string, string> format
void setParametersMap(const std::map< std::string, std::string > ¶msMap)
set the inner key/value map in map<string, string> format
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
static bool isValidParameterKey(const std::string &value)
whether the given string is a valid key for a parameter
void updateParameters(const std::map< std::string, std::string > &mapArg)
Adds or updates all given parameters from the map.
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
static bool isValidParameterValue(const std::string &value)
whether the given string is a valid value for a parameter
~Parameterised()
Destructor.
void setParametersStr(const std::string ¶msString)
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
static bool areParametersValid(const std::string &value, bool report=false)
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void unsetParameter(const std::string &key)
Removes a parameter.
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
void clearParameter()
Clears the parameter map.
std::vector< std::string > getVector()
return vector of strings
std::map< std::string, std::string > myMap
The key->value map.
double getDouble(const std::string &key, const double defaultValue) const
Returns the value for a given key converted to a double.
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.