NVIDIA Iray API Home  Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ibridge_server.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_IBRIDGE_SERVER_H
9 #define MI_NEURAYLIB_IBRIDGE_SERVER_H
10 
11 #include <mi/base/enums.h>
12 #include <mi/base/handle.h>
14 #include <mi/base/uuid.h>
18 
19 namespace mi {
20 
21 class IString;
22 class IMap;
23 
24 namespace http { class IServer; }
25 
26 namespace neuraylib { class ICanvas; class IImport_result; class ITag_set; }
27 
28 namespace bridge {
29 
30 class IApplication;
31 class IApplication_session_handler;
32 class IElement_set;
33 class IServer_session;
34 class IServer_transaction;
35 class IServer_video_context;
36 
65 class IServer_job : public
79  mi::base::Interface_declare<0x555dea0f,0x4eeb,0x44b9,0xba,0x81,0x5a,0x42,0x3d,0xe5,0xf8,0x30,
80  neuraylib::ISerializable>
81 {
82 public:
116  virtual void execute(
117  IServer_transaction* transaction, neuraylib::ISerializer* serializer) = 0;
118 
123  virtual void cancel() = 0;
124 };
125 
130 template <Uint32 i_id1, Uint16 i_id2, Uint16 i_id3
131 , Uint8 i_id4, Uint8 i_id5, Uint8 i_id6, Uint8 i_id7
132 , Uint8 i_id8, Uint8 i_id9, Uint8 i_id10, Uint8 i_id11
133 , class I = IServer_job>
135 {
136 public:
139 
142 
148  static bool compare_iid( const base::Uuid& iid)
149  {
150  if( iid == IID())
151  return true;
152  return I::compare_iid( iid);
153  }
154 
165  virtual const base::IInterface* get_interface( const base::Uuid& interface_id) const
166  {
167  if( interface_id == IID()) {
168  const Self* self = static_cast<const Self*>( this);
169  self->retain();
170  return self;
171  }
172  return I::get_interface_static( this, interface_id);
173  }
174 
185  virtual base::IInterface* get_interface( const base::Uuid& interface_id)
186  {
187  if( interface_id == IID()) {
188  Self* self = static_cast<Self*>( this);
189  self->retain();
190  return self;
191  }
192  return I::get_interface_static( this, interface_id);
193  }
194 
196 
198  virtual base::Uuid get_class_id() const
199  {
200  return IID();
201  }
202 
204  virtual void serialize( neuraylib::ISerializer* serializer) const
205  {
206  // avoid warnings
207  (void) serializer;
208  }
209 
211  virtual void cancel() { }
212 };
213 
219  mi::base::Interface_declare<0x7796c406,0xff8f,0x423d,0x8f,0x53,0x1a,0x66,0x50,0xcf,0x83,0x86>
220 {
221 public:
226  virtual void transaction_committed_callback() = 0;
227 
238  virtual void transaction_aborted_callback( Sint32 error_code, const char* message) = 0;
239 };
240 
245  mi::base::Interface_declare<0x5ec24e12,0x9ce9,0x4f39,0x9f,0xd5,0x35,0xf1,0xe5,0x41,0x34,0x2e>
246 {
247 public:
259  virtual Sint32 create_snapshot( IServer_transaction* transaction, IString* snapshot_id) = 0;
260 };
261 
267 class IServer_transaction : public
268  mi::base::Interface_declare<0x67fd848e,0xce43,0x4675,0x8b,0x14,0xb2,0x54,0xd,0xd2,0x29,0x63>
269 {
270 public:
272  virtual IServer_session* get_session() const = 0;
273 
276 
284  template<class T>
286  {
288  if ( !ptr_itransaction)
289  return 0;
290  T* ptr_T = static_cast<T*>( ptr_itransaction->get_interface( typename T::IID()));
291  ptr_itransaction->release();
292  return ptr_T;
293  }
294 
310 
322 
343  virtual Sint32 create_snapshot( const char* element, IString* snapshot_id) = 0;
344 
374  const char* element, IString* snapshot_id, IIncremental_snapshot_context** context) = 0;
375 
380  virtual Size get_updated_element_count() const = 0;
381 };
382 
387 {
390 
393 
396 
399 
400  SERVER_SESSION_FORCE_32_BIT = 0xffffffffU
401 };
402 
403 mi_static_assert( sizeof( Server_session_state) == sizeof( Uint32));
404 
410  mi::base::Interface_declare<0x12a50ba1,0x9cfc,0x4a12,0x9a,0x4b,0x52,0x13,0xf6,0x98,0x81,0x11>
411 {
412 public:
414  virtual void session_state_callback( IServer_session* session) = 0;
415 };
416 
421 class IServer_session : public
422  mi::base::Interface_declare<0x42574f4a,0xfab1,0x4fdc,0xa0,0xc7,0x52,0x48,0xba,0xfa,0x8e,0x7d>
423 {
424 public:
426  virtual Server_session_state get_state() const = 0;
427 
429  virtual IApplication* get_application() const = 0;
430 
443  virtual IServer_video_context* get_video_context( Sint32 context_id) = 0;
444 
453  virtual void add_session_state_callback( IServer_session_state_callback* callback) = 0;
454 
461 
463  virtual const char* get_security_token() const = 0;
464 
466  virtual const char* get_session_id() const = 0;
467 };
468 
474  mi::base::Interface_declare<0x8913c078,0xeba2,0x4e0b,0x83,0x44,0x1,0xcb,0x2b,0x57,0x67,0x3c>
475 {
476 public:
485  virtual bool on_session_connect( IServer_session* session) = 0;
486 };
487 
495 class IApplication : public
496  mi::base::Interface_declare<0x84c2d806,0x6e1f,0x402d,0xb2,0xa,0x2f,0xcf,0x47,0xd1,0xf,0x2e>
497 {
498 public:
510  virtual Sint32 register_job(
511  const base::Uuid& job_class_id, neuraylib::IUser_class_factory* factory) = 0;
512 
525  template <class T>
527  {
530  return register_job( typename T::IID(), factory.get());
531  }
532 
539  virtual Sint32 unregister_job( const base::Uuid& job_class_id) = 0;
540 
549  template <class T>
551  {
552  return unregister_job( typename T::IID());
553  }
554 
572  virtual Sint32 set_disk_cache( const char* location) = 0;
573 
577  virtual const char* get_disk_cache() const = 0;
578 
586  virtual Sint32 open() = 0;
587 
594  virtual Sint32 close() = 0;
595 
597  virtual bool is_open() = 0;
598 
610 
613 
630 
637 };
638 
643  mi::base::Interface_declare<0x9a9ceafe,0x876b,0x4647,0xbc,0xae,0xb6,0x4,0x9c,0x7b,0x9,0xfc>
644 {
645 public:
667  neuraylib::ITransaction* transaction,
668  const char* snapshot_id,
669  const IMap* importer_options = 0) = 0;
670 
681  virtual Sint32 remove_snapshot( const char* snapshot_id) = 0;
682 };
683 
687 class IBridge_server : public
688  mi::base::Interface_declare<0x1fd8a3ac,0xa70c,0x4273,0xa9,0x1a,0x67,0x57,0xdf,0xc7,0xa5,0xb>
689 {
690 public:
708  const char* application_path, http::IServer* http_server) = 0;
709 
719  virtual IBridge_snapshot_context* create_snapshot_context( const char* disk_cache) = 0;
720 
722  virtual const char* get_bridge_protocol_version() const = 0;
723 };
724  // end group mi_neuray_bridge_server
726 
727 } // namespace bridge
728 
729 } // namespace mi
730 
731 #endif // MI_NEURAYLIB_IBRIDGE_SERVER_H