neuray API Programmer's Manual

imdl_execution_context.h File Reference

Description

The MDL execution context and the IMessage class.

Code Example

imdl_execution_context.h

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

#ifndef MI_NEURAYLIB_IMDL_EXECUTION_CONTEXT_H
#define MI_NEURAYLIB_IMDL_EXECUTION_CONTEXT_H

#include <mi/base/interface_declare.h>
#include <mi/base/enums.h>
#include <mi/base/handle.h>

namespace mi {

namespace neuraylib {



class IMessage: public
    base::Interface_declare<0x51965a01,0xcd3f,0x41fc,0xb1,0x8b,0x8,0x1c,0x7b,0x4b,0xba,0xb2>
{
public:

    enum Kind {

        MSG_COMILER_CORE,
        MSG_COMILER_BACKEND,
        MSG_COMPILER_DAG,
        MSG_COMPILER_ARCHIVE_TOOL,
        MSG_IMP_EXP,
        MSG_INTEGRATION,
        MSG_UNCATEGORIZED,
        //  Undocumented, for alignment only.
        MSG_FORCE_32_BIT = 0xffffffffU
    };

    virtual Kind 
               get_kind() const = 0;

    virtual base::Message_severity 
               get_severity() const = 0;

    virtual const char* get_string() const = 0;

    virtual Sint32 
               get_code() const = 0;

    virtual Size 
               get_notes_count() const = 0;

    virtual const IMessage* get_note( Size index) const = 0;
};

class IMdl_execution_context: public
    base::Interface_declare<0x28eb1f99,0x138f,0x4fa2,0xb5,0x39,0x17,0xb4,0xae,0xfb,0x1b,0xca>
{
public:



    virtual Size 
               get_messages_count() const = 0;

    virtual Size 
               get_error_messages_count() const = 0;

    virtual const IMessage* get_message( Size index) const = 0;

    virtual const IMessage* get_error_message( Size index) const = 0;

    virtual void clear_messages() = 0;

    virtual void add_message(
        IMessage::Kind kind,
        base::Message_severity severity,
        Sint32 code,
        const char* message) = 0;




    virtual Size 
               get_option_count() const = 0;

    virtual const char* get_option_name( Size index) const = 0;

    virtual const char* get_option_type( const char* name) const = 0;

    virtual Sint32 
               get_option( const char* name, const char*& value) const = 0;

    virtual Sint32 
               get_option( const char* name, Sint32& value) const = 0;

    virtual Sint32 
               get_option( const char* name, Float32& value) const = 0;

    virtual Sint32 
               get_option( const char* name, bool& value) const = 0;

    virtual Sint32 
               get_option( const char* name, const base::IInterface** value) const = 0;

    template<typename T>
    const T* get_option( const char* name, Sint32& return_code)
    {
        const base::IInterface* pointer = 0;
        return_code = get_option( name, &pointer);
        if( return_code != 0 || !pointer)
            return 0;

        base::Handle< const base::IInterface> handle( pointer);
        const T* pointer_T = pointer->get_interface<T>();
        if( !pointer_T) {
            return_code = -2;
            return 0;
        }

        return pointer_T;
    }

    virtual Sint32 
               set_option( const char* name, const char* value) = 0;

    virtual Sint32 
               set_option( const char* name, Sint32 value) = 0;

    virtual Sint32 
               set_option( const char* name, Float32 value) = 0;

    virtual Sint32 
               set_option( const char* name, bool value) = 0;

    virtual Sint32 
               set_option( const char* name, const base::IInterface* value) = 0;

};

 // end group mi_neuray_mdl_misc

} // namespace neuraylib
} // namespace mi

#endif // MI_NEURAYLIB_IMDL_EXECUTION_CONTEXT_H

Namespaces

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

Classes

class 
The execution context can be used to query status information like error and warning messages concerning the operation it was passed into. More...
class 
Message interface. More...