MDL SDK API nvidia_logo_transpbg.gif Up
idynamic_array.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2022 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
12namespace mi {
13
14namespace neuraylib { class IFactory; }
15
34 public base::Interface_declare<0x575af5ad,0xc7c8,0x44a1,0x92,0xb2,0xe5,0x5d,0x5b,0x9a,0x90,0xff,
35 IArray>
36{
37public:
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
This interface represents dynamic arrays, i.e., arrays with a variable number of elements.
Definition: idynamic_array.h:36
T * back()
Returns the last element of the array.
Definition: idynamic_array.h:150
virtual base::IInterface * front()=0
Returns the first element of the array.
T * front()
Returns the first element of the array.
Definition: idynamic_array.h:200
virtual void clear()=0
Sets the size of the array to zero.
virtual base::IInterface * back()=0
Returns the last element of the array.
virtual Sint32 erase(Size index)=0
Removes the element stored at the given index.
virtual void set_length(Size size)=0
Sets the size of the array to size.
virtual const base::IInterface * back() const =0
Returns the last element of the array.
virtual Sint32 pop_back()=0
Removes the last element from the array and decreases the array size by one.
virtual Sint32 push_back(base::IInterface *element)=0
Stores the given element at the end of the array.
virtual Sint32 insert(Size index, base::IInterface *element)=0
Inserts the given element at the given index.
const T * back() const
Returns the last element of the array.
Definition: idynamic_array.h:125
const T * front() const
Returns the first element of the array.
Definition: idynamic_array.h:175
virtual const base::IInterface * front() const =0
Returns the first element of the array.
The basic extensible interface.
Definition: iinterface.h:103
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
virtual const IInterface * get_interface(const Uuid &interface_id) const =0
Acquires a const interface from another.
virtual Uint32 release() const =0
Decrements the reference count.
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:110
signed int Sint32
32-bit signed integer.
Definition: types.h:44
Static array type.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5