neuray API Programmer's Manual

iarray.h File Reference

Description

Static array type.

Code Example

iarray.h

‎/***************************************************************************************************
 * Copyright 2023 NVIDIA Corporation. All rights reserved.
 **************************************************************************************************/

#ifndef MI_NEURAYLIB_IARRAY_H
#define MI_NEURAYLIB_IARRAY_H

#include <mi/neuraylib/idata.h>

namespace mi {

















class IArray :
    public base::Interface_declare<0x329db537,0x9892,0x488c,0xa2,0xf4,0xf5,0x37,0x1a,0x35,0xcf,0x39,
                                   IData_collection>
{
public:
    virtual Size 
               get_length() const = 0;

    virtual const base::IInterface* get_element( Size index) const = 0;

    template<class T>
    const T* get_element( Size index) const
    {
        const base::IInterface* ptr_iinterface = get_element( index);
        if ( !ptr_iinterface)
            return 0;
        const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
        ptr_iinterface->release();
        return ptr_T;
    }

    virtual base::IInterface* get_element( Size index) = 0;

    template<class T>
    T* get_element( Size index)
    {
        base::IInterface* ptr_iinterface = get_element( index);
        if ( !ptr_iinterface)
            return 0;
        T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
        ptr_iinterface->release();
        return ptr_T;
    }

    virtual Sint32 
               set_element( Size index, base::IInterface* element) = 0;

    virtual bool empty() const = 0;
};
 // end group mi_neuray_collections

} // namespace mi

#endif // MI_NEURAYLIB_IARRAY_H

Namespaces

namespace 
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...

Classes

class 
This interface represents static arrays, i.e., arrays with a fixed number of elements. More...