ISIS Core Library 0.7.2 (api 3.0.0)
|
Generic class for type aware variables. More...
#include <value.hpp>
Public Member Functions | |
bool | eq (const ValueBase &ref) const |
Check if the value of this is equal to ref converted to TYPE. | |
unsigned short | getTypeID () const |
std::string | getTypeName () const |
bool | gt (const ValueBase &ref) const |
Check if the value of this is greater than ref converted to TYPE. | |
bool | isFloat () const |
bool | isInteger () const |
bool | lt (const ValueBase &ref) const |
Check if the value of this is less than ref converted to TYPE. | |
operator const TYPE & () const | |
Implicit conversion of Value to its value type. | |
operator TYPE & () | |
Implicit conversion of Value to its value type. | |
virtual bool | operator== (const ValueBase &second) const |
std::string | toString (bool labeled=false) const |
Get the string representation of the Value. | |
Value () | |
template<typename T > | |
Value (const T &value) | |
Create a Value from any type. | |
virtual | ~Value () |
Static Public Member Functions | |
static std::string | staticName () |
Static Public Attributes | |
static const unsigned short | staticID = _internal::TypeID<TYPE>::value |
Protected Member Functions | |
ValueBase * | clone () const |
Create a copy of this. |
Generic class for type aware variables.
Only this generic approach for types makes it possible to handle all the types of Properties for the different data these library can handle. On the other side it's more complex to read and write with these kind of types. Please don't bother about and look carefully at further comments on functionality and examples in use, e.g. with PropertyValue.
For supported types see types.hpp
Another advantage is the available type conversion, for further information how to do this and limitations see type_converter.hpp
isis::util::Value< TYPE >::Value | ( | ) | [inline] |
isis::util::Value< TYPE >::Value | ( | const T & | value | ) | [inline] |
Create a Value from any type.
If the type of the parameter is not the same as the content type of the object, the system tries to do a lexical cast.
virtual isis::util::Value< TYPE >::~Value | ( | ) | [inline, virtual] |
ValueBase* isis::util::Value< TYPE >::clone | ( | ) | const [inline, protected, virtual] |
Create a copy of this.
Creates a new Value/ValueArray an stores a copy of its value there. Makes ValueBase-pointers copyable without knowing their type.
Implements isis::util::ValueBase.
bool isis::util::Value< TYPE >::eq | ( | const ValueBase & | ref | ) | const [inline, virtual] |
Check if the value of this is equal to ref converted to TYPE.
The funktion tries to convert ref to the type of this and compare the result. If there is no conversion an error is send to the debug logging, and false is returned.
value_of_this==converted_value_of_ref | if the conversion was successfull |
false | if the conversion failed because the value of ref was to low for TYPE (negative overflow) |
false | if the conversion failed because the value of ref was to high for TYPE (positive overflow) |
false | if there is no know conversion from ref to TYPE |
Implements isis::util::ValueBase.
unsigned short isis::util::Value< TYPE >::getTypeID | ( | ) | const [inline, virtual] |
Implements isis::util::_internal::GenericValue.
std::string isis::util::Value< TYPE >::getTypeName | ( | ) | const [inline, virtual] |
Implements isis::util::_internal::GenericValue.
bool isis::util::Value< TYPE >::gt | ( | const ValueBase & | ref | ) | const [inline, virtual] |
Check if the value of this is greater than ref converted to TYPE.
The function tries to convert ref to the type of this and compare the result. If there is no conversion an error is send to the debug logging, and false is returned.
value_of_this>converted_value_of_ref | if the conversion was successfull |
true | if the conversion failed because the value of ref was to low for TYPE (negative overflow) |
false | if the conversion failed because the value of ref was to high for TYPE (positive overflow) |
false | if there is no know conversion from ref to TYPE |
Implements isis::util::ValueBase.
bool isis::util::Value< TYPE >::isFloat | ( | ) | const [inline, virtual] |
Implements isis::util::_internal::GenericValue.
bool isis::util::Value< TYPE >::isInteger | ( | ) | const [inline, virtual] |
Implements isis::util::_internal::GenericValue.
bool isis::util::Value< TYPE >::lt | ( | const ValueBase & | ref | ) | const [inline, virtual] |
Check if the value of this is less than ref converted to TYPE.
The funkcion tries to convert ref to the type of this and compare the result. If there is no conversion an error is send to the debug logging, and false is returned.
value_of_this<converted_value_of_ref | if the conversion was successfull |
false | if the conversion failed because the value of ref was to low for TYPE (negative overflow) |
true | if the conversion failed because the value of ref was to high for TYPE (positive overflow) |
false | if there is no know conversion from ref to TYPE |
Implements isis::util::ValueBase.
isis::util::Value< TYPE >::operator const TYPE & | ( | ) | const [inline] |
Implicit conversion of Value to its value type.
Only the actual type is allowed. However, the following is valid:
Value<int> i(5);
float f=i;
In this case the function returns int which is then also implicitely converted to float.
isis::util::Value< TYPE >::operator TYPE & | ( | ) | [inline] |
Implicit conversion of Value to its value type.
Only the actual type is allowed. However, the following is valid:
Value<int> i(5);
float f=i;
In this case the function returns int which is then also implicitely converted to float.
virtual bool isis::util::Value< TYPE >::operator== | ( | const ValueBase & | second | ) | const [inline, virtual] |
Implements isis::util::ValueBase.
static std::string isis::util::Value< TYPE >::staticName | ( | ) | [inline, static] |
std::string isis::util::Value< TYPE >::toString | ( | bool | labeled = false | ) | const [inline, virtual] |
Get the string representation of the Value.
This tries to use the isis type conversion to create a string from the Value. If thats no available, it will fall back to boost::lexical_cast. And it will send a warning to CoreDebug. If the lexical cast fails as well, boost::bad_lexical_cast is thrown.
labeled | if true the typename will be appended to the resulting string in brackets. |
Implements isis::util::_internal::GenericValue.
const unsigned short isis::util::Value< TYPE >::staticID = _internal::TypeID<TYPE>::value [static] |