+ add the value() method in eoParam used by dae

This commit is contained in:
Caner Candan 2010-12-23 12:22:29 +01:00
commit 5fe07abc6c

View file

@ -169,32 +169,46 @@ public :
eoParam::defValue(getValue()); eoParam::defValue(getValue());
} }
/** Parameter value /** Get a reference on the parameter value
@return parameter value @return parameter value
*/ */
ValueType& value() ValueType& value() { return repValue; }
{ return repValue; }
/** Parameter value /** Get a const reference on the parameter value
@overload @overload
@return parameter value @return parameter value
*/ */
const ValueType& value() const const ValueType& value() const { return repValue; }
{ 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::string getValue(void) const
{ {
std::ostringstream os; std::ostringstream os;
os << repValue; os << repValue;
return os.str(); return os.str();
} }
/** @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 For scalar types the textual represenation is typically quite
straigtforward. straigtforward.
@ -208,10 +222,10 @@ public :
@param _value Textual representation of the new value @param _value Textual representation of the new value
*/ */
void setValue(const std::string& _value) void setValue(const std::string& _value)
{ {
std::istringstream is(_value); std::istringstream is(_value);
is >> repValue; is >> repValue;
} }
protected: protected: