MDL SDK API nvidia_logo_transpbg.gif Up
imdl_execution_context.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2025 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_IMDL_EXECUTION_CONTEXT_H
8#define MI_NEURAYLIB_IMDL_EXECUTION_CONTEXT_H
9
11#include <mi/base/enums.h>
12#include <mi/base/handle.h>
13
14namespace mi {
15
16namespace neuraylib {
17
18
24class IMessage: public
25 base::Interface_declare<0x51965a01,0xcd3f,0x41fc,0xb1,0x8b,0x8,0x1c,0x7b,0x4b,0xba,0xb2>
26{
27public:
28
33 enum Kind {
34
49 // Undocumented, for alignment only.
50 MSG_FORCE_32_BIT = 0xffffffffU
51 };
52
54 virtual Kind get_kind() const = 0;
55
58
60 virtual const char* get_string() const = 0;
61
63 virtual Sint32 get_code() const = 0;
64
68 virtual Size get_notes_count() const = 0;
69
71 virtual const IMessage* get_note( Size index) const = 0;
72};
73
141 base::Interface_declare<0x28eb1f99,0x138f,0x4fa2,0xb5,0x39,0x17,0xb4,0xae,0xfb,0x1b,0xca>
142{
143public:
144
146
147
149 virtual Size get_messages_count() const = 0;
150
152 virtual Size get_error_messages_count() const = 0;
153
155 virtual const IMessage* get_message( Size index) const = 0;
156
158 virtual const IMessage* get_error_message( Size index) const = 0;
159
161 virtual void clear_messages() = 0;
162
164 virtual void add_message(
165 IMessage::Kind kind,
166 base::Message_severity severity,
167 Sint32 code,
168 const char* message) = 0;
169
171
173
175 virtual Size get_option_count() const = 0;
176
178 virtual const char* get_option_name( Size index) const = 0;
179
181 virtual const char* get_option_type( const char* name) const = 0;
182
191 virtual Sint32 get_option( const char* name, const char*& value) const = 0;
192
201 virtual Sint32 get_option( const char* name, Sint32& value) const = 0;
202
211 virtual Sint32 get_option( const char* name, Float32& value) const = 0;
212
221 virtual Sint32 get_option( const char* name, bool& value) const = 0;
222
231 virtual Sint32 get_option( const char* name, const base::IInterface** value) const = 0;
232
241 template<typename T>
242 const T* get_option( const char* name, Sint32& return_code)
243 {
244 const base::IInterface* pointer = nullptr;
245 return_code = get_option( name, &pointer);
246 if( return_code != 0 || !pointer)
247 return 0;
248
250 const T* pointer_T = pointer->get_interface<T>();
251 if( !pointer_T) {
252 return_code = -2;
253 return 0;
254 }
255
256 return pointer_T;
257 }
258
267 virtual Sint32 set_option( const char* name, const char* value) = 0;
268
277 virtual Sint32 set_option( const char* name, Sint32 value) = 0;
278
287 virtual Sint32 set_option( const char* name, Float32 value) = 0;
288
298 virtual Sint32 set_option( const char* name, bool value) = 0;
299
309 virtual Sint32 set_option( const char* name, const base::IInterface* value) = 0;
310
312};
313
314 // end group mi_neuray_mdl_misc
316
317} // namespace neuraylib
318} // namespace mi
319
320#endif // MI_NEURAYLIB_IMDL_EXECUTION_CONTEXT_H
Handle class template for interfaces, automatizing the lifetime control via reference counting.
Definition: handle.h:112
The basic extensible interface.
Definition: iinterface.h:103
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
The execution context can be used to query status information like error and warning messages concern...
Definition: imdl_execution_context.h:142
virtual Sint32 get_option(const char *name, Sint32 &value) const =0
Returns an int option.
virtual Sint32 set_option(const char *name, const char *value)=0
Sets a string option.
virtual Sint32 get_option(const char *name, Float32 &value) const =0
Returns a float option.
virtual Sint32 set_option(const char *name, bool value)=0
Sets a bool option.
virtual Sint32 set_option(const char *name, Float32 value)=0
Sets a float option.
virtual Sint32 set_option(const char *name, const base::IInterface *value)=0
Sets an interface option.
virtual Size get_error_messages_count() const =0
Returns the number of error messages.
virtual Sint32 set_option(const char *name, Sint32 value)=0
Sets an int option.
virtual Sint32 get_option(const char *name, bool &value) const =0
Returns a bool option.
const T * get_option(const char *name, Sint32 &return_code)
Returns an interface option.
Definition: imdl_execution_context.h:242
virtual Sint32 get_option(const char *name, const char *&value) const =0
Returns a string option.
virtual void clear_messages()=0
Clears all messages.
virtual Size get_messages_count() const =0
Returns the number of messages.
virtual void add_message(IMessage::Kind kind, base::Message_severity severity, Sint32 code, const char *message)=0
Adds a message.
virtual const char * get_option_type(const char *name) const =0
Returns the option type name at index.
virtual Size get_option_count() const =0
Returns the number of supported options.
virtual const char * get_option_name(Size index) const =0
Returns the option name at index.
virtual const IMessage * get_message(Size index) const =0
Returns the message at index or nullptr, if no such index exists.
virtual Sint32 get_option(const char *name, const base::IInterface **value) const =0
Returns an interface option.
virtual const IMessage * get_error_message(Size index) const =0
Returns the error message at index or nullptr, if no such index exists.
Message interface.
Definition: imdl_execution_context.h:26
virtual const char * get_string() const =0
Returns the message string.
virtual Kind get_kind() const =0
Returns the kind of message.
virtual Size get_notes_count() const =0
Returns the number of notes associated with the message.
virtual Sint32 get_code() const =0
Returns a unique identifier for the message.
Kind
The possible kinds of messages.
Definition: imdl_execution_context.h:33
@ MSG_COMILER_CORE
MDL Core compiler message.
Definition: imdl_execution_context.h:36
@ MSG_COMILER_BACKEND
MDL Core compiler backend message.
Definition: imdl_execution_context.h:38
@ MSG_IMP_EXP
MDL import/exporter message (currently unused).
Definition: imdl_execution_context.h:44
@ MSG_COMPILER_ARCHIVE_TOOL
MDL Core archive tool message.
Definition: imdl_execution_context.h:42
@ MSG_INTEGRATION
MDL integration message.
Definition: imdl_execution_context.h:46
@ MSG_UNCATEGORIZED
Uncategorized message.
Definition: imdl_execution_context.h:48
@ MSG_COMPILER_DAG
MDL Core DAG generator message.
Definition: imdl_execution_context.h:40
virtual const IMessage * get_note(Size index) const =0
Returns the note at index or nullptr, if no such index exists.
virtual base::Message_severity get_severity() const =0
Returns the severity of the message.
Basic enums.
virtual const IInterface * get_interface(const Uuid &interface_id) const =0
Acquires a const interface from another.
Message_severity
Constants for possible message severities.
Definition: enums.h:31
int Sint32
32-bit signed integer.
Definition: types.h:46
float Float32
32-bit float.
Definition: types.h:51
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
Smart-pointer handle class for interfaces, const and non-const version.
Mixin class template for deriving new interface declarations.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5