DiCE API nvidia_logo_transpbg.gif Up
mi::bridge::IClient_job Class Referenceabstract

Represents the client-side part of a job that can be executed by the Bridge server. More...

#include <ibridge_client.h>

Inheritance diagram for mi::bridge::IClient_job:

Public Member Functions

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 tags. More...
 
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 names. More...
 
virtual bool upload_only () const =0
 Indicates whether the referenced elements should really be updated in the server-side database. More...
 
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. More...
 
virtual void progress_callback (IClient_job_progress *job_progress)=0
 A callback that provides progress information. More...
 
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. More...
 
- Public Member Functions inherited from mi::neuraylib::ISerializable
virtual base::Uuid get_class_id () const =0
 Returns the class ID of the object. More...
 
virtual void serialize (ISerializer *serializer) const =0
 Serializes the object to the given serializer. More...
 
virtual void deserialize (IDeserializer *deserializer)=0
 Deserializes the object from the given deserializer. More...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xe02e4aeb, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::Interface_declare< 0x7a70f2fb, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xe02e4aeb, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x7a70f2fb, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed Description

Represents the client-side part of a job that can be executed by the Bridge server.

The corresponding server-side part of the job must return the same ID from mi::neuraylib::ISerializable::get_class_id() and be registered as a Bridge job on the server.

The client-side part must implement mi::neuraylib::ISerializable::serialize() to serialize the data that is received by mi::bridge::IServer_job::deserialize(), and mi::bridge::IClient_job::receive_remote_result() to deserialize the result of the job which is produced by mi::bridge::IServer_job::execute().

It is recommended to derived your implementation from mi::bridge::Client_job and overriding only the required methods.

See also
mi::bridge::IClient_session::execute()

Member Function Documentation

 error_callback()

virtual void mi::bridge::IClient_job::error_callback ( Sint32  error_code,
const char *  msg 
)
pure virtual

A callback that indicates an error during job execution or if the job was canceled.

Parameters
error_code
  • 0: The job was explicitly canceled or the transaction was aborted.
  • -1: Network error.
  • -2: Corresponding server side job does not exist.
  • <= -3: Unspecified error.
msgA short explanation of the error.

 get_references() [1/2]

virtual void mi::bridge::IClient_job::get_references ( IElement_set result) const
pure virtual

Returns the database elements that will be used by this job on the server, identified by a set of names.

The Bridge will guarantee that any elements returned by this method and any elements indirectly referenced by them will be updated in the server-side cache and database before this Bridge job executes on the server.

Note
The elements identified by the overload get_references(neuraylib::ITag_set*)const will also be updated.
See also
upload_only()
Parameters
[out]resultThe set of element names referenced by the Bridge job. The passed-in element set is empty.

 get_references() [2/2]

virtual void mi::bridge::IClient_job::get_references ( neuraylib::ITag_set result) const
pure virtual

Returns the database elements that will be used by this job on the server, identified by a set of tags.

The Bridge will guarantee that any elements returned by this method and any elements indirectly referenced by them will be updated in the server-side cache and database before this Bridge job executes on the server.

Note
The elements identified by the overload get_references(IElement_set*)constwill also be updated.
See also
upload_only()
Parameters
[out]resultThe set of tags referenced by the Bridge job. The passed-in tag set is empty.

 progress_callback()

virtual void mi::bridge::IClient_job::progress_callback ( IClient_job_progress job_progress)
pure virtual

A callback that provides progress information.

This method is called whenever the state of the job changes and also periodically if the job stays in a state for a long time. During execution of the job, custom progress information can be encoded into chunks of result data.

See also
Client_job_state, receive_remote_result(), IServer_job::execute()
Parameters
job_progressAn instance that contains all progress information. The instance may only be used from within this callback.

 receive_remote_result()

virtual void mi::bridge::IClient_job::receive_remote_result ( neuraylib::IDeserializer deserializer,
bool  last_result 
)
pure virtual

Deserializes the job result from the execution of the job on the server.

The execution of the job might produce intermediate results by flushing the data serialized so far. Each call to mi::neuraylib::ISerializer::flush() on the server will result in a single call to receive_remote_result() with the last_result flag set to false, even if no data was flushed. When the execution on the server finishes this method will be called one last time with the last_result flag set to true with the remaining data.

See mi::bridge::IServer_job::execute() for more information and a couple of example use cases.

Parameters
deserializerThe deserializer from which to read the (partial) result.
last_resulttrue if this is the last chunk of result data the job will produce, false otherwise.

 upload_only()

virtual bool mi::bridge::IClient_job::upload_only ( ) const
pure virtual

Indicates whether the referenced elements should really be updated in the server-side database.

Usually, this method returns false, meaning that referenced elements are updated in the server-side cache and database. In some circumstances it is not necessary to update the server-side database because only the cache is needed, e.g., when saving snapshots. In this case, one can optimize the update process by returning true, meaning that only the server side cache but not the database are updated before executing the job.

See also
get_references()