MDL SDK 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 2021 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<0xee2d9795,0x3b82,0x41f4,0x92,0xad,0x87,0xba,0xb4,0x2e,0x30,0x04>
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 
86  virtual Sint32 start( bool blocking = true) = 0;
87 
91  enum Status
92  {
96  STARTING = 1,
98  STARTED = 2,
102  SHUTDOWN = 4,
104  FAILURE = 5,
105  // Undocumented, for alignment only.
106  FORCE_32_BIT = 0xffffffffU
107  };
108 
131  virtual Sint32 shutdown( bool blocking = true) = 0;
132 
136  virtual Status get_status() const = 0;
137 
148  virtual base::IInterface* get_api_component( const base::Uuid& uuid) const = 0;
149 
162  template<class T>
163  T* get_api_component() const
164  {
165  base::IInterface* ptr_iinterface = get_api_component( typename T::IID());
166  if ( !ptr_iinterface)
167  return 0;
168  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
169  ptr_iinterface->release();
170  return ptr_T;
171  }
172 
187  const base::Uuid& uuid, base::IInterface* api_component) = 0;
188 
203  template<class T>
204  Sint32 register_api_component( T* api_component)
205  {
206  return register_api_component( typename T::IID(), api_component);
207  }
208 
217  virtual Sint32 unregister_api_component( const base::Uuid& uuid) = 0;
218 
230  template<class T>
232  {
233  return unregister_api_component( typename T::IID());
234  }
235 };
236 
237 mi_static_assert( sizeof( INeuray::Status) == sizeof( Uint32));
238  // end group mi_neuray_ineuray
240 
241 } // namespace neuraylib
242 
243 } // namespace mi
244 
245 // X11/Xlib.h defines Status to int
246 #if defined(_XLIB_H_) || defined(_X11_XLIB_H_)
247 #define Status int
248 #endif // _XLIB_H_ || _X11_XLIB_H_
249 
250 #endif // MI_NEURAYLIB_INEURAY_H