This interface represents const pointers. More...
Public Member Functions | |
virtual Sint32 | set_pointer (const base::IInterface *pointer)=0 |
Sets the const pointer. More... |
|
virtual const base::IInterface * | get_pointer () const =0 |
Returns the const pointer. More... |
|
template<class T > | |
const T * | get_pointer () const |
Returns the const pointer. More... |
|
Additional Inherited Members | |
Public Types inherited from mi::base::Interface_declare< 0x67bfc3ef, 0x7d18, 0x406e, 0x95, 0x3b, 0x98, 0xe6, 0xb2, 0x98, 0x93, 0x39, 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< 0x67bfc3ef, 0x7d18, 0x406e, 0x95, 0x3b, 0x98, 0xe6, 0xb2, 0x98, 0x93, 0x39, 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... |
|
This interface represents const pointers.
Const pointers in the sense of this interface are const interface pointers, not const
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 const pointer is "Const_pointer<"
, followed by the type name of the target, and finally ">"
, e.g., "Const_pointer<Sint32>"
for a const pointer to an instance of mi::ISint32.
Untyped pointers simply store a const pointer of type mi::base::IInterface. The type name of an untyped const pointer is "Const_pointer<Interface>"
.
The additional level of indirection can be used to use const interface pointers with data collections while maintaining const correctness. E.g., the setters of mi::IData_collection, mi::IArray, mi::IDynamic_array, and mi::IMap take mutable interface pointers. If you want to store a const interface pointer you have to wrap it in an instance of mi::IConst_pointer before using it with these interfaces.
|
pure virtual |
Returns the const pointer.
|
inline |
Returns the const 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.
T | The interface type of the element to return |
|
pure virtual |
Sets the const 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.
pointer
has the wrong type.