Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ineuray.h
Go to the documentation of this file.
1 /***************************************************************************************************
2  * Copyright 2020 NVIDIA Corporation. All rights reserved.
3  **************************************************************************************************/
6 
7 #ifndef MI_NEURAYLIB_INEURAY_H
8 #define MI_NEURAYLIB_INEURAY_H
9 
11 
12 // X11/Xlib.h defines Status to int
13 #if defined(_XLIB_H_) || defined(_X11_XLIB_H_)
14 #undef Status
15 #endif // _XLIB_H_ || _X11_XLIB_H_
16 
17 namespace mi {
18 
19 namespace neuraylib {
20 
40 class INeuray : public
43  mi::base::Interface_declare<0xd075e1bd,0x6d30,0x43bc,0xbd,0x9c,0x15,0x3f,0x3c,0x30,0xc2,0xce>
44 {
45 public:
49  virtual Uint32 get_interface_version() const = 0;
50 
55  virtual const char* get_version() const = 0;
56 
57  // Startup and shutdown
58 
87  virtual Sint32 start( bool blocking = true) = 0;
88 
92  enum Status
93  {
97  STARTING = 1,
99  STARTED = 2,
103  SHUTDOWN = 4,
105  FAILURE = 5,
106  // Undocumented, for alignment only.
107  FORCE_32_BIT = 0xffffffffU
108  };
109 
132  virtual Sint32 shutdown( bool blocking = true) = 0;
133 
137  virtual Status get_status() const = 0;
138 
149  virtual base::IInterface* get_api_component( const base::Uuid& uuid) const = 0;
150 
163  template<class T>
164  T* get_api_component() const
165  {
166  base::IInterface* ptr_iinterface = get_api_component( typename T::IID());
167  if ( !ptr_iinterface)
168  return 0;
169  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
170  ptr_iinterface->release();
171  return ptr_T;
172  }
173 
188  const base::Uuid& uuid, base::IInterface* api_component) = 0;
189 
204  template<class T>
205  Sint32 register_api_component( T* api_component)
206  {
207  return register_api_component( typename T::IID(), api_component);
208  }
209 
218  virtual Sint32 unregister_api_component( const base::Uuid& uuid) = 0;
219 
231  template<class T>
233  {
234  return unregister_api_component( typename T::IID());
235  }
236 };
237 
238 mi_static_assert( sizeof( INeuray::Status) == sizeof( Uint32));
239  // end group mi_neuray_ineuray
241 
242 } // namespace neuraylib
243 
244 } // namespace mi
245 
246 // X11/Xlib.h defines Status to int
247 #if defined(_XLIB_H_) || defined(_X11_XLIB_H_)
248 #define Status int
249 #endif // _XLIB_H_ || _X11_XLIB_H_
250 
251 #endif // MI_NEURAYLIB_INEURAY_H