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

The interface for creating types. More...

Inheritance diagram for mi::neuraylib::IType_factory:
mi::base::Interface_declare< 0x353803c0, 0x74a6, 0x48ac, 0xab, 0xa1, 0xe4, 0x25, 0x42, 0x1d, 0xa1, 0xbc > mi::base::IInterface

Public Member Functions

virtual const IType_aliascreate_alias (const IType *type, Uint32 modifiers, const char *symbol) const =0
 Creates a new instance of the type alias. More...
 
virtual const IType_boolcreate_bool () const =0
 Creates a new instance of the type boolean. More...
 
virtual const IType_intcreate_int () const =0
 Creates a new instance of the type int. More...
 
virtual const IType_enumcreate_enum (const char *symbol) const =0
 Returns a registered enum type, or NULL if symbol is invalid or unknown. More...
 
virtual const IType_floatcreate_float () const =0
 Creates a new instance of the float type. More...
 
virtual const IType_doublecreate_double () const =0
 Creates a new instance of the double type. More...
 
virtual const IType_stringcreate_string () const =0
 Creates a new instance of the string type. More...
 
virtual const IType_vectorcreate_vector (const IType_atomic *element_type, Size size) const =0
 Creates a new instance of a vector type. More...
 
virtual const IType_matrixcreate_matrix (const IType_vector *column_type, Size columns) const =0
 Creates a new instance of a matrix type. More...
 
virtual const IType_colorcreate_color () const =0
 Creates a new instance of the type color. More...
 
virtual const IType_arraycreate_immediate_sized_array (const IType *element_type, Size size) const =0
 Creates a new instance of an immediate-sized array type. More...
 
virtual const IType_arraycreate_deferred_sized_array (const IType *element_type, const char *size) const =0
 Creates a new instance of a deferred-sized array type. More...
 
virtual const IType_structcreate_struct (const char *symbol) const =0
 Returns a registered struct type, or NULL if symbol is invalid or unknown. More...
 
virtual const IType_texturecreate_texture (IType_texture::Shape shape) const =0
 Creates a new instance of the type texture. More...
 
virtual const IType_light_profilecreate_light_profile () const =0
 Creates a new instance of the type light_profile. More...
 
virtual const
IType_bsdf_measurement
create_bsdf_measurement () const =0
 Creates a new instance of the type bsdf_measurement. More...
 
virtual const IType_bsdfcreate_bsdf () const =0
 Creates a new instance of the type bsdf. More...
 
virtual const IType_hair_bsdfcreate_hair_bsdf () const =0
 Creates a new instance of the type hair_bsdf. More...
 
virtual const IType_edfcreate_edf () const =0
 Creates a new instance of the type edf. More...
 
virtual const IType_vdfcreate_vdf () const =0
 Creates a new instance of the type vdf. More...
 
virtual IType_listcreate_type_list () const =0
 Creates a new type map. More...
 
virtual const IType_enumget_predefined_enum (IType_enum::Predefined_id id) const =0
 Returns a registered enum type, or NULL if id is unknown. More...
 
virtual const IType_structget_predefined_struct (IType_struct::Predefined_id id) const =0
 Returns a registered struct type, or NULL if id is unknown. More...
 
virtual Sint32 compare (const IType *lhs, const IType *rhs) const =0
 Compares two instances of mi::neuraylib::IType. More...
 
virtual Sint32 compare (const IType_list *lhs, const IType_list *rhs) const =0
 Compares two instances of mi::neuraylib::IType_list. More...
 
virtual Sint32 is_compatible (const IType *src, const IType *dst) const =0
 Checks, if two instances of mi::neuraylib::IType are compatible, meaning that src can be casted to dst. More...
 
virtual const IStringdump (const IType *type, Size depth=0) const =0
 Returns a textual representation of a type. More...
 
virtual const IStringdump (const IType_list *list, Size depth=0) const =0
 Returns a textual representation of a type list. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x353803c0, 0x74a6, 0x48ac, 0xab, 0xa1, 0xe4, 0x25, 0x42, 0x1d, 0xa1, 0xbc >
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< 0x353803c0, 0x74a6, 0x48ac, 0xab, 0xa1, 0xe4, 0x25, 0x42, 0x1d, 0xa1, 0xbc >
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 types.

A type factory can be obtained from mi::neuraylib::IMdl_factory::create_type_factory().

Member Function Documentation

virtual Sint32 mi::neuraylib::IType_factory::compare ( const IType lhs,
const IType rhs 
) const
pure virtual

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

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

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::IType_factory::compare ( const IType_list lhs,
const IType_list rhs 
) const
pure virtual

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

The comparison operator for instances of mi::neuraylib::IType_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 types 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 const IType_alias* mi::neuraylib::IType_factory::create_alias ( const IType type,
Uint32  modifiers,
const char *  symbol 
) const
pure virtual

Creates a new instance of the type alias.

virtual const IType_bool* mi::neuraylib::IType_factory::create_bool ( ) const
pure virtual

Creates a new instance of the type boolean.

virtual const IType_bsdf* mi::neuraylib::IType_factory::create_bsdf ( ) const
pure virtual

Creates a new instance of the type bsdf.

