HDK
|
A generic, discriminated value, whose type may be queried dynamically. More...
#include <Value.h>
Public Types | |
enum | FloatFormat { FloatFormatDefault = 0, FloatFormatFixed = 1, FloatFormatScientific = 2 } |
Float formats to use when converting values to strings. More... | |
Public Member Functions | |
Value () | |
virtual | ~Value () |
virtual ValuePtr | copy () const =0 |
Create a deep copy of the value. More... | |
Static Public Member Functions | |
template<class T > | |
static ValuePtr | createValue (const T &data) |
Create a new value from an object of any valid MaterialX type. More... | |
static ValuePtr | createValue (const char *data) |
static ValuePtr | createValueFromStrings (const string &value, const string &type) |
Data Accessors | |
using | CreatorFunction = ValuePtr(*)(const string &) |
Return true if this value is of the given type. More... | |
using | CreatorMap = std::unordered_map< string, CreatorFunction > |
Return true if this value is of the given type. More... | |
template<class T > | |
class | ValueRegistry |
Return true if this value is of the given type. More... | |
template<class T > | |
bool | isA () const |
Return true if this value is of the given type. More... | |
template<class T > | |
const T & | asA () const |
virtual const string & | getTypeString () const =0 |
Return the type string for this value. More... | |
virtual string | getValueString () const =0 |
Return the value string for this value. More... | |
static void | setFloatFormat (FloatFormat format) |
static void | setFloatPrecision (int precision) |
Set float precision for converting values to strings. More... | |
static FloatFormat | getFloatFormat () |
Return the current float format. More... | |
static int | getFloatPrecision () |
Return the current float precision. More... | |
A generic, discriminated value, whose type may be queried dynamically.
|
protected |
|
protected |
enum Value::FloatFormat |
const T& Value::asA | ( | ) | const |
Return our underlying data as an object of the given type. If the given type doesn't match our own data type, then an exception is thrown.
|
pure virtual |
Create a deep copy of the value.
Implemented in TypedValue< T >.
|
inlinestatic |
Create a new value instance from value and type strings.
|
inlinestatic |
|
inlinestatic |
|
pure virtual |
Return the type string for this value.
Implemented in TypedValue< T >.
|
pure virtual |
Return the value string for this value.
Implemented in TypedValue< T >.
bool Value::isA | ( | ) | const |
Return true if this value is of the given type.
|
inlinestatic |
|
friend |