Iray SDK API nvidia_logo_transpbg.gif Up
iarray.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2024 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_IARRAY_H
8#define MI_NEURAYLIB_IARRAY_H
9
10#include <mi/neuraylib/idata.h>
11
12namespace mi {
13
34class IArray :
35 public base::Interface_declare<0x329db537,0x9892,0x488c,0xa2,0xf4,0xf5,0x37,0x1a,0x35,0xcf,0x39,
36 IData_collection>
37{
38public:
42 virtual Size get_length() const = 0;
43
49 virtual const base::IInterface* get_element( Size index) const = 0;
50
62 template<class T>
63 const T* get_element( Size index) const
64 {
65 const base::IInterface* ptr_iinterface = get_element( index);
66 if ( !ptr_iinterface)
67 return 0;
68 const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
69 ptr_iinterface->release();
70 return ptr_T;
71 }
72
78 virtual base::IInterface* get_element( Size index) = 0;
79
91 template<class T>
92 T* get_element( Size index)
93 {
94 base::IInterface* ptr_iinterface = get_element( index);
95 if ( !ptr_iinterface)
96 return 0;
97 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
98 ptr_iinterface->release();
99 return ptr_T;
100 }
101
113 virtual Sint32 set_element( Size index, base::IInterface* element) = 0;
114
118 virtual bool empty() const = 0;
119};
120 // end group mi_neuray_collections
122
123} // namespace mi
124
125#endif // MI_NEURAYLIB_IARRAY_H
This interface represents static arrays, i.e., arrays with a fixed number of elements.
Definition: iarray.h:37
virtual base::IInterface * get_element(Size index)=0
Returns the index -th element of the array.
virtual const base::IInterface * get_element(Size index) const =0
Returns the index -th element of the array.
virtual Sint32 set_element(Size index, base::IInterface *element)=0
Sets the index -th element of the array.
virtual bool empty() const =0
Checks whether the array is empty.
virtual Size get_length() const =0
Returns the size of the array.
const T * get_element(Size index) const
Returns the index -th element of the array.
Definition: iarray.h:63
T * get_element(Size index)
Returns the index -th element of the array.
Definition: iarray.h:92
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:112
signed int Sint32
32-bit signed integer.
Definition: types.h:46
Types.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: neuraylib.h:179