neuray API Programmer's Manual

iref.h File Reference

Description

Type that holds a reference to a database element.

Code Example

iref.h

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

#ifndef MI_NEURAYLIB_IREF_H
#define MI_NEURAYLIB_IREF_H

#include <mi/neuraylib/idata.h>

namespace mi {





class IRef :
    public base::Interface_declare<0x3572250a,0x605e,0x4b6c,0xa0,0xc3,0xae,0xd5,0x7e,0x24,0x69,0x9b,
                                   IData_simple>
{
public:
    virtual Sint32 
               set_reference( const base::IInterface* db_element) = 0;

    virtual Sint32 
               set_reference( const char* name) = 0;

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

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

    template <class T>
    T* get_reference()
    {
        base::IInterface* ptr_iinterface = get_reference();
        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 char* get_reference_name() const = 0;
};
 // end group mi_neuray_simple_types

} // namespace mi

#endif // MI_NEURAYLIB_IREF_H

Namespaces

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

Classes

class 
A reference is an object that acts as a pointer to other database elements. More...