DiCE API nvidia_logo_transpbg.gif Up
ibridge_client.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2023 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_IBRIDGE_CLIENT_H
8#define MI_NEURAYLIB_IBRIDGE_CLIENT_H
9
10#include <mi/base/enums.h>
13
14namespace mi {
15
16class IMap;
17class IString;
18
19namespace base { class ILogger; }
20
21namespace neuraylib {
22class IDeserializer;
23class ITransaction;
24class ITag_set;
25}
26
29namespace bridge {
30
32
95{
98
102
109
116
124
127
128 CLIENT_JOB_FORCE_32_BIT = 0xffffffffU
129};
130
131mi_static_assert( sizeof( Client_job_state) == sizeof( Uint32));
132
135 mi::base::Interface_declare<0x7f51a745,0xfcf0,0x4b2d,0x92,0x93,0x2b,0x84,0xd7,0x8c,0xc0,0xe6>
136{
137public:
141 virtual Client_job_state get_state() const = 0;
142
148 virtual Size get_updated_element_count() const = 0;
149
155
161
165 virtual Size get_cache_miss_count() const = 0;
166
170 virtual Size get_cache_miss_bytes() const = 0;
171
176
181
188
191 virtual const char* get_currently_uploaded_element_name() const = 0;
192
196
200};
201
205class IElement_set : public
206 mi::base::Interface_declare<0x2242471d,0x96f3,0x4962,0x84,0x7e,0xd1,0x20,0xa9,0x6b,0xb6,0x98>
207{
208public:
212 virtual Size get_length() const = 0;
213
217 virtual const char* get_element( Size index) const = 0;
218
220 virtual void add_element( const char* element_name) = 0;
221};
222
238class IClient_job : public
239 mi::base::Interface_declare<0xe02e4aeb,0x6edd,0x4e40,0xbb,0xe0,0x6c,0xc5,0xe7,0x69,0xa6,0xe,
240 neuraylib::ISerializable>
241{
242public:
257 virtual void get_references( neuraylib::ITag_set* result) const = 0;
258
273 virtual void get_references( IElement_set* result) const = 0;
274
285 virtual bool upload_only() const = 0;
286
302 neuraylib::IDeserializer* deserializer, bool last_result) = 0;
303
314 virtual void progress_callback( IClient_job_progress* job_progress) = 0;
315
324 virtual void error_callback( Sint32 error_code, const char* msg) = 0;
325};
326
331template <Uint32 i_id1, Uint16 i_id2, Uint16 i_id3
332, Uint8 i_id4, Uint8 i_id5, Uint8 i_id6, Uint8 i_id7
333, Uint8 i_id8, Uint8 i_id9, Uint8 i_id10, Uint8 i_id11
334, class I = IClient_job>
336{
337public:
340
343
349 static bool compare_iid( const base::Uuid& iid)
350 {
351 if( iid == IID())
352 return true;
353 return I::compare_iid( iid);
354 }
355
366 virtual const base::IInterface* get_interface( const base::Uuid& interface_id) const
367 {
368 if( interface_id == IID()) {
369 const Self* self = static_cast<const Self*>( this);
370 self->retain();
371 return self;
372 }
373 return I::get_interface_static( this, interface_id);
374 }
375
386 virtual base::IInterface* get_interface( const base::Uuid& interface_id)
387 {
388 if( interface_id == IID()) {
389 Self* self = static_cast<Self*>( this);
390 self->retain();
391 return self;
392 }
393 return I::get_interface_static( this, interface_id);
394 }
395
397
399 virtual base::Uuid get_class_id() const
400 {
401 return IID();
402 }
403
405 virtual void deserialize( neuraylib::IDeserializer* deserializer)
406 {
407 // avoid warnings
408 (void) deserializer;
409 }
410
412 virtual void get_references( neuraylib::ITag_set* result) const
413 {
414 // avoid warnings
415 (void) result;
416 }
417
419 virtual void get_references( IElement_set* result) const
420 {
421 // avoid warnings
422 (void) result;
423 }
424
426 virtual bool upload_only() const { return false; }
427};
428
435 0xf9b3c8e2,0x7688,0x4bf8,0x91,0x36,0xcd,0x3a,0x3f,0x51,0x30,0x7a>
436{
437 void serialize( neuraylib::ISerializer* serializer) const
438 {
439 // avoid warnings
440 (void) serializer;
441 }
442
443 void receive_remote_result( neuraylib::IDeserializer* deserializer, bool last_result)
444 {
445 // avoid warnings
446 (void) deserializer;
447 (void) last_result;
448 }
449};
450
451
456{
460
464
474
482
483mi_static_assert( sizeof( Client_session_state) == sizeof( Uint32));
484
490 mi::base::Interface_declare<0x9ea6d3b3,0x3d0b,0x4d10,0x89,0xc8,0x89,0xf1,0x20,0x49,0xc6,0xe1>
491{
492public:
495};
496
501 mi::base::Interface_declare<0x80cf9612,0x3fd4,0x4ed0,0xb1,0x63,0xc0,0xd9,0x84,0xe2,0x6,0xaa>
502{
503public:
508 virtual void progress_callback( Size bytes_done, Size total_bytes) = 0;
509
515 virtual void done_callback( Size total_bytes, Float64 total_time) = 0;
516
522 virtual void error_callback( Sint32 error_code) = 0;
523};
524
539class IClient_session : public
540 mi::base::Interface_declare<0x70bb8712,0x1305,0x4c76,0xb9,0x38,0xad,0x27,0x91,0xea,0xbd,0x78>
541{
542public:
546
556
563
582 virtual Sint32 execute(IClient_job* job, neuraylib::ITransaction* transaction) = 0;
583
602 virtual Sint32 cancel(IClient_job* job) = 0;
603
614
632 IClient_measure_bandwidth_callback* progress_callback,
633 bool upload,
634 Uint32 package_size,
635 Uint32 package_count = 1) = 0;
636
647 virtual void set_receiving_logger( base::ILogger* logger) = 0;
648
656
666
671
675 virtual Size get_bytes_written() const = 0;
676
680 virtual Size get_bytes_read() const = 0;
681
712 const IMap* overrides,
713 const char* top_level_element,
714 neuraylib::ITransaction* transaction) = 0;
715
716};
717
721class IBridge_client : public
722 mi::base::Interface_declare<0xbe270827,0xad68,0x4044,0x94,0x6e,0x9d,0x41,0x4d,0xf,0x75,0x65>
723{
724public:
753 const char* application_url, const char* security_token = 0) = 0;
754
756 virtual const char* get_bridge_protocol_version() const = 0;
757};
758 // end group mi_neuray_bridge_client
760
761} // namespace bridge
762
763} // namespace mi
764
765#endif // MI_NEURAYLIB_IBRIDGE_CLIENT_H
This interface represents maps, i.e., a key-value based data structure.
Definition: imap.h:41
The basic extensible interface.
Definition: iinterface.h:103
The ILogger interface class supports logging of messages.
Definition: ilogger.h:194
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
This mixin class provides a default implementation for some of the methods needed by mi::bridge::ICli...
Definition: ibridge_client.h:336
virtual bool upload_only() const
Returns false in the default implementation.
Definition: ibridge_client.h:426
virtual void get_references(IElement_set *result) const
Empty body. The default job references no elements.
Definition: ibridge_client.h:419
virtual base::Uuid get_class_id() const
Returns the class ID corresponding to the template parameters of this mixin class.
Definition: ibridge_client.h:399
virtual const base::IInterface * get_interface(const base::Uuid &interface_id) const
Acquires a const interface.
Definition: ibridge_client.h:366
Client_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_client.h:339
virtual void deserialize(neuraylib::IDeserializer *deserializer)
Empty body. This method from the base class is not needed for client jobs.
Definition: ibridge_client.h:405
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_client.h:342
virtual base::IInterface * get_interface(const base::Uuid &interface_id)
Acquires a mutable interface.
Definition: ibridge_client.h:386
virtual void get_references(neuraylib::ITag_set *result) const
Empty body. The default job references no elements.
Definition: ibridge_client.h:412
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_client.h:349
API component that serves as entry point for the client-side Bridge API.
Definition: ibridge_client.h:723
virtual IClient_session * get_session(const char *application_url, const char *security_token=0)=0
Returns a session to the provided Bridge application running on a Bridge server.
virtual const char * get_bridge_protocol_version() const =0
Returns the Bridge protocol version.
Provides detailed information about the progress of a Bridge job.
Definition: ibridge_client.h:136
virtual Client_job_state get_state() const =0
Returns the state of the job.
virtual const char * get_currently_uploaded_element_name() const =0
Returns the name of the currently uploaded element or NULL if no element is currently being uploaded.
virtual Size get_currently_uploaded_element_uploaded_bytes() const =0
Returns the number of bytes uploaded for the currently uploaded element or 0 if no element is current...
virtual Size get_pending_hash_calculation_count() const =0
Returns the number of elements for which hashes needs to be calculated.
virtual Size get_cache_miss_bytes() const =0
Returns the total amount of bytes to upload for all cache misses.
virtual Size get_pending_cache_status_count() const =0
Returns the number of cache status requests that the server has not yet replied to.
virtual Size get_updated_element_count() const =0
Returns the number of elements that need to be updated before executing this job.
virtual Size get_currently_uploaded_element_size() const =0
Returns the size in bytes of the currently uploaded element or 0 if no element is currently being upl...
virtual Size get_uploaded_cache_miss_count() const =0
Returns the number of cache misses for which data has been uploaded so far.
virtual Size get_cache_miss_count() const =0
Returns the total number of cache misses for which data needs to be uploaded.
virtual Size get_uploaded_cache_miss_bytes() const =0
Returns the number of bytes that has been uploaded for the cache misses so far.
virtual Size get_pending_data_serialization_count() const =0
Returns the number of elements that have been queued up for serialization.
Represents the client-side part of a job that can be executed by the Bridge server.
Definition: ibridge_client.h:241
virtual void error_callback(Sint32 error_code, const char *msg)=0
A callback that indicates an error during job execution or if the job was canceled.
virtual bool upload_only() const =0
Indicates whether the referenced elements should really be updated in the server-side database.
virtual void get_references(IElement_set *result) const =0
Returns the database elements that will be used by this job on the server, identified by a set of nam...
virtual void receive_remote_result(neuraylib::IDeserializer *deserializer, bool last_result)=0
Deserializes the job result from the execution of the job on the server.
virtual void get_references(neuraylib::ITag_set *result) const =0
Returns the database elements that will be used by this job on the server, identified by a set of tag...
virtual void progress_callback(IClient_job_progress *job_progress)=0
A callback that provides progress information.
Abstract interface for bandwidth measurement events.
Definition: ibridge_client.h:502
virtual void error_callback(Sint32 error_code)=0
This method is called if there is an error preventing the test from finishing.
virtual void done_callback(Size total_bytes, Float64 total_time)=0
This method is called when the bandwidth measurement is done.
virtual void progress_callback(Size bytes_done, Size total_bytes)=0
This method is called when the bandwidth measurement starts and then when there is progress.
Abstract interface for callbacks for session state changes.
Definition: ibridge_client.h:491
virtual void session_state_callback(Client_session_state state)=0
This method is called whenever the session changes its state.
Represents the client side of a Bridge session.
Definition: ibridge_client.h:541
virtual Size get_bytes_written() const =0
Returns the number of bytes written to the server so far.
virtual void set_receiving_logger(base::ILogger *logger)=0
Sets the receiving logger for log messages forwarded from the Bridge server.
virtual Sint32 execute(IClient_job *job, neuraylib::ITransaction *transaction)=0
Schedules the provided job for execution on the server and returns immediately.
virtual Client_session_state get_state()=0
Returns the state of the session.
virtual void remove_session_state_callback(IClient_session_state_callback *callback)=0
Removes a previously added session state callback.
virtual Sint32 set_forwarding_log_level(base::Message_severity level)=0
Sets the log level of messages that are forwarded from the Bridge server.
virtual base::ILogger * get_receiving_logger() const =0
Returns the receiving logger for log messages forwarded from the Bridge server.
virtual Sint32 cancel(IClient_job *job)=0
Marks the provided job to be canceled and returns immediately.
virtual Sint32 set_hash_overrides(const IMap *overrides, const char *top_level_element, neuraylib::ITransaction *transaction)=0
Allows the data for specific elements to be overridden by specifying the hash of the data to use rega...
virtual Size get_bytes_read() const =0
Returns the number of bytes read from the server so far.
virtual void add_session_state_callback(IClient_session_state_callback *callback)=0
Adds a session state callback.
virtual base::Message_severity get_forwarding_log_level() const =0
Returns the currently set log level for messages forwarded from the server.
virtual IClient_video_context * create_video_context()=0
Creates a new video context.
virtual Sint32 measure_bandwidth(IClient_measure_bandwidth_callback *progress_callback, bool upload, Uint32 package_size, Uint32 package_count=1)=0
Measures the bandwidth to the Bridge server.
Client-side video context that receives and decodes video frames from the corresponding server-side v...
Definition: ibridge_video_client.h:44
Used to specify a set of elements by name.
Definition: ibridge_client.h:207
virtual const char * get_element(Size index) const =0
Returns the index -th element of the element set.
virtual void add_element(const char *element_name)=0
Adds element to the tag set.
virtual Size get_length() const =0
Returns the number of elements in the set.
Base class for Bridge jobs that only update elements without executing anything.
Definition: ibridge_client.h:436
Source for deserializing objects from byte streams.
Definition: ideserializer.h:35
Target for serializing objects to byte streams.
Definition: iserializer.h:171
Used to store a set of tags.
Definition: dice.h:210
Basic enums.
#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 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
double Float64
64-bit float.
Definition: types.h:52
unsigned short Uint16
16-bit unsigned integer.
Definition: types.h:48
signed int Sint32
32-bit signed integer.
Definition: types.h:46
Client_session_state
The different states a client session can be in.
Definition: ibridge_client.h:456
Client_job_state
Job states of Bridge jobs.
Definition: ibridge_client.h:95
@ CLIENT_SESSION_CONNECTED
The session has successfully established a connection to the Bridge server and is ready for use.
Definition: ibridge_client.h:463
@ CLIENT_SESSION_PENDING
The session was disconnected unexpectedly.
Definition: ibridge_client.h:473
@ CLIENT_SESSION_CONNECTING
The session is trying to establish a connection to the remote Bridge application for the first time.
Definition: ibridge_client.h:459
@ CLIENT_SESSION_CLOSED
The session has been closed in an orderly fashion, or the session has been pending but the session co...
Definition: ibridge_client.h:480
@ CLIENT_JOB_PENDING
Waiting for execution of the job to finish.
Definition: ibridge_client.h:123
@ CLIENT_JOB_DONE
The result has been received and deserialized by the client-side job and the job is done.
Definition: ibridge_client.h:126
@ CLIENT_JOB_DETECTING_CHANGES
Detecting which database elements needs to be updated before executing the job.
Definition: ibridge_client.h:97
@ CLIENT_JOB_PREPARING
Calculates hashes for the elements that will be updated and to some extent serialize data that will b...
Definition: ibridge_client.h:101
@ CLIENT_JOB_QUERYING_CACHE_STATUS
Determining how much data needs to be uploaded before executing this job.
Definition: ibridge_client.h:108
@ CLIENT_JOB_UPLOADING
Uploading data.
Definition: ibridge_client.h:115
Mixin class template for deriving interface implementations.
Serialization of objects to a byte stream.
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