MDL SDK API nvidia_logo_transpbg.gif Up
imdl_execution_context.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2024 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
130 base::Interface_declare<0x28eb1f99,0x138f,0x4fa2,0xb5,0x39,0x17,0xb4,0xae,0xfb,0x1b,0xca>
131{
132public:
133
135
136
138 virtual Size get_messages_count() const = 0;
139
141 virtual Size get_error_messages_count() const = 0;
142
144 virtual const IMessage* get_message( Size index) const = 0;
145
147 virtual const IMessage* get_error_message( Size index) const = 0;
148
150 virtual void clear_messages() = 0;
151
153 virtual void add_message(
154 IMessage::Kind kind,
155 base::Message_severity severity,
156 Sint32 code,
157 const char* message) = 0;
158
160
162
164 virtual Size get_option_count() const = 0;
165
167 virtual const char* get_option_name( Size index) const = 0;
168
170 virtual const char* get_option_type( const char* name) const = 0;
171
180 virtual Sint32 get_option( const char* name, const char*& value) const = 0;
181
190 virtual Sint32 get_option( const char* name, Sint32& value) const = 0;
191
200 virtual Sint32 get_option( const char* name, Float32& value) const = 0;
201
210 virtual Sint32 get_option( const char* name, bool& value) const = 0;
211
220 virtual Sint32 get_option( const char* name, const base::IInterface** value) const = 0;
221
230 template<typename T>
231 const T* get_option( const char* name, Sint32& return_code)
232 {
233 const base::IInterface* pointer = 0;
234 return_code = get_option( name, &pointer);
235 if( return_code != 0 || !pointer)
236 return 0;
237
239 const T* pointer_T = pointer->get_interface<T>();
240 if( !pointer_T) {
241 return_code = -2;
242 return 0;
243 }
244
245 return pointer_T;
246 }
247
256 virtual Sint32 set_option( const char* name, const char* value) = 0;
257
266 virtual Sint32 set_option( const char* name, Sint32 value) = 0;
267
276 virtual Sint32 set_option( const char* name, Float32 value) = 0;
277
287 virtual Sint32 set_option( const char* name, bool value) = 0;
288
298 virtual Sint32 set_option( const char* name, const base::IInterface* value) = 0;
299
301};
302
303 // end group mi_neuray_mdl_misc
305
306} // namespace neuraylib
307} // namespace mi
308
309#endif // MI_NEURAYLIB_IMDL_EXECUTION_CONTEXT_H
Handle class template for interfaces, automatizing the lifetime control via reference counting.
Definition: handle.h:113
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:131
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:231
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 NULL, 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 NULL, 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 NULL, 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
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
float Float32
32-bit float.
Definition: types.h:51
signed int Sint32
32-bit signed integer.
Definition: types.h:46
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