Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

variant_cast File Reference

#include <osgIntrospection/Value>
#include <osgIntrospection/ReaderWriter>
#include <sstream>

Namespaces

namespace  osgIntrospection

Functions

template<typename T>
variant_cast (const Value &v)
template<typename T>
bool requires_conversion (const Value &v)
template<typename T>
T * extract_raw_data (Value &v)
template<typename T>
const T * extract_raw_data (const Value &v)

Function Documentation

template<typename T>
const T* extract_raw_data const Value &  v  ) 
 

Returns a typed pointer to the data contained in a const Value instance. If the value's type is not identical to type T, a null pointer is returned.

template<typename T>
T* extract_raw_data Value &  v  ) 
 

Returns a typed pointer to the data contained in a Value instance. If the value's type is not identical to type T, a null pointer is returned.

template<typename T>
bool requires_conversion const Value &  v  ) 
 

Returns true if the Value passed as parameter can't be casted to the specified type without a (potentially slow) conversion. Returns false otherwise.

template<typename T>
T variant_cast const Value &  v  ) 
 

Tries to convert an instance of Value to an object of type T. If T is a plain type or a pointer type (either const or non-const), and it matches the type of the value contained in v, then the actual value of type T is returned. If T is a [const] reference type, and its base (non reference) type matches the internal value's type, then a [const] reference to the internal value is returned. If none of the above conditions are met, a conversion is attempted as described in Value::convert() and then variant_cast is called again with the converted value as parameter. If the conversion can't be completed, an exception is thrown. Conversions that attempt to make a const pointer non-const will fail.


Generated on Thu Sep 8 04:57:42 2005 for OpenSceneGraph by  doxygen 1.3.9.1