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#include <mi/neuraylib/version.h> // for MI_NEURAYLIB_DEPRECATED_ENUM_VALUE
14
15namespace mi {
16
17namespace neuraylib {
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 : Uint32 {
34
37#ifdef MI_NEURAYLIB_DEPRECATED_16_0
38 MSG_COMILER_CORE = MSG_COMPILER_CORE,
39#endif
42#ifdef MI_NEURAYLIB_DEPRECATED_16_0
43 MSG_COMILER_BACKEND = MSG_COMPILER_BACKEND,
44#endif
55 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(MSG_FORCE_32_BIT, 0xffffffffU)
56 };
57
59 virtual Kind get_kind() const = 0;
60
63
65 virtual const char* get_string() const = 0;
66
68 virtual Sint32 get_code() const = 0;
69
73 virtual Size get_notes_count() const = 0;
74
76 virtual const IMessage* get_note( Size index) const = 0;
77};
78
162 base::Interface_declare<0x28eb1f99,0x138f,0x4fa2,0xb5,0x39,0x17,0xb4,0xae,0xfb,0x1b,0xca>
163{
164public:
165
167
168
170 virtual Size get_messages_count() const = 0;
171
173 virtual Size get_error_messages_count() const = 0;
174
176 virtual const IMessage* get_message( Size index) const = 0;
177
179 virtual const IMessage* get_error_message( Size index) const = 0;
180
182 virtual void clear_messages() = 0;
183
185 virtual void add_message(
186 IMessage::Kind kind,
187 base::Message_severity severity,
188 Sint32 code,
189 const char* message) = 0;
190
192
194
196 virtual Size get_option_count() const = 0;
197
199 virtual const char* get_option_name( Size index) const = 0;
200
202 virtual const char* get_option_type( const char* name) const = 0;
203
212 virtual Sint32 get_option( const char* name, const char*& value) const = 0;
213
222 virtual Sint32 get_option( const char* name, Sint32& value) const = 0;
223
232 virtual Sint32 get_option( const char* name, Float32& value) const = 0;
233
242 virtual Sint32 get_option( const char* name, bool& value) const = 0;
243
252 virtual Sint32 get_option( const char* name, const base::IInterface** value) const = 0;
253
262 template<typename T>
263 const T* get_option( const char* name, Sint32& return_code)
264 {
265 const base::IInterface* pointer = nullptr;
266 return_code = get_option( name, &pointer);
267 if( return_code != 0 || !pointer)
268 return 0;
269
271 const T* pointer_T = pointer->get_interface<T>();
272 if( !pointer_T) {
273 return_code = -2;
274 return 0;
275 }
276
277 return pointer_T;
278 }
279
288 virtual Sint32 set_option( const char* name, const char* value) = 0;
289
298 virtual Sint32 set_option( const char* name, Sint32 value) = 0;
299
308 virtual Sint32 set_option( const char* name, Float32 value) = 0;
309
319 virtual Sint32 set_option( const char* name, bool value) = 0;
320
330 virtual Sint32 set_option( const char* name, const base::IInterface* value) = 0;
331
333};
334
335 // end group mi_neuray_mdl_misc
337
338} // namespace neuraylib
339} // namespace mi
340
341#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:163
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:263
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.
Kind
The possible kinds of messages.
Definition: imdl_execution_context.h:33
@ MSG_IMP_EXP
MDL import/exporter message (currently unused).
Definition: imdl_execution_context.h:50
@ MSG_COMPILER_ARCHIVE_TOOL
MDL Core archive tool message.
Definition: imdl_execution_context.h:48
@ MSG_INTEGRATION
MDL integration message.
Definition: imdl_execution_context.h:52
@ MSG_COMPILER_CORE
MDL Core compiler message.
Definition: imdl_execution_context.h:36
@ MSG_UNCATEGORIZED
Uncategorized message.
Definition: imdl_execution_context.h:54
@ MSG_COMPILER_DAG
MDL Core DAG generator message.
Definition: imdl_execution_context.h:46
@ MSG_COMPILER_BACKEND
MDL Core compiler backend message.
Definition: imdl_execution_context.h:41
virtual Sint32 get_code() const =0
Returns a unique identifier for the message.
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:33
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
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
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
Major and minor version number and an optional qualifier.