neuray API Programmer's Manual

idynamic_array.h File Reference

Description

Dynamic array type.

Code Example

idynamic_array.h

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

#ifndef MI_NEURAYLIB_IDYNAMIC_ARRAY_H
#define MI_NEURAYLIB_IDYNAMIC_ARRAY_H

#include <mi/neuraylib/iarray.h>

namespace mi {

namespace neuraylib { class IFactory; }














class IDynamic_array :
    public base::Interface_declare<0x575af5ad,0xc7c8,0x44a1,0x92,0xb2,0xe5,0x5d,0x5b,0x9a,0x90,0xff,
                                   IArray>
{
public:
    virtual void set_length( Size size) = 0;

    virtual void clear() = 0;

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

    virtual Sint32 
               erase( Size index) = 0;

    virtual Sint32 
               push_back( base::IInterface* element) = 0;

    virtual Sint32 
               pop_back() = 0;

    virtual const base::IInterface* back() const = 0;

    template<class T>
    const T* back() const
    {
        const base::IInterface* ptr_iinterface = back();
        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* back() = 0;

    template<class T>
    T* back()
    {
        base::IInterface* ptr_iinterface = back();
        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 const base::IInterface* front() const = 0;

    template<class T>
    const T* front() const
    {
        const base::IInterface* ptr_iinterface = front();
        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* front() = 0;

    template<class T>
    T* front()
    {
        base::IInterface* ptr_iinterface = front();
        if ( !ptr_iinterface)
            return 0;
        T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
        ptr_iinterface->release();
        return ptr_T;
    }
};
 // end group mi_neuray_collections

} // namespace mi

#endif // MI_NEURAYLIB_IDYNAMIC_ARRAY_H

Namespaces

namespace 
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
namespace 
Namespace for the neuray API. More...

Classes

class 
This interface represents dynamic arrays, i.e., arrays with a variable number of elements. More...