Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::neuraylib::IValue_factory Class Referenceabstract

The interface for creating values. More...

Inheritance diagram for mi::neuraylib::IValue_factory:
mi::base::Interface_declare< 0x82595c0d, 0x3687, 0x4b45, 0xa3, 0x38, 0x42, 0x20, 0x02, 0xea, 0x3f, 0x9b > mi::base::IInterface

Public Member Functions

virtual IType_factoryget_type_factory () const =0
 Returns the type factory associated with this value factory. More...
 
virtual IValue_boolcreate_bool (bool value=false) const =0
 Creates a new value of type boolean. More...
 
virtual IValue_intcreate_int (Sint32 value=0) const =0
 Creates a new value of type integer. More...
 
virtual IValue_enumcreate_enum (const IType_enum *type, Size index=0) const =0
 Creates a new value of type enum, or returns NULL in case of errors. More...
 
virtual IValue_floatcreate_float (Float32 value=0.0f) const =0
 Creates a new value of type float. More...
 
virtual IValue_doublecreate_double (Float64 value=0.0) const =0
 Creates a new value of type double. More...
 
virtual IValue_stringcreate_string (const char *value="") const =0
 Creates a new value of type string. More...
 
virtual IValue_vectorcreate_vector (const IType_vector *type) const =0
 Creates a new value of type vector, or returns NULL in case of errors. More...
 
virtual IValue_matrixcreate_matrix (const IType_matrix *type) const =0
 Creates a new value of type matrix, or returns NULL in case of errors. More...
 
virtual IValue_colorcreate_color (Float32 red=0.0f, Float32 green=0.0f, Float32 blue=0.0f) const =0
 Creates a new value of type color. More...
 
virtual IValue_arraycreate_array (const IType_array *type) const =0
 Creates a new value of type array, or returns NULL in case of errors. More...
 
virtual IValue_structcreate_struct (const IType_struct *type) const =0
 Creates a new value of type struct, or returns NULL in case of errors. More...
 
virtual IValue_texturecreate_texture (const IType_texture *type, const char *value) const =0
 Creates a new texture value, or returns NULL in case of errors. More...
 
virtual IValue_light_profilecreate_light_profile (const char *value) const =0
 Creates a new light profile value, or returns NULL in case of errors. More...
 
virtual IValue_bsdf_measurementcreate_bsdf_measurement (const char *value) const =0
 Creates a new BSDF measurement value, or returns NULL in case of errors. More...
 
virtual IValue_invalid_dfcreate_invalid_df (const IType_reference *type) const =0
 Creates a new invalid distribution function value. More...
 
virtual IValuecreate (const IType *type) const =0
 Creates a default-constructed value of the given type. More...
 
template<class T >
T * create (const IType *type) const
 Creates a default-constructed value of the given type. More...
 
virtual IValue_listcreate_value_list () const =0
 Creates a new value list. More...
 
virtual IValueclone (const IValue *value) const =0
 Clones the given value. More...
 
template<class T >
T * clone (const T *value) const
 Clones the given value. More...
 
virtual IValue_listclone (const IValue_list *value_list) const =0
 Clones the given value list. More...
 
virtual Sint32 compare (const IValue *lhs, const IValue *rhs) const =0
 Compares two instances of mi::neuraylib::IValue. More...
 
virtual Sint32 compare (const IValue_list *lhs, const IValue_list *rhs) const =0
 Compares two instances of mi::neuraylib::IValue_list. More...
 
virtual const IStringdump (const IValue *value, const char *name, Size depth=0) const =0
 Returns a textual representation of a value. More...
 
virtual const IStringdump (const IValue_list *list, const char *name, Size depth=0) const =0
 Returns a textual representation of a value list. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x82595c0d, 0x3687, 0x4b45, 0xa3, 0x38, 0x42, 0x20, 0x02, 0xea, 0x3f, 0x9b >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
Self
 Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x82595c0d, 0x3687, 0x4b45, 0xa3, 0x38, 0x42, 0x20, 0x02, 0xea, 0x3f, 0x9b >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 

Detailed Description

The interface for creating values.

A value factory can be obtained from mi::neuraylib::IMdl_factory::create_value_factory().

Member Function Documentation

virtual IValue* mi::neuraylib::IValue_factory::clone ( const IValue value) const
pure virtual

Clones the given value.

Note that referenced DB elements, e.g., resources, are not copied, but shared.

template<class T >
T* mi::neuraylib::IValue_factory::clone ( const T *  value) const
inline

Clones the given value.

Note that referenced DB elements, e.g., resources, are not copied, but shared.

virtual IValue_list* mi::neuraylib::IValue_factory::clone ( const IValue_list value_list) const
pure virtual

Clones the given value list.

Note that referenced DB elements, e.g., resources, are not copied, but shared.

virtual Sint32 mi::neuraylib::IValue_factory::compare ( const IValue lhs,
const IValue rhs 
) const
pure virtual

Compares two instances of mi::neuraylib::IValue.

The comparison operator for instances of mi::neuraylib::IValue is defined as follows:

  • If lhs or rhs is NULL, the result is the lexicographic comparison of the pointer addresses themselves.
  • Otherwise, the types of lhs and rhs are compared. If they are different, the result is determined by that comparison.
  • Next, the kind of the values are compared. If they are different, the result is determined by operator< on the mi::neuraylib::IValue::Kind values.
  • Finally, the values are compared as follows:
    • For atomic types, their values are compared using operator< or strcmp(), with the exception of enums, for which the indices rather than the values are compared.
    • For compounds, the compound size is compared using operator< (the compound size might be different for dynamic arrays). If both compounds are of equal size, the compounds elements are compared in lexicographic order.
    • For resources, the values are compared using strcmp().
