ISIS Core Library 0.7.2 (api 3.0.0)
|
#include <value_base.hpp>
Public Types | |
typedef _internal::ValueConverterMap::mapped_type::mapped_type | Converter |
typedef _internal::GenericReference < ValueBase > | Reference |
Public Member Functions | |
template<class T > | |
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 Converter & | getConverterTo (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 ValueBase * | clone () const =0 |
Create a copy of this. | |
Friends | |
class | _internal::GenericReference< ValueBase > |
Definition at line 69 of file value_base.hpp.
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.
_internal isis::util::ValueBase::~ValueBase | ( | ) | [virtual] |
Definition at line 30 of file value_base.cpp.
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);
Definition at line 114 of file value_base.hpp.
T & isis::util::ValueBase::castTo | ( | ) |
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.
util::Value< T > & isis::util::ValueBase::castToType | ( | ) |
const util::Value< T > & isis::util::ValueBase::castToType | ( | ) | const |
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.
Implemented in isis::util::Value< TYPE >.
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.
from | the Value-object containing the value which should be converted |
to | the Value-object which will contain the converted value if conversion was successfull |
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.
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 >.
bool isis::util::ValueBase::is | ( | ) | const |
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] |
Implemented in isis::util::Value< TYPE >.
friend class _internal::GenericReference< ValueBase > [friend] |
Definition at line 72 of file value_base.hpp.