MDL SDK API nvidia_logo_transpbg.gif Up
mi::neuraylib::IValue_factory Class Referenceabstract

The interface for creating values. More...

#include <ivalue.h>

Inheritance diagram for mi::neuraylib::IValue_factory:

Public Member Functions

Access to related factories.
virtual IType_factoryget_type_factory () const =0
 Returns the type factory associated with this value factory. More...
 
Creation of values and value lists
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 IValuecreate (const IAnnotation *annotation) const =0
 Creates a value observing the range of an "::anno::soft_range()" or an "::anno::hard_range()" annotation. More...
 
template<class T>
T * create (const IAnnotation *annotation) const
 Creates a value observing the range of an "::anno::soft_range()" or an "::anno::hard_range()" annotation. More...
 
virtual IValuecreate (const IType *type, const IAnnotation_block *annotation_block) const =0
 Creates a value observing a potentially present range annotation. More...
 
template<class T>
T * create (const IType *type, const IAnnotation_block *annotation_block) const
 Creates a value observing a potentially present range annotation. More...
 
virtual IValue_listcreate_value_list () const =0
 Creates a new value list. More...
 
Cloning of values and value lists
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...
 
Comparison of values and value lists
virtual Sint32 compare (const IValue *lhs, const IValue *rhs, Float64 epsilon=0.0) const =0
 Compares two instances of mi::neuraylib::IValue. More...
 
virtual Sint32 compare (const IValue_list *lhs, const IValue_list *rhs, Float64 epsilon=0.0) const =0
 Compares two instances of mi::neuraylib::IValue_list. More...
 
Dumping of values and value lists
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...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x82595c0d, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x82595c0d, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed Description

The interface for creating values.

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

See also
mi::neuraylib::IType_factory, mi::neuraylib::IExpression_factory

Member Function Documentation

 clone() [1/3]

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.

 clone() [2/3]

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.

 clone() [3/3]

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.

 compare() [1/2]

virtual Sint32 mi::neuraylib::IValue_factory::compare ( const IValue lhs,
const IValue rhs,
Float64  epsilon = 0.0 
) 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 deferred-sized 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.
epsilonMaximum difference for floating point values to consider them as equal.
Returns
-1 if lhs < rhs, 0 if lhs == rhs, and +1 if lhs > rhs.

 compare() [2/2]

virtual Sint32 mi::neuraylib::IValue_factory::compare ( const IValue_list lhs,
const IValue_list rhs,
Float64  epsilon = 0.0 
) 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.
epsilonMaximum difference for floating point values to consider them as equal.
Returns
-1 if lhs < rhs, 0 if lhs == rhs, and +1 if lhs > rhs.

 create() [1/6]

template<class T>
T * mi::neuraylib::IValue_factory::create ( const IAnnotation annotation) const
inline

Creates a value observing the range of an "::anno::soft_range()" or an "::anno::hard_range()" annotation.

The type of the value is determined by the parameter types of the annotation.

 create() [2/6]

virtual IValue * mi::neuraylib::IValue_factory::create ( const IAnnotation annotation) const
pure virtual

Creates a value observing the range of an "::anno::soft_range()" or an "::anno::hard_range()" annotation.

The type of the value is determined by the parameter types of the annotation.

 create() [3/6]

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

Creates a default-constructed value of the given type.

 create() [4/6]

virtual IValue * mi::neuraylib::IValue_factory::create ( const IType type) const
pure virtual

Creates a default-constructed value of the given type.

 create() [5/6]

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

Creates a value observing a potentially present range annotation.

This method is a convenience wrapper around the other two (template) overloads.

If annotation_block contains an "::anno::soft_range()" or an "::anno::hard_range()" annotation, then this method calls the annotation-based overload with that annotation (where "::anno::soft_range()" has priority over "::anno::hard_range()"). Otherwise, it calls the type-based overload with the given value type.

 create() [6/6]

virtual IValue * mi::neuraylib::IValue_factory::create ( const IType type,
const IAnnotation_block annotation_block 
) const
pure virtual

Creates a value observing a potentially present range annotation.

This method is a convenience wrapper around the other two (non-template) overloads.

If annotation_block contains an "::anno::soft_range()" or an "::anno::hard_range()" annotation, then this method calls the annotation-based overload with that annotation (where "::anno::soft_range()" has priority over "::anno::hard_range()"). Otherwise, it calls the type-based overload with the given value type.

 create_array()

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.

 create_bool()

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

Creates a new value of type boolean.

 create_bsdf_measurement()

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.

 create_color()

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.

 create_double()

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

Creates a new value of type double.

 create_enum()

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.

 create_float()

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

Creates a new value of type float.

 create_int()

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

Creates a new value of type integer.

 create_invalid_df()

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.

 create_light_profile()

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.

 create_matrix()

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.

 create_string()

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.

 create_struct()

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.

 create_texture()

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.

 create_value_list()

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

Creates a new value list.

 create_vector()

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.

 dump() [1/2]

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.

 dump() [2/2]

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.

 get_type_factory()

virtual IType_factory * mi::neuraylib::IValue_factory::get_type_factory ( ) const
pure virtual

Returns the type factory associated with this value factory.