Add a value(ValueType) method for ValueParam, to directly change the value using the templatized type. Use two intermediate streamstring conversions.
This commit is contained in:
parent
0784db8659
commit
128588b3e2
1 changed files with 30 additions and 16 deletions
|
|
@ -169,23 +169,37 @@ public :
|
|||
eoParam::defValue(getValue());
|
||||
}
|
||||
|
||||
/** Parameter value
|
||||
/** Get a reference on the parameter value
|
||||
|
||||
@return parameter value
|
||||
*/
|
||||
ValueType& value()
|
||||
{ return repValue; }
|
||||
ValueType& value() { return repValue; }
|
||||
|
||||
/** Parameter value
|
||||
/** Get a const reference on the parameter value
|
||||
|
||||
@overload
|
||||
|
||||
@return parameter value
|
||||
*/
|
||||
const ValueType& value() const
|
||||
{ return repValue; }
|
||||
const ValueType& value() const { return repValue; }
|
||||
|
||||
|
||||
/** Change the parameter value
|
||||
*/
|
||||
void value( ValueType val )
|
||||
{
|
||||
// convert to string
|
||||
std::ostringstream os;
|
||||
os << val;
|
||||
|
||||
// convert to ValueType
|
||||
std::istringstream is( os.str() );
|
||||
is >> repValue;
|
||||
}
|
||||
|
||||
|
||||
/** Get the string representation of the value
|
||||
*/
|
||||
std::string getValue(void) const
|
||||
{
|
||||
std::ostringstream os;
|
||||
|
|
@ -194,7 +208,7 @@ public :
|
|||
}
|
||||
|
||||
|
||||
/** @brief Set value according to the speciied string
|
||||
/** @brief Set the value according to the speciied string
|
||||
|
||||
For scalar types the textual represenation is typically quite
|
||||
straigtforward.
|
||||
|
|
|
|||
Reference in a new issue