ISIS Core Library 0.7.2 (api 3.0.0)
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions

isis::util::Value< TYPE > Class Template Reference

Generic class for type aware variables. More...

#include <value.hpp>

Inheritance diagram for isis::util::Value< TYPE >:
isis::util::ValueBase isis::util::_internal::GenericValue

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

ValueBaseclone () const
 Create a copy of this.

Detailed Description

template<typename TYPE>
class isis::util::Value< TYPE >

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

Definition at line 159 of file value.hpp.


Constructor & Destructor Documentation

template<typename TYPE>
isis::util::Value< TYPE >::Value ( ) [inline]

Definition at line 169 of file value.hpp.

template<typename TYPE>
template<typename T >
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.

  • The lexical cast is _not_ a conversion so no rounding or range check is done
  • _All_ types which can be lexically casted are allowed, not only types known to isis. But not all types will work.
  • If the lexical cast fails, boost::bad_lexical_cast is thrown.

Definition at line 180 of file value.hpp.

template<typename TYPE>
virtual isis::util::Value< TYPE >::~Value ( ) [inline, virtual]

Definition at line 292 of file value.hpp.


Member Function Documentation

template<typename TYPE>
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.

Returns:
a ValueBase-pointer to a newly created Value/ValueArray.

Implements isis::util::ValueBase.

Definition at line 164 of file value.hpp.

template<typename TYPE>
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.

Return values:
value_of_this==converted_value_of_refif the conversion was successfull
falseif the conversion failed because the value of ref was to low for TYPE (negative overflow)
falseif the conversion failed because the value of ref was to high for TYPE (positive overflow)
falseif there is no know conversion from ref to TYPE

Implements isis::util::ValueBase.

Definition at line 287 of file value.hpp.

template<typename TYPE>
unsigned short isis::util::Value< TYPE >::getTypeID ( ) const [inline, virtual]
Returns:
the ID of its actual type

Implements isis::util::_internal::GenericValue.

Definition at line 209 of file value.hpp.

template<typename TYPE>
std::string isis::util::Value< TYPE >::getTypeName ( ) const [inline, virtual]
Returns:
the name of its actual type

Implements isis::util::_internal::GenericValue.

Definition at line 208 of file value.hpp.

template<typename TYPE>
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.

Return values:
value_of_this>converted_value_of_refif the conversion was successfull
trueif the conversion failed because the value of ref was to low for TYPE (negative overflow)
falseif the conversion failed because the value of ref was to high for TYPE (positive overflow)
falseif there is no know conversion from ref to TYPE

Implements isis::util::ValueBase.

Definition at line 259 of file value.hpp.

template<typename TYPE>
bool isis::util::Value< TYPE >::isFloat ( ) const [inline, virtual]
Returns:
true if the type is a floating point scalar

Implements isis::util::_internal::GenericValue.

Definition at line 210 of file value.hpp.

template<typename TYPE>
bool isis::util::Value< TYPE >::isInteger ( ) const [inline, virtual]
Returns:
true if the type is a integral scalar

Implements isis::util::_internal::GenericValue.

Definition at line 211 of file value.hpp.

template<typename TYPE>
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.

Return values:
value_of_this<converted_value_of_refif the conversion was successfull
falseif the conversion failed because the value of ref was to low for TYPE (negative overflow)
trueif the conversion failed because the value of ref was to high for TYPE (positive overflow)
falseif there is no know conversion from ref to TYPE

Implements isis::util::ValueBase.

Definition at line 273 of file value.hpp.

template<typename TYPE>
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.

Returns:
a const reference to the stored value

Definition at line 235 of file value.hpp.

template<typename TYPE>
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.

Returns:
a reference to the stored value

Definition at line 248 of file value.hpp.

template<typename TYPE>
virtual bool isis::util::Value< TYPE >::operator== ( const ValueBase second) const [inline, virtual]
Returns:
true if and only if this and second do contain the same value of the same type

Implements isis::util::ValueBase.

Definition at line 214 of file value.hpp.

template<typename TYPE>
static std::string isis::util::Value< TYPE >::staticName ( ) [inline, static]
Returns:
the name of the type

Definition at line 222 of file value.hpp.

template<typename TYPE>
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.

Parameters:
labeledif true the typename will be appended to the resulting string in brackets.

Implements isis::util::_internal::GenericValue.

Definition at line 192 of file value.hpp.


Field Documentation

template<typename TYPE>
const unsigned short isis::util::Value< TYPE >::staticID = _internal::TypeID<TYPE>::value [static]

Definition at line 168 of file value.hpp.


The documentation for this class was generated from the following file: