NVIDIA Iray API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ipointer.h
Go to the documentation of this file.
1 //*****************************************************************************
2 // Copyright 1986, 2014 NVIDIA Corporation. All rights reserved.
3 //*****************************************************************************
6 //*****************************************************************************
7 
8 #ifndef MI_NEURAYLIB_IPOINTER_H
9 #define MI_NEURAYLIB_IPOINTER_H
10 
11 #include <mi/neuraylib/idata.h>
12 
13 namespace mi {
14 
19 class IPointer :
42  public base::Interface_declare<0xd921b94b,0x0b64,0x4da0,0x97,0x95,0xdc,0x4d,0xaf,0x99,0x95,0xd5,
43  IData_simple>
44 {
45 public:
54  virtual Sint32 set_pointer( base::IInterface* pointer) = 0;
55 
57  virtual base::IInterface* get_pointer() const = 0;
58 
68  template<class T>
69  T* get_pointer() const
70  {
71  base::IInterface* ptr_iinterface = get_pointer();
72  if ( !ptr_iinterface)
73  return 0;
74  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
75  ptr_iinterface->release();
76  return ptr_T;
77  }
78 };
79 
101  public base::Interface_declare<0x67bfc3ef,0x7d18,0x406e,0x95,0x3b,0x98,0xe6,0xb2,0x98,0x93,0x39,
102  IData_simple>
103 {
104 public:
113  virtual Sint32 set_pointer( const base::IInterface* pointer) = 0;
114 
116  virtual const base::IInterface* get_pointer() const = 0;
117 
127  template<class T>
128  const T* get_pointer() const
129  {
130  const base::IInterface* ptr_iinterface = get_pointer();
131  if ( !ptr_iinterface)
132  return 0;
133  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
134  ptr_iinterface->release();
135  return ptr_T;
136  }
137 };
138  // end group mi_neuray_simple_types
140 
141 } // namespace mi
142 
143 #endif // MI_NEURAYLIB_IPOINTER_H