45 typedef std::map<std::string, std::string>
Map;
62 virtual void setParameter(
const std::string& key,
const std::string& value);
90 virtual const std::string
getParameter(
const std::string& key,
const std::string defaultValue =
"")
const;
97 double getDouble(
const std::string& key,
const double defaultValue)
const;
106 std::string
getParametersStr(
const std::string kvsep =
"=",
const std::string sep =
"|")
const;
116 void setParametersStr(
const std::string& paramsString,
const std::string kvsep =
"=",
const std::string sep =
"|");
122 static bool areParametersValid(
const std::string& value,
bool report =
false,
const std::string kvsep =
"=",
const std::string sep =
"|");
125 static bool areAttributesValid(
const std::string& value,
bool report =
false,
const std::string kvsep =
"=",
const std::string sep =
"|");
129 static bool isParameterValid(
const std::string& value,
const std::string& kvsep,
const std::string& sep);
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
static bool areAttributesValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to an attributes map "key1=value1|key2=value2|....
static bool isParameterValid(const std::string &value, const std::string &kvsep, const std::string &sep)
check if given string can be parsed to a parameter of type "key=value"
Parameterised::Map myMap
The key->value map.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void unsetParameter(const std::string &key)
Removes a parameter.
bool hasParameter(const std::string &key) const
Returns whether the parameter is set.
std::map< std::string, std::string > Map
parameters map
double getDouble(const std::string &key, const double defaultValue) const
Returns the value for a given key converted to a double.
Parameterised()
Default constructor.
void setParameters(const Parameterised ¶ms)
set the inner key/value map in map<string, string> format
void mergeParameters(const Parameterised::Map &mapArg, const std::string separator=" ", bool uniqueValues=true)
Adds or appends all given parameters from the map.
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"
virtual ~Parameterised()
Destructor.
void clearParameter()
Clears the parameter map.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
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 Parameterised::Map &mapArg)
Adds or updates all given parameters from the map.