MDL SDK API nvidia_logo_transpbg.gif Up
mi::Type_traits<I> Struct Template Reference

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

#include <type_traits.h>

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;
};
This interface represents mi::Sint32.
Definition: inumber.h:199
signed int Sint32
32-bit signed integer.
Definition: types.h:46
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5
Type traits relating interfaces, corresponding primitive types, and their type names.
Definition: type_traits.h:162

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.