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

isis::util::ValueBase Class Reference

#include <value_base.hpp>

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

Public Types

typedef
_internal::ValueConverterMap::mapped_type::mapped_type 
Converter
typedef
_internal::GenericReference
< ValueBase
Reference

Public Member Functions

template<class T >
as () const
 Interpret the value as value of any (other) type.
template<typename T >
const T & castTo () const
 Dynamically cast the ValueBase up to its actual value of type T.
template<typename T >
T & castTo ()
 Dynamically cast the ValueBase up to its actual value of type T.
template<typename T >
const Value< T > & castToType () const
 Dynamically cast the ValueBase down to its actual Value<T>.
template<typename T >
Value< T > & castToType ()
 Dynamically cast the ValueBase up to its actual Value<T>.
Reference copyByID (unsigned short ID) const
 creates a copy of the stored value using a type referenced by its ID
virtual bool eq (const ValueBase &ref) const =0
bool fitsInto (unsigned short ID) const
 Check if the stored value would also fit into another type referenced by its ID.
const ConvertergetConverterTo (unsigned short ID) const
virtual bool gt (const ValueBase &ref) const =0
template<typename T >
bool is () const
virtual bool lt (const ValueBase &ref) const =0
virtual bool operator== (const ValueBase &second) const =0
virtual ~ValueBase ()

Static Public Member Functions

static bool convert (const ValueBase &from, ValueBase &to)
 Convert the content of one Value to another.

Protected Member Functions

virtual ValueBaseclone () const =0
 Create a copy of this.

Friends

class _internal::GenericReference< ValueBase >

Detailed Description

Definition at line 69 of file value_base.hpp.


Member Typedef Documentation

typedef _internal::ValueConverterMap::mapped_type::mapped_type isis::util::ValueBase::Converter

Definition at line 83 of file value_base.hpp.

Definition at line 82 of file value_base.hpp.


Constructor & Destructor Documentation

_internal isis::util::ValueBase::~ValueBase ( ) [virtual]

Definition at line 30 of file value_base.cpp.


Member Function Documentation

template<class T >
T isis::util::ValueBase::as ( ) const [inline]

Interpret the value as value of any (other) type.

This is a runtime-based cast via automatic conversion.

 ValueBase *mephisto=new Value<std::string>("666");
 int devil=mephisto->as<int>();

If you know the type of source and destination at compile time you should use Value<DEST_TYPE>((SOURCE_TYPE)src).

 Value<std::string> mephisto("666");
 Value<int> devil((std::string)mephisto);
Returns:
this value converted to the requested type if conversion was successfull.

Definition at line 114 of file value_base.hpp.

template<typename T >
T & isis::util::ValueBase::castTo ( )

Dynamically cast the ValueBase up to its actual value of type T.

Referenced version. Will throw std::bad_cast if T is not the actual type. Will send an error if T is not the actual type and _ENABLE_CORE_LOG is true.

Returns:
a reference of the stored value.

Definition at line 310 of file value.hpp.

template<typename T >
const T & isis::util::ValueBase::castTo ( ) const

Dynamically cast the ValueBase up to its actual value of type T.

Constant version. Will throw std::bad_cast if T is not the actual type. Will send an error if T is not the actual type and _ENABLE_CORE_LOG is true.

Returns:
a constant reference of the stored value.

Definition at line 300 of file value.hpp.

template<typename T >
util::Value< T > & isis::util::ValueBase::castToType ( )

Dynamically cast the ValueBase up to its actual Value<T>.

Referenced version. Will throw std::bad_cast if T is not the actual type. Will send an error if T is not the actual type and _ENABLE_CORE_LOG is true.

Returns:
a reference of the Value<T> object.

Definition at line 305 of file value.hpp.

template<typename T >
const util::Value< T > & isis::util::ValueBase::castToType ( ) const

Dynamically cast the ValueBase down to its actual Value<T>.

Constant version. Will throw std::bad_cast if T is not the actual type. Will send an error if T is not the actual type and _ENABLE_CORE_LOG is true.

Returns:
a constant reference of the Value<T> object.

Definition at line 295 of file value.hpp.

virtual ValueBase* isis::util::ValueBase::clone ( ) const [protected, pure 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.

Implemented in isis::util::Value< TYPE >.

bool isis::util::ValueBase::convert ( const ValueBase from,
ValueBase to 
) [static]

Convert the content of one Value to another.

This will use the automatic conversion system to transform the value one Value-Object into another. The types of both objects can be unknown.

Parameters:
fromthe Value-object containing the value which should be converted
tothe Value-object which will contain the converted value if conversion was successfull
Returns:
false if the conversion failed for any reason, true otherwise

Definition at line 47 of file value_base.cpp.

Reference isis::util::ValueBase::copyByID ( unsigned short  ID) const

creates a copy of the stored value using a type referenced by its ID

virtual bool isis::util::ValueBase::eq ( const ValueBase ref) const [pure virtual]

Implemented in isis::util::Value< TYPE >.

bool isis::util::ValueBase::fitsInto ( unsigned short  ID) const

Check if the stored value would also fit into another type referenced by its ID.

Returns:
true if the stored value would fit into the target type, false otherwise

Definition at line 72 of file value_base.cpp.

const ValueBase::Converter & isis::util::ValueBase::getConverterTo ( unsigned short  ID) const

Definition at line 39 of file value_base.cpp.

virtual bool isis::util::ValueBase::gt ( const ValueBase ref) const [pure virtual]

Implemented in isis::util::Value< TYPE >.

template<typename T >
bool isis::util::ValueBase::is ( ) const
Returns:
true is the stored type is T

Definition at line 316 of file value.hpp.

virtual bool isis::util::ValueBase::lt ( const ValueBase ref) const [pure virtual]

Implemented in isis::util::Value< TYPE >.

virtual bool isis::util::ValueBase::operator== ( const ValueBase second) const [pure virtual]
Returns:
true if and only if the types of this and second are equal and the values are equal

Implemented in isis::util::Value< TYPE >.


Friends And Related Function Documentation

friend class _internal::GenericReference< ValueBase > [friend]

Definition at line 72 of file value_base.hpp.


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