virtual const IType_bsdf_measurement* mi::neuraylib::IType_factory::create_bsdf_measurement ( ) const
pure virtual

Creates a new instance of the type bsdf_measurement.

virtual const IType_color* mi::neuraylib::IType_factory::create_color ( ) const
pure virtual

Creates a new instance of the type color.

virtual const IType_array* mi::neuraylib::IType_factory::create_deferred_sized_array ( const IType element_type,
const char *  size 
) const
pure virtual

Creates a new instance of a deferred-sized array type.

virtual const IType_double* mi::neuraylib::IType_factory::create_double ( ) const
pure virtual

Creates a new instance of the double type.

virtual const IType_edf* mi::neuraylib::IType_factory::create_edf ( ) const
pure virtual

Creates a new instance of the type edf.

virtual const IType_enum* mi::neuraylib::IType_factory::create_enum ( const char *  symbol) const
pure virtual

Returns a registered enum type, or NULL if symbol is invalid or unknown.

virtual const IType_float* mi::neuraylib::IType_factory::create_float ( ) const
pure virtual

Creates a new instance of the float type.

virtual const IType_hair_bsdf* mi::neuraylib::IType_factory::create_hair_bsdf ( ) const
pure virtual

Creates a new instance of the type hair_bsdf.

virtual const IType_array* mi::neuraylib::IType_factory::create_immediate_sized_array ( const IType element_type,
Size  size 
) const
pure virtual

Creates a new instance of an immediate-sized array type.

virtual const IType_int* mi::neuraylib::IType_factory::create_int ( ) const
pure virtual

Creates a new instance of the type int.

virtual const IType_light_profile* mi::neuraylib::IType_factory::create_light_profile ( ) const
pure virtual

Creates a new instance of the type light_profile.

virtual const IType_matrix* mi::neuraylib::IType_factory::create_matrix ( const IType_vector column_type,
Size  columns 
) const
pure virtual

Creates a new instance of a matrix type.

Parameters
column_typeThe column type needs to be a vector of either mi::neuraylib::IType_float or mi::neuraylib::IType_double.
columnsThe number of columns, either 2, 3, or 4.
Returns
The corresponding matrix type, or NULL in case of errors.
virtual const IType_string* mi::neuraylib::IType_factory::create_string ( ) const
pure virtual

Creates a new instance of the string type.

virtual const IType_struct* mi::neuraylib::IType_factory::create_struct ( const char *  symbol) const
pure virtual

Returns a registered struct type, or NULL if symbol is invalid or unknown.

virtual const IType_texture* mi::neuraylib::IType_factory::create_texture ( IType_texture::Shape  shape) const
pure virtual

Creates a new instance of the type texture.

virtual IType_list* mi::neuraylib::IType_factory::create_type_list ( ) const
pure virtual

Creates a new type map.

virtual const IType_vdf* mi::neuraylib::IType_factory::create_vdf ( ) const
pure virtual

Creates a new instance of the type vdf.

virtual const IType_vector* mi::neuraylib::IType_factory::create_vector ( const IType_atomic element_type,
Size  size 
) const
pure virtual

Creates a new instance of a vector type.

Parameters
element_typeThe element type needs to be either mi::neuraylib::IType_bool, mi::neuraylib::IType_int, mi::neuraylib::IType_float, or mi::neuraylib::IType_double.
sizeThe number of elements, either 2, 3, or 4.
Returns
The corresponding vector type, or NULL in case of errors.
virtual const IString* mi::neuraylib::IType_factory::dump ( const IType type,
Size  depth = 0 
) const
pure virtual

Returns a textual representation of a type.

The representation of the type might contain line breaks, for example for structures and enums. 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::IType_factory::dump ( const IType_list list,
Size  depth = 0 
) const
pure virtual

Returns a textual representation of a type list.

The representation of the type 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 const IType_enum* mi::neuraylib::IType_factory::get_predefined_enum ( IType_enum::Predefined_id  id) const
pure virtual

Returns a registered enum type, or NULL if id is unknown.

virtual const IType_struct* mi::neuraylib::IType_factory::get_predefined_struct ( IType_struct::Predefined_id  id) const
pure virtual

Returns a registered struct type, or NULL if id is unknown.

virtual Sint32 mi::neuraylib::IType_factory::is_compatible ( const IType src,
const IType dst 
) const
pure virtual

Checks, if two instances of mi::neuraylib::IType are compatible, meaning that src can be casted to dst.

src is compatible with and therefore can be casted to dst, if

  • src and dst are of identical type (see mi::neuraylib::IType_factory::compare()).
  • src and dst are of type mi::neuraylib::IType_struct, have the same number of fields and all fields are compatible.
  • src and dst are of type mi::neuraylib::IType_enum and both enumeration types have the same set of numerical enumeration values. The name of the enumeration values, their order, or whether multiple enumeration value names share the same numerical value do not matter.
  • src and dst are of type mi::neuraylib::IType_array, both arrays have the same size and their element types are compatible.
Parameters
srcThe source type.
dstthe target type to which src is intended to be compatible.
Returns
  • 0 if src can be casted to dst, but src and dst are not of identical type.
  • 1 if src and dst are of identical type.
  • -1 if src cannot be casted to dst.