NVIDIA Iray API Home  Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
iref.h
Go to the documentation of this file.
1 //*****************************************************************************
2 // Copyright 1986, 2016 NVIDIA Corporation. All rights reserved.
3 //*****************************************************************************
6 //*****************************************************************************
7 
8 #ifndef MI_NEURAYLIB_IREF_H
9 #define MI_NEURAYLIB_IREF_H
10 
11 #include <mi/neuraylib/idata.h>
12 
13 namespace mi {
14 
19 class IRef :
33  public base::Interface_declare<0x3572250a,0x605e,0x4b6c,0xa0,0xc3,0xae,0xd5,0x7e,0x24,0x69,0x9b,
34  IData_simple>
35 {
36 public:
53  virtual Sint32 set_reference( const base::IInterface* db_element) = 0;
54 
70  virtual Sint32 set_reference( const char* name) = 0;
71 
73  virtual const base::IInterface* get_reference() const = 0;
74 
84  template <class T>
85  const T* get_reference() const
86  {
87  const base::IInterface* ptr_iinterface = get_reference();
88  if ( !ptr_iinterface)
89  return 0;
90  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
91  ptr_iinterface->release();
92  return ptr_T;
93  }
94 
96  virtual base::IInterface* get_reference() = 0;
97 
107  template <class T>
109  {
110  base::IInterface* ptr_iinterface = get_reference();
111  if ( !ptr_iinterface)
112  return 0;
113  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
114  ptr_iinterface->release();
115  return ptr_T;
116  }
117 
119  virtual const char* get_reference_name() const = 0;
120 };
121  // end group mi_neuray_simple_types
123 
124 } // namespace mi
125 
126 #endif // MI_NEURAYLIB_IREF_H