NVIDIA Iray API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
iarray.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_IARRAY_H
9 #define MI_NEURAYLIB_IARRAY_H
10 
11 #include <mi/neuraylib/idata.h>
12 
13 namespace mi {
14 
19 class IArray :
36  public base::Interface_declare<0x329db537,0x9892,0x488c,0xa2,0xf4,0xf5,0x37,0x1a,0x35,0xcf,0x39,
37  IData_collection>
38 {
39 public:
43  virtual Size get_length() const = 0;
44 
50  virtual const base::IInterface* get_element( Size index) const = 0;
51 
63  template<class T>
64  const T* get_element( Size index) const
65  {
66  const base::IInterface* ptr_iinterface = get_element( index);
67  if ( !ptr_iinterface)
68  return 0;
69  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
70  ptr_iinterface->release();
71  return ptr_T;
72  }
73 
79  virtual base::IInterface* get_element( Size index) = 0;
80 
92  template<class T>
93  T* get_element( Size index)
94  {
95  base::IInterface* ptr_iinterface = get_element( index);
96  if ( !ptr_iinterface)
97  return 0;
98  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
99  ptr_iinterface->release();
100  return ptr_T;
101  }
102 
114  virtual Sint32 set_element( Size index, base::IInterface* element) = 0;
115 
119  virtual bool empty() const = 0;
120 };
121  // end group mi_neuray_collections
123 
124 } // namespace mi
125 
126 #endif // MI_NEURAYLIB_IARRAY_H