MDL SDK API nvidia_logo_transpbg.gif Up
mi::IPointer Class Referenceabstract

This interface represents mutable pointers. More...

#include <ipointer.h>

Inheritance diagram for mi::IPointer:

Public Member Functions

virtual Sint32 set_pointer (base::IInterface *pointer)=0
 Sets the pointer. More...
 
virtual base::IInterfaceget_pointer () const =0
 Returns the pointer. More...
 
template<class T>
T * get_pointer () const
 Returns the pointer. More...
 
- Public Member Functions inherited from mi::IData
virtual const char * get_type_name () const =0
 Returns the type name. 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< 0xd921b94b, ... >
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::Interface_declare< 0xc33c5a05, ... >
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::Interface_declare< 0x2e5f84bc, ... >
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< 0xd921b94b, ... >
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::Interface_declare< 0xc33c5a05, ... >
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::Interface_declare< 0x2e5f84bc, ... >
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

This interface represents mutable pointers.

Mutable pointers in the sense of this interface are mutable interface pointers, not void* pointers.

Pointers are either typed or untyped. Typed pointers enforce the target to be of a certain type derived from mi::IData. The type name of a typed mutable pointer is "Pointer<", followed by the type name of the target, and finally ">", e.g., "Pointer<Sint32>" for a mutable pointer to an instance of mi::ISint32.

Untyped pointers simply store a mutable pointer of type mi::base::IInterface. The type name of an untyped mutable pointer is "Pointer<Interface>".

The additional level of indirection can be used to use mutable interface pointers with data collections while maintaining const correctness. E.g., the getters of mi::IData_collection, mi::IArray, mi::IDynamic_array, and mi::IMap return const interface pointers if the instance itself is const. If you want to retrieve a mutable interface pointer from such a collection you have to wrap it in an instance of mi::IPointer before you store it. When you retrieve it from the const collection, you can call get_pointer() to obtain the wrapped mutable interface pointer.

See also
mi::IConst_pointer.

Member Function Documentation

 get_pointer() [1/2]

template<class T>
T * mi::IPointer::get_pointer ( ) const
inline

Returns the pointer.

This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to call mi::base::IInterface::get_interface(const Uuid&) on the returned pointer, since the return type already is a pointer to the type T specified as template parameter.

Template Parameters
TThe interface type of the element to return

 get_pointer() [2/2]

virtual base::IInterface * mi::IPointer::get_pointer ( ) const
pure virtual

Returns the pointer.

 set_pointer()

virtual Sint32 mi::IPointer::set_pointer ( base::IInterface pointer)
pure virtual

Sets the pointer.

Note that a NULL pointer is a valid parameter value that clears the previously set pointer. Subsequent get_pointer() calls will return NULL then.

Returns
  • 0: Success.
  • -1: pointer has the wrong type.