Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
imdl_execution_context.h
Go to the documentation of this file.
1 /***************************************************************************************************
2  * Copyright 2020 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 
14 namespace mi {
15 
16 namespace neuraylib {
17 
18 
23 class IMessage: public
25  base::Interface_declare<0x51965a01,0xcd3f,0x41fc,0xb1,0x8b,0x8,0x1c,0x7b,0x4b,0xba,0xb2>
26 {
27 public:
28 
32  enum Kind {
33 
48  // Undocumented, for alignment only.
49  MSG_FORCE_32_BIT = 0xffffffffU
50  };
51 
53  virtual Kind get_kind() const = 0;
54 
56  virtual base::Message_severity get_severity() const = 0;
57 
59  virtual const char* get_string() const = 0;
60 
62  virtual Sint32 get_code() const = 0;
63 
67  virtual Size get_notes_count() const = 0;
68 
70  virtual const IMessage* get_note(Size index) const = 0;
71 };
72 
102 
104  base::Interface_declare<0x28eb1f99,0x138f,0x4fa2,0xb5,0x39,0x17,0xb4,0xae,0xfb,0x1b,0xca>
105 {
106 public:
107 
109  virtual Size get_messages_count() const = 0;
110 
112  virtual Size get_error_messages_count() const = 0;
113 
115  virtual const IMessage* get_message(Size index) const = 0;
116 
118  virtual const IMessage* get_error_message(Size index) const = 0;
119 
120 
122  virtual Size get_option_count() const = 0;
123 
125  virtual const char* get_option_name(Size index) const = 0;
126 
128  virtual const char* get_option_type(const char* name) const = 0;
129 
137  virtual Sint32 get_option(const char* name, const char*& value) const = 0;
138 
146  virtual Sint32 get_option(const char* name, Float32& value) const = 0;
147 
155  virtual Sint32 get_option(const char* name, bool& value) const = 0;
156 
164  virtual Sint32 get_option(const char* name, base::IInterface** value) const = 0;
165 
173  template<typename T>
174  T* get_option(const char* name, Sint32& return_code)
175  {
176  base::IInterface* pointer;
177  return_code = get_option(name, &pointer);
178  if (!pointer)
179  return NULL;
180 
181  base::Handle<base::IInterface> handle(pointer);
182  base::Handle<T> handle_typed(handle->get_interface<T>());
183  if (!handle_typed)
184  {
185  return_code = -2;
186  return NULL;
187  }
188  handle->retain(); // use this handle for the retain so T has not to be cast
189  return handle_typed.get();
190  }
191 
192 
200  virtual Sint32 set_option(const char* name, const char* value) = 0;
201 
209  virtual Sint32 set_option(const char* name, Float32 value) = 0;
210 
219  virtual Sint32 set_option(const char* name, bool value) = 0;
220 
229  virtual Sint32 set_option(const char* name, base::IInterface* value) = 0;
230 };
231 
232  // end group mi_neuray_mdl_types
234 
235 } // namespace neuraylib
236 } // namespace mi
237 
238 #endif // MI_NEURAYLIB_IMDL_EXECUTION_CONTEXT_H