neuray API Programmer's Manual

ineuray.h File Reference

Description

Main Neuray API interface.

Code Example

ineuray.h

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

#ifndef MI_NEURAYLIB_INEURAY_H
#define MI_NEURAYLIB_INEURAY_H

#include <mi/base/interface_declare.h>

// X11/Xlib.h defines Status to int
#if defined(_XLIB_H_) || defined(_X11_XLIB_H_)
#undef Status
#endif // _XLIB_H_ || _X11_XLIB_H_

namespace mi {

namespace neuraylib {



class INeuray : public
    mi::base::Interface_declare<0x34b6a7c3,0xf040,0x43ec,0x9b,0x7c,0xc1,0x36,0x2f,0xe7,0x0a,0xaa>
{
public:
    virtual Uint32 
               get_interface_version() const = 0;

    virtual const char* get_version() const = 0;

    // Startup and shutdown

    virtual Sint32 
               start( bool blocking = true) = 0;

    enum Status
    {
        PRE_STARTING     = 0,
        STARTING         = 1,
        STARTED          = 2,
        SHUTTINGDOWN     = 3,
        SHUTDOWN         = 4,
        FAILURE          = 5,
        //  Undocumented, for alignment only.
        FORCE_32_BIT     = 0xffffffffU
    };

    virtual Sint32 
               shutdown( bool blocking = true) = 0;

    virtual Status 
               get_status() const = 0;

    virtual base::IInterface* get_api_component( const base::Uuid& uuid) const = 0;

    template<class T>
    T* get_api_component() const
    {
        base::IInterface* ptr_iinterface = get_api_component( typename T::IID());
        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 
               register_api_component(
        const base::Uuid& uuid, base::IInterface* api_component) = 0;

    template<class T>
    Sint32 
               register_api_component( T* api_component)
    {
        return register_api_component( typename T::IID(), api_component);
    }

    virtual Sint32 
               unregister_api_component( const base::Uuid& uuid) = 0;

    template<class T>
    Sint32 
               unregister_api_component()
    {
        return unregister_api_component( typename T::IID());
    }
};

mi_static_assert( sizeof( INeuray::Status) == sizeof( Uint32));
 // end group mi_neuray_ineuray

} // namespace neuraylib

} // namespace mi

// X11/Xlib.h defines Status to int
#if defined(_XLIB_H_) || defined(_X11_XLIB_H_)
#define Status int
#endif // _XLIB_H_ || _X11_XLIB_H_

#endif // MI_NEURAYLIB_INEURAY_H

Namespaces

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

Classes

class 
This is an object representing the . More...