61 Parameterised(
const std::map<std::string, std::string>& mapArg);
76 virtual void setParameter(
const std::string& key,
const std::string& value);
99 const std::string
getParameter(
const std::string& key,
const std::string defaultValue =
"")
const;
106 double getDouble(
const std::string& key,
const double defaultValue)
const;
115 std::string
getParametersStr(
const std::string kvsep =
"=",
const std::string sep =
"|")
const;
128 void setParametersStr(
const std::string& paramsString,
const std::string kvsep =
"=",
const std::string sep =
"|");
135 const std::string kvsep =
"=",
const std::string sep =
"|");
140 const std::string& kvsep,
const std::string& sep);
146 std::map<std::string, std::string>
myMap;
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
ParameterisedAttrType
@brie enum for Parameterised type
@ STRING
Parameterised accept strings.
@ DOUBLE
Parameterised only accept doubles.
static bool isParameterValid(const std::string &value, ParameterisedAttrType attrType, const std::string &kvsep, const std::string &sep)
check if given string can be parsed to a parameter of type "key=value"
void unsetParameter(const std::string &key)
Removes a parameter.
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
double getDouble(const std::string &key, const double defaultValue) const
Returns the value for a given key converted to a double.
Parameterised()
Default constructor (for Strings)
void setParameters(const Parameterised ¶ms)
set the inner key/value map in map<string, string> format
void setParametersStr(const std::string ¶msString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
~Parameterised()
Destructor.
void clearParameter()
Clears the parameter map.
const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
std::map< std::string, std::string > myMap
The key->value map.
ParameterisedAttrType myAttrType
parameterised type
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
void updateParameters(const std::map< std::string, std::string > &mapArg)
Adds or updates all given parameters from the map.
void setParametersMap(const std::map< std::string, std::string > ¶msMap)
set the inner key/value map in map<string, string> format
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.