NVIDIA Iray API Home  Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::IPointer Class Referenceabstract

This interface represents mutable pointers. More...

Inheritance diagram for mi::IPointer:
Inheritance graph
[legend]

Public Member Functions

virtual Sint32  set_pointer (base::IInterface *pointer)=0
  Sets the pointer. More...
 
virtual base::IInterface get_pointer () const =0
  Returns the pointer. More...
 
template<class T >
T *  get_pointer () const
  Returns the pointer. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xd921b94b, 0x0b64, 0x4da0, 0x97, 0x95, 0xdc, 0x4d, 0xaf, 0x99, 0x95, 0xd5, IData_simple >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IData_simple
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< 0xd921b94b, 0x0b64, 0x4da0, 0x97, 0x95, 0xdc, 0x4d, 0xaf, 0x99, 0x95, 0xd5, IData_simple >
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

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

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

Returns the pointer.

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
T The interface type of the element to return
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.