Parameters
lhsThe left-hand side operand for the comparison.
rhsThe right-hand side operand for the comparison.
Returns
-1 if lhs < rhs, 0 if lhs == rhs, and +1 if lhs > rhs.
virtual Sint32 mi::neuraylib::IValue_factory::compare ( const IValue_list lhs,
const IValue_list rhs 
) const
pure virtual

Compares two instances of mi::neuraylib::IValue_list.

The comparison operator for instances of mi::neuraylib::IValue_list is defined as follows:

  • If lhs or rhs is NULL, the result is the lexicographic comparison of the pointer addresses themselves.
  • Next, the list sizes are compared using operator<().
  • Next, the lists are traversed by increasing index and the names are compared using strcmp().
  • Finally, the list elements are enumerated by increasing index and the values are compared.
Parameters
lhsThe left-hand side operand for the comparison.
rhsThe right-hand side operand for the comparison.
Returns
-1 if lhs < rhs, 0 if lhs == rhs, and +1 if lhs > rhs.
virtual IValue* mi::neuraylib::IValue_factory::create ( const IType type) const
pure virtual

Creates a default-constructed value of the given type.

template<class T >
T* mi::neuraylib::IValue_factory::create ( const IType type) const
inline

Creates a default-constructed value of the given type.

virtual IValue_array* mi::neuraylib::IValue_factory::create_array ( const IType_array type) const
pure virtual

Creates a new value of type array, or returns NULL in case of errors.

virtual IValue_bool* mi::neuraylib::IValue_factory::create_bool ( bool  value = false) const
pure virtual

Creates a new value of type boolean.

virtual IValue_bsdf_measurement* mi::neuraylib::IValue_factory::create_bsdf_measurement ( const char *  value) const
pure virtual

Creates a new BSDF measurement value, or returns NULL in case of errors.

virtual IValue_color* mi::neuraylib::IValue_factory::create_color ( Float32  red = 0.0f,
Float32  green = 0.0f,
Float32  blue = 0.0f 
) const
pure virtual

Creates a new value of type color.

virtual IValue_double* mi::neuraylib::IValue_factory::create_double ( Float64  value = 0.0) const
pure virtual

Creates a new value of type double.

virtual IValue_enum* mi::neuraylib::IValue_factory::create_enum ( const IType_enum type,
Size  index = 0 
) const
pure virtual

Creates a new value of type enum, or returns NULL in case of errors.

virtual IValue_float* mi::neuraylib::IValue_factory::create_float ( Float32  value = 0.0f) const
pure virtual

Creates a new value of type float.

virtual IValue_int* mi::neuraylib::IValue_factory::create_int ( Sint32  value = 0) const
pure virtual

Creates a new value of type integer.

virtual IValue_invalid_df* mi::neuraylib::IValue_factory::create_invalid_df ( const IType_reference type) const
pure virtual

Creates a new invalid distribution function value.

virtual IValue_light_profile* mi::neuraylib::IValue_factory::create_light_profile ( const char *  value) const
pure virtual

Creates a new light profile value, or returns NULL in case of errors.

virtual IValue_matrix* mi::neuraylib::IValue_factory::create_matrix ( const IType_matrix type) const
pure virtual

Creates a new value of type matrix, or returns NULL in case of errors.

virtual IValue_string* mi::neuraylib::IValue_factory::create_string ( const char *  value = "") const
pure virtual

Creates a new value of type string.

Parameters
valueThe value NULL is handled like the empty string.
virtual IValue_struct* mi::neuraylib::IValue_factory::create_struct ( const IType_struct type) const
pure virtual

Creates a new value of type struct, or returns NULL in case of errors.

virtual IValue_texture* mi::neuraylib::IValue_factory::create_texture ( const IType_texture type,
const char *  value 
) const
pure virtual

Creates a new texture value, or returns NULL in case of errors.

virtual IValue_list* mi::neuraylib::IValue_factory::create_value_list ( ) const
pure virtual

Creates a new value list.

virtual IValue_vector* mi::neuraylib::IValue_factory::create_vector ( const IType_vector type) const
pure virtual

Creates a new value of type vector, or returns NULL in case of errors.

virtual const IString* mi::neuraylib::IValue_factory::dump ( const IValue value,
const char *  name,
Size  depth = 0 
) const
pure virtual

Returns a textual representation of a value.

The textual representation is of the form "type name = value" if name is not NULL, and of the form "value" if name is NULL. The representation of the value might contain line breaks, for example for structures, enums, and arrays. Subsequent lines have a suitable indentation. The assumed indentation level of the first line is specified by depth.

Note
The exact format of the textual representation is unspecified and might change in future releases. The textual representation is primarily meant as a debugging aid. Do not base application logic on it.
virtual const IString* mi::neuraylib::IValue_factory::dump ( const IValue_list list,
const char *  name,
Size  depth = 0 
) const
pure virtual

Returns a textual representation of a value list.

The representation of the value list will contain line breaks. Subsequent lines have a suitable indentation. The assumed indentation level of the first line is specified by depth.

Note
The exact format of the textual representation is unspecified and might change in future releases. The textual representation is primarily meant as a debugging aid. Do not base application logic on it.
virtual IType_factory* mi::neuraylib::IValue_factory::get_type_factory ( ) const
pure virtual

Returns the type factory associated with this value factory.