NVIDIA Iray API Home  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 1986, 2016 NVIDIA Corporation. All rights reserved.
3 //*****************************************************************************
6 //*****************************************************************************
7 
8 #ifndef MI_NEURAYLIB_INEURAY_H
9 #define MI_NEURAYLIB_INEURAY_H
10 
12 #include <mi/neuraylib/version.h>
13 
14 // X11/Xlib.h defines Status to int
15 #if defined(_XLIB_H_) || defined(_X11_XLIB_H_)
16 #undef Status
17 #endif // _XLIB_H_ || _X11_XLIB_H_
18 
19 namespace mi {
20 
21 namespace neuraylib {
22 
42 class INeuray : public
45  mi::base::Interface_declare<0x66c653e4,0xc03b,0x4a66,0xad,0x47,0xb0,0x55,0x37,0x94,0x2d,0xd6>
46 {
47 public:
51  virtual Uint32 get_interface_version() const = 0;
52 
57  virtual const char* get_version() const = 0;
58 
59  // Startup and shutdown
60 
88  virtual Sint32 start( bool blocking = true) = 0;
89 
93  enum Status
94  {
98  STARTING = 1,
100  STARTED = 2,
104  SHUTDOWN = 4,
106  FAILURE = 5,
107  // Undocumented, for alignment only.
108  FORCE_32_BIT = 0xffffffffU
109  };
110 
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