Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::Type_traits< I > Struct Template Reference

Type traits relating interfaces, corresponding primitive types, and their type names. More...

Detailed Description

template<typename I>
struct mi::Type_traits< I >

Type traits relating interfaces, corresponding primitive types, and their type names.

These type traits are defined for two types of template arguments, interfaces and primitive types.

If the template parameter is an interface derived from mi::IData:

Note the following special case for the mapping between primitive types:

Example:

template<> struct Type_traits<mi::ISint32>
{
static const char* get_type_name() { return "Sint32"; }
typedef mi::Sint32 Primitive_type;
};

If the template parameter is a primitive type:

  • The static member function get_type_name() returns the type name corresponding to the template parameter, e.g., "Sint32" for the template parameter mi::Sint32.
  • The member typedef Interface_type is defined to the corresponding interface type, e.g., mi::ISint32 for the template parameter mi::Sint32.

Since the set of primitive types is smaller than the set of interfaces the following interfaces do not appear as typedef Interface_type: mi::IColor3, mi::IRef, mi::ISize, and mi::IDifference (plus all interfaces which are not supported as template parameter, see above). In particular, a string value does not provide enough to context to decide whether it represents just a string (mi::IString) or references a DB element (mi::IRef).

Example:

template<> struct Type_traits<mi::Sint32>
{
static const char* get_type_name() { return "Sint32"; };
typedef mi::ISint32 Interface_type;
};
Note
Note that const char* is the only primitive type that does not have value semantics, but pointer semantics.