NVIDIA Iray API
 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 1986, 2014 NVIDIA Corporation. All rights reserved.
3 //*****************************************************************************
6 //*****************************************************************************
7 
8 #ifndef MI_NEURAYLIB_IDYNAMIC_ARRAY_H
9 #define MI_NEURAYLIB_IDYNAMIC_ARRAY_H
10 
11 #include <mi/neuraylib/iarray.h>
12 #include <mi/neuraylib/version.h>
13 
14 namespace mi {
15 
16 namespace neuraylib { class IFactory; }
17 
22 class IDynamic_array :
36  public base::Interface_declare<0x575af5ad,0xc7c8,0x44a1,0x92,0xb2,0xe5,0x5d,0x5b,0x9a,0x90,0xff,
37  IArray>
38 {
39 public:
49  virtual void set_length( Size size) = 0;
50 
59  virtual void clear() = 0;
60 
73  virtual Sint32 insert( Size index, base::IInterface* element) = 0;
74 
86  virtual Sint32 erase( Size index) = 0;
87 
99  virtual Sint32 push_back( base::IInterface* element) = 0;
100 
110  virtual Sint32 pop_back() = 0;
111 
115  virtual const base::IInterface* back() const = 0;
116 
126  template<class T>
127  const T* back() const
128  {
129  const base::IInterface* ptr_iinterface = back();
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 
140  virtual base::IInterface* back() = 0;
141 
151  template<class T>
152  T* back()
153  {
154  base::IInterface* ptr_iinterface = back();
155  if ( !ptr_iinterface)
156  return 0;
157  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
158  ptr_iinterface->release();
159  return ptr_T;
160  }
161 
165  virtual const base::IInterface* front() const = 0;
166 
176  template<class T>
177  const T* front() const
178  {
179  const base::IInterface* ptr_iinterface = front();
180  if ( !ptr_iinterface)
181  return 0;
182  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
183  ptr_iinterface->release();
184  return ptr_T;
185  }
186 
190  virtual base::IInterface* front() = 0;
191 
201  template<class T>
202  T* front()
203  {
204  base::IInterface* ptr_iinterface = front();
205  if ( !ptr_iinterface)
206  return 0;
207  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
208  ptr_iinterface->release();
209  return ptr_T;
210  }
211 
212  virtual Uint32 MI_NEURAYLIB_DEPRECATED_METHOD_5_0(assign_from)(
213  const IData_collection* source) = 0;
214 };
215  // end group mi_neuray_collections
217 
218 } // namespace mi
219 
220 #endif // MI_NEURAYLIB_IDYNAMIC_ARRAY_H