Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ipointer.h
Go to the documentation of this file.
1 /***************************************************************************************************
2  * Copyright 2020 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 
12 namespace mi {
13 
18 class IPointer :
41  public base::Interface_declare<0xd921b94b,0x0b64,0x4da0,0x97,0x95,0xdc,0x4d,0xaf,0x99,0x95,0xd5,
42  IData_simple>
43 {
44 public:
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 {
103 public:
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