7#ifndef MI_NEURAYLIB_IBRIDGE_SERVER_H
8#define MI_NEURAYLIB_IBRIDGE_SERVER_H
15#include <mi/neuraylib/itransaction.h>
23namespace http {
class IServer; }
25namespace neuraylib {
class IImport_result;
class IExport_result; }
30class IApplication_session_handler;
33class IServer_transaction;
34class IServer_video_context;
64class IServer_job_info;
80 mi::base::Interface_declare<0x555dea0f,0x4eeb,0x44b9,0xba,0x81,0x5a,0x42,0x3d,0xe5,0xf8,0x30,
81 neuraylib::ISerializable>
140 typedef Server_job<i_id1,i_id2,i_id3,i_id4,i_id5,i_id6,i_id7,i_id8,i_id9,i_id10,i_id11,I> Self;
143 typedef base::Uuid_t<i_id1,i_id2,i_id3,i_id4,i_id5,i_id6,i_id7,i_id8,i_id9,i_id10,i_id11> IID;
154 return I::compare_iid( iid);
169 if( interface_id ==
IID()) {
170 const Self* self =
static_cast<const Self*
>(
this);
174 return I::get_interface_static(
this, interface_id);
189 if( interface_id ==
IID()) {
190 Self* self =
static_cast<Self*
>(
this);
194 return I::get_interface_static(
this, interface_id);
218 mi::base::Interface_declare<0xa28b5525,0x728b,0x447a,0x89,0x9f,0x15,0x64,0xdf,0x14,0xc7,0xdc>
239 T* ptr_T =
static_cast<T*
>( ptr_job->
get_interface(
typename T::IID()));
258 mi::base::Interface_declare<0xde301678,0x11e9,0x4bed,0x9b,0xc3,0x60,0x1e,0xcf,0xa3,0x88,0xa9>
275 mi::base::Interface_declare<0x7796c406,0xff8f,0x423d,0x8f,0x53,0x1a,0x66,0x50,0xcf,0x83,0x86>
301 mi::base::Interface_declare<0x5ec24e12,0x9ce9,0x4f39,0x9f,0xd5,0x35,0xf1,0xe5,0x41,0x34,0x2e>
327 mi::base::Interface_declare<0x67fd848e,0xce43,0x4675,0x8b,0x14,0xb2,0x54,0xd,0xd2,0x29,0x63>
354 if ( !ptr_itransaction)
356 T* ptr_T =
static_cast<T*
>( ptr_itransaction->get_interface(
typename T::IID()));
357 ptr_itransaction->release();
486 SERVER_SESSION_FORCE_32_BIT = 0xffffffffU
496 mi::base::Interface_declare<0x12a50ba1,0x9cfc,0x4a12,0x9a,0x4b,0x52,0x13,0xf6,0x98,0x81,0x11>
505 mi::base::Interface_declare<0xe97c6925,0x780,0x40b7,0x8c,0xc0,0xa9,0x2f,0x73,0xfe,0xb7,0x8
522 mi::base::Interface_declare<0x42574f4a,0xfab1,0x4fdc,0xa0,0xc7,0x52,0x48,0xba,0xfa,0x8e,0x7d>
604 mi::base::Interface_declare<0x8913c078,0xeba2,0x4e0b,0x83,0x44,0x1,0xcb,0x2b,0x57,0x67,0x3c>
626 mi::base::Interface_declare<0x84c2d806,0x6e1f,0x402d,0xb2,0xa,0x2f,0xcf,0x47,0xd1,0xf,0x2e>
773 mi::base::Interface_declare<0x9a9ceafe,0x876b,0x4647,0xbc,0xae,0xb6,0x4,0x9c,0x7b,0x9,0xfc>
799 neuraylib::ITransaction* transaction,
800 const char* snapshot_id,
801 const IMap* importer_options = 0) = 0;
838 neuraylib::ITransaction* transaction,
840 const IMap* exporter_options,
848 mi::base::Interface_declare<0x1fd8a3ac,0xa70c,0x4273,0xa9,0x1a,0x67,0x57,0xdf,0xc7,0xa5,0xb>
868 const char* application_path,
http::IServer* http_server) = 0;
897 neuraylib::ITransaction* transaction,
This interface represents static arrays, i.e., arrays with a fixed number of elements.
Definition: iarray.h:37
This interface represents maps, i.e., a key-value based data structure.
Definition: imap.h:41
A simple string class.
Definition: istring.h:22
Handle class template for interfaces, automatizing the lifetime control via reference counting.
Definition: handle.h:113
The basic extensible interface.
Definition: iinterface.h:103
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
Mixin class template for deriving interface implementations.
Definition: interface_implement.h:41
Class template for a compile-time representation of universally unique identifiers (UUIDs or GUIDs).
Definition: uuid.h:122
Abstract interface that can be used to control which sessions to a Bridge application are established...
Definition: ibridge_server.h:605
virtual bool on_session_connect(IServer_session *session)=0
This method is called when a session to a Bridge application is to be established.
This class represents a Bridge application.
Definition: ibridge_server.h:627
virtual Sint32 unregister_job(const base::Uuid &job_class_id)=0
Unregisters a Bridge job with the application.
virtual IApplication_session_handler * get_session_handler() const =0
Returns the current session handler, or NULL if no session handler has been set.
Sint32 register_job()
Registers a Bridge job with the application.
Definition: ibridge_server.h:656
virtual base::Message_severity get_log_forwarding_limit() const =0
Returns the maximum verbosity of log messages that will be forwarded to the client.
virtual Sint32 register_job(const base::Uuid &job_class_id, neuraylib::IUser_class_factory *factory)=0
Registers a Bridge job with the application.
virtual bool is_open()=0
Indicates whether the application is open, i.e., whether it accepts client sessions.
virtual Sint32 set_log_forwarding_limit(base::Message_severity limit)=0
Sets the maximum verbosity of log messages that will be forwarded to the client.
Sint32 unregister_job()
Unregisters a Bridge job with the application.
Definition: ibridge_server.h:680
virtual const char * get_disk_cache() const =0
Returns the disk cache location.
virtual Sint32 set_session_handler(IApplication_session_handler *handler)=0
Sets the session handler that will be called when clients connect.
virtual Sint32 open()=0
Opens the application so that clients can open sessions to it.
virtual Sint32 set_disk_cache(const char *location)=0
Sets the disk cache to use.
virtual Sint32 close()=0
Closes the application and any open sessions.
API component that serves as entry point for the server-side Bridge API.
Definition: ibridge_server.h:849
virtual IBridge_snapshot_context * create_snapshot_context(const char *disk_cache)=0
Creates a snapshot context for importing or deleting snapshots.
virtual Sint32 calculate_hash(neuraylib::ITransaction *transaction, const char *element, IString *o_hash, Size *o_size)=0
Returns the hash and serialized size for the provided element.
virtual const char * get_bridge_protocol_version() const =0
Returns the Bridge protocol version string.
virtual IApplication * create_application(const char *application_path, http::IServer *http_server)=0
Creates a Bridge application.
Context to import, export, or remove snapshots.
Definition: ibridge_server.h:774
virtual neuraylib::IImport_result * import_snapshot(neuraylib::ITransaction *transaction, const char *snapshot_id, const IMap *importer_options=0)=0
Imports a previously saved snapshot from the disk cache.
virtual neuraylib::IExport_result * export_snapshot(neuraylib::ITransaction *transaction, const IArray *elements, const IMap *exporter_options, IString *snapshot_id)=0
Exports a set of elements to the disk cache.
virtual Sint32 remove_snapshot(const char *snapshot_id)=0
Removes a snapshot from the disk cache.
Context for incremental snapshots.
Definition: ibridge_server.h:302
virtual Sint32 create_snapshot(IServer_transaction *transaction, IString *snapshot_id)=0
Creates an incremental snapshot.
Provides additional information about a bridge job.
Definition: ibridge_server.h:219
T * get_job() const
Returns the Bridge job instance.
Definition: ibridge_server.h:234
virtual const char * get_id() const =0
Returns the id of this job.
virtual IServer_job * get_job() const =0
Returns the Bridge job instance.
virtual base::Uuid get_job_uuid()=0
Returns the universally unique identifier (UUID or GUID) of the Bridge job.
A list of IServer_job instances.
Definition: ibridge_server.h:259
virtual IServer_job_info * get_job(Size index)=0
Returns the job at the given index, or 0 if the index is out of bounds.
virtual Size get_size()=0
Returns the number of jobs in the list.
Represents the server-side part of a job that can be executed by the Bridge server.
Definition: ibridge_server.h:82
virtual void execute(IServer_transaction *transaction, neuraylib::ISerializer *serializer, IServer_job_info *job_info)=0
Executes a job on behalf of a Bridge client.
virtual void cancel()=0
Called if the Bridge transaction is aborted or if an error occurs.
Abstract interface for callbacks for session state changes.
Definition: ibridge_server.h:497
virtual void session_state_callback(IServer_session *session)=0
This method is called whenever the session changes its state.
Represents the server side of a Bridge session.
Definition: ibridge_server.h:523
virtual IServer_transaction_list * get_pending_transactions()=0
Returns a list of the currently pending Bridge transactions for this session in the order they were s...
virtual void remove_session_state_callback(IServer_session_state_callback *callback)=0
Removes a previously added session state callback.
virtual const char * get_session_id() const =0
Returns the session ID.
virtual const char * get_security_token() const =0
Returns the security token specified by the client.
virtual Server_session_state get_state() const =0
Returns the state of this session.
virtual const char * get_client_build_number()=0
Returns build number of the client.
virtual IServer_video_context * get_video_context(Sint32 context_id)=0
Returns the video context for a given ID.
virtual IApplication * get_application() const =0
Returns the application this session belongs to.
virtual void add_session_state_callback(IServer_session_state_callback *callback)=0
Adds a session state callback.
virtual const char * get_client_bridge_protocol_version()=0
Returns the client Bridge protocol version.
Abstract interface for callbacks for transaction commit or abort events.
Definition: ibridge_server.h:276
virtual void transaction_aborted_callback(Sint32 error_code, const char *message)=0
This method is called when the Bridge transaction has been aborted.
virtual void transaction_committed_callback()=0
This method is called when the Bridge transaction has been successfully committed.
A list of IServer_transaction instances.
Definition: ibridge_server.h:507
virtual IServer_transaction * get_transaction(Size index)=0
Returns the job at the given index, or 0 if the index is out of bounds.
virtual Size get_size()=0
Returns the number of transactions in the list.
Database transactions started on the client will be automatically mirrored to the server and exposed ...
Definition: ibridge_server.h:328
virtual Size get_updated_element_count() const =0
Returns the number of database elements updated by this transaction so far.
virtual Sint32 create_incremental_snapshot_context(const char *element, IString *snapshot_id, IIncremental_snapshot_context **context)=0
Creates a base snapshot and a context for subsequent incremental snapshots.
virtual Sint32 create_snapshot(const char *element, IString *snapshot_id)=0
Creates a snapshot of some database elements.
T * get_database_transaction() const
Returns the local transaction corresponding to this Bridge transaction.
Definition: ibridge_server.h:351
virtual IServer_session * get_session() const =0
Returns the session of the transaction.
virtual Sint32 remove_transaction_callback(IServer_transaction_callback *callback)=0
Removes a transaction callback.
virtual Sint32 add_transaction_callback(IServer_transaction_callback *callback)=0
Adds a transaction callback.
virtual IServer_job_list * get_pending_jobs() const =0
Returns the list of currently pending jobs for this transaction in the order they will be executed.
virtual neuraylib::ITransaction * get_database_transaction() const =0
Returns the local transaction corresponding to this Bridge transaction, or NULL if this transaction h...
virtual const char * get_id() const =0
Returns the id of this Bridge transaction.
Server-side video context that generates and encodes video frames for the corresponding client-side v...
Definition: ibridge_video_server.h:41
This mixin class provides a default implementation for some of the methods needed by mi::bridge::ISer...
Definition: ibridge_server.h:137
virtual const base::IInterface * get_interface(const base::Uuid &interface_id) const
Acquires a const interface.
Definition: ibridge_server.h:167
static bool compare_iid(const base::Uuid &iid)
Compares the interface ID iid against the interface ID of this interface and its ancestors.
Definition: ibridge_server.h:150
Server_job<i_id1, i_id2, i_id3, i_id4, i_id5, i_id6, i_id7, i_id8, i_id9, i_id10, i_id11, I> Self
Own type.
Definition: ibridge_server.h:140
base::Uuid_t<i_id1, i_id2, i_id3, i_id4, i_id5, i_id6, i_id7, i_id8, i_id9, i_id10, i_id11> IID
Declares the interface ID.
Definition: ibridge_server.h:143
virtual base::IInterface * get_interface(const base::Uuid &interface_id)
Acquires a mutable interface.
Definition: ibridge_server.h:187
virtual base::Uuid get_class_id() const
Returns the class ID corresponding to the template parameters of this mixin class.
Definition: ibridge_server.h:200
virtual void cancel()
Does nothing in the default implementation.
Definition: ibridge_server.h:213
virtual void serialize(neuraylib::ISerializer *serializer) const
Empty body. This method from the base class is not needed for client jobs.
Definition: ibridge_server.h:206
The server builds a framework for the handlers.
Definition: http.h:725
Target for serializing objects to byte streams.
Definition: iserializer.h:171
Abstract interface for user class factories.
Definition: iuser_class_factory.h:31
This mixin class provides a default implementation of the IUser_class_factory interface.
Definition: iuser_class_factory.h:66
#define mi_static_assert(expr)
Compile time assertion that raises a compilation error if the constant expression expr evaluates to f...
Definition: assert.h:65
virtual const IInterface * get_interface(const Uuid &interface_id) const =0
Acquires a const interface from another.
Interface * get() const
Access to the interface. Returns 0 for an invalid interface.
Definition: handle.h:294
virtual Uint32 release() const =0
Decrements the reference count.
virtual Uint32 retain() const
Increments the reference count.
Definition: interface_implement.h:93
Message_severity
Constants for possible message severities.
Definition: enums.h:31
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
unsigned char Uint8
8-bit unsigned integer.
Definition: types.h:47
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
unsigned short Uint16
16-bit unsigned integer.
Definition: types.h:48
signed int Sint32
32-bit signed integer.
Definition: types.h:46
Server_session_state
The different states a server session can be in.
Definition: ibridge_server.h:473
@ SERVER_SESSION_PENDING
The session was disconnected unexpectedly and is waiting for the client to reconnect.
Definition: ibridge_server.h:481
@ SERVER_SESSION_CONNECTING
A client has connected to the application but has not yet been approved.
Definition: ibridge_server.h:475
@ SERVER_SESSION_CLOSED
The session has been closed.
Definition: ibridge_server.h:484
@ SERVER_SESSION_CONNECTED
The session has successfully established a connection to the Bridge application.
Definition: ibridge_server.h:478
Smart-pointer handle class for interfaces, const and non-const version.
Mixin class template for deriving interface implementations.
Serialization of objects to a byte stream.
Abstract interface for factories for user-defined class.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: dice.h:89
A 128 bit representation of a universally unique identifier (UUID or GUID).
Definition: uuid.h:26
A 128 bit representation of a universally unique identifier (UUID or GUID).