Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
idynamic_array.h
Go to the documentation of this file.
1 /***************************************************************************************************
2  * Copyright 2020 NVIDIA Corporation. All rights reserved.
3  **************************************************************************************************/
6 
7 #ifndef MI_NEURAYLIB_IDYNAMIC_ARRAY_H
8 #define MI_NEURAYLIB_IDYNAMIC_ARRAY_H
9 
10 #include <mi/neuraylib/iarray.h>
11 
12 namespace mi {
13 
14 namespace neuraylib { class IFactory; }
15 
20 class IDynamic_array :
34  public base::Interface_declare<0x575af5ad,0xc7c8,0x44a1,0x92,0xb2,0xe5,0x5d,0x5b,0x9a,0x90,0xff,
35  IArray>
36 {
37 public:
47  virtual void set_length( Size size) = 0;
48 
57  virtual void clear() = 0;
58 
71  virtual Sint32 insert( Size index, base::IInterface* element) = 0;
72 
84  virtual Sint32 erase( Size index) = 0;
85 
97  virtual Sint32 push_back( base::IInterface* element) = 0;
98 
108  virtual Sint32 pop_back() = 0;
109 
113  virtual const base::IInterface* back() const = 0;
114 
124  template<class T>
125  const T* back() const
126  {
127  const base::IInterface* ptr_iinterface = back();
128  if ( !ptr_iinterface)
129  return 0;
130  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
131  ptr_iinterface->release();
132  return ptr_T;
133  }
134 
138  virtual base::IInterface* back() = 0;
139 
149  template<class T>
150  T* back()
151  {
152  base::IInterface* ptr_iinterface = back();
153  if ( !ptr_iinterface)
154  return 0;
155  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
156  ptr_iinterface->release();
157  return ptr_T;
158  }
159 
163  virtual const base::IInterface* front() const = 0;
164 
174  template<class T>
175  const T* front() const
176  {
177  const base::IInterface* ptr_iinterface = front();
178  if ( !ptr_iinterface)
179  return 0;
180  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
181  ptr_iinterface->release();
182  return ptr_T;
183  }
184 
188  virtual base::IInterface* front() = 0;
189 
199  template<class T>
200  T* front()
201  {
202  base::IInterface* ptr_iinterface = front();
203  if ( !ptr_iinterface)
204  return 0;
205  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
206  ptr_iinterface->release();
207  return ptr_T;
208  }
209 };
210  // end group mi_neuray_collections
212 
213 } // namespace mi
214 
215 #endif // MI_NEURAYLIB_IDYNAMIC_ARRAY_H