MDL SDK API nvidia_logo_transpbg.gif Up
ipointer.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2022 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_IPOINTER_H
8#define MI_NEURAYLIB_IPOINTER_H
9
10#include <mi/neuraylib/idata.h>
11
12namespace mi {
13
40class IPointer :
41 public base::Interface_declare<0xd921b94b,0x0b64,0x4da0,0x97,0x95,0xdc,0x4d,0xaf,0x99,0x95,0xd5,
42 IData_simple>
43{
44public:
53 virtual Sint32 set_pointer( base::IInterface* pointer) = 0;
54
56 virtual base::IInterface* get_pointer() const = 0;
57
67 template<class T>
68 T* get_pointer() const
69 {
70 base::IInterface* ptr_iinterface = get_pointer();
71 if ( !ptr_iinterface)
72 return 0;
73 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
74 ptr_iinterface->release();
75 return ptr_T;
76 }
77};
78
100 public base::Interface_declare<0x67bfc3ef,0x7d18,0x406e,0x95,0x3b,0x98,0xe6,0xb2,0x98,0x93,0x39,
101 IData_simple>
102{
103public:
112 virtual Sint32 set_pointer( const base::IInterface* pointer) = 0;
113
115 virtual const base::IInterface* get_pointer() const = 0;
116
126 template<class T>
127 const T* get_pointer() const
128 {
129 const base::IInterface* ptr_iinterface = get_pointer();
130 if ( !ptr_iinterface)
131 return 0;
132 const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
133 ptr_iinterface->release();
134 return ptr_T;
135 }
136};
137 // end group mi_neuray_simple_types
139
140} // namespace mi
141
142#endif // MI_NEURAYLIB_IPOINTER_H
This interface represents const pointers.
Definition: ipointer.h:102
virtual const base::IInterface * get_pointer() const =0
Returns the const pointer.
const T * get_pointer() const
Returns the const pointer.
Definition: ipointer.h:127
virtual Sint32 set_pointer(const base::IInterface *pointer)=0
Sets the const pointer.
This interface represents mutable pointers.
Definition: ipointer.h:43
virtual base::IInterface * get_pointer() const =0
Returns the pointer.
virtual Sint32 set_pointer(base::IInterface *pointer)=0
Sets the pointer.
T * get_pointer() const
Returns the pointer.
Definition: ipointer.h:68
The basic extensible interface.
Definition: iinterface.h:103
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
virtual const IInterface * get_interface(const Uuid &interface_id) const =0
Acquires a const interface from another.
virtual Uint32 release() const =0
Decrements the reference count.
signed int Sint32
32-bit signed integer.
Definition: types.h:44
Types.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5