MaterialX 1.38.10
Loading...
Searching...
No Matches
TypedValue< T > Class Template Reference

The class template for typed subclasses of Value. More...

#include <Value.h>

Inheritance diagram for TypedValue< T >:
Value

Public Member Functions

 TypedValue (const T &value)
 
ValuePtr copy () const override
 Create a deep copy of the value. More...
 
void setData (const T &value)
 Set stored data object.
 
void setData (const TypedValue< T > &value)
 Set stored data object.
 
const T & getData () const
 Return stored data object.
 
const string & getTypeString () const override
 Return type string. More...
 
string getValueString () const override
 Return value string. More...
 
- Public Member Functions inherited from Value
virtual ValuePtr copy () const =0
 Create a deep copy of the value. More...
 
template<class T >
bool isA () const
 Return true if this value is of the given type.
 
template<class T >
const T & asA () const
 Return our underlying data as an object of the given type. More...
 

Static Public Member Functions

static ValuePtr createFromString (const string &value)
 Create a new value of this type from a value string. More...
 
- Static Public Member Functions inherited from Value
template<class T >
static ValuePtr createValue (const T &data)
 Create a new value from an object of any valid MaterialX type.
 
static ValuePtr createValue (const char *data)
 
static ValuePtr createValueFromStrings (const string &value, const string &type)
 Create a new value instance from value and type strings. More...
 
static void setFloatFormat (FloatFormat format)
 Set float formatting for converting values to strings. More...
 
static void setFloatPrecision (int precision)
 Set float precision for converting values to strings.
 
static FloatFormat getFloatFormat ()
 Return the current float format.
 
static int getFloatPrecision ()
 Return the current float precision.
 

Static Public Attributes

static const string TYPE
 

Additional Inherited Members

- Public Types inherited from Value
enum  FloatFormat { FloatFormatDefault = 0 , FloatFormatFixed = 1 , FloatFormatScientific = 2 }
 Float formats to use when converting values to strings.
 
- Protected Types inherited from Value
using CreatorFunction = ValuePtr(*)(const string &)
 
using CreatorMap = std::unordered_map< string, CreatorFunction >
 

Detailed Description

template<class T>
class TypedValue< T >

The class template for typed subclasses of Value.

Member Function Documentation

◆ copy()

ValuePtr copy ( ) const
inlineoverridevirtual

Create a deep copy of the value.

Implements Value.

◆ createFromString()

ValuePtr createFromString ( const string &  value)
static

Create a new value of this type from a value string.

Returns
A shared pointer to a typed value, or an empty shared pointer if the conversion to the given data type cannot be performed.

◆ getTypeString()

const string & getTypeString ( ) const
overridevirtual

Return type string.

Implements Value.

◆ getValueString()

string getValueString ( ) const
overridevirtual

Return value string.

Implements Value.


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