Iray SDK API nvidia_logo_transpbg.gif Up
mi::bridge::IIray_bridge_snapshot_handler Class Referenceabstract

The IIray_bridge_snapshot_handler can be used to control snapshot creation for an Iray bridge server application. More...

#include <iiray_bridge_server.h>

Inheritance diagram for mi::bridge::IIray_bridge_snapshot_handler:

Public Member Functions

virtual bool on_snapshot_request (IServer_session *session, Uint32 context_id)=0
 This function is called when the Iray Bridge application receives a requests to create a snapshot to decide if the snapshot is allowed or not. More...
 
virtual Sint32 on_snapshot_creation (IServer_session *session, Uint32 context_id, const char *scene_name, bool incremental, const char *suggested_snapshot_name, const char *cb_file_data, IString *final_snapshot_name, IString *error_message)=0
 If the call to on_snapshot_request() allowed the snapshot and it was created successfully, then this method will be called with the result. More...
 
virtual void on_snapshot_error (IServer_session *session, Uint32 context_id, Sint32 error_code, const char *error_message)=0
 If the call to on_snapshot_request() allows the snapshot but the snapshot creation failed, then this callback is called instead of on_snapshot_creation(). 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< 0x46e19aa2, ... >
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< 0x46e19aa2, ... >
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

The IIray_bridge_snapshot_handler can be used to control snapshot creation for an Iray bridge server application.

By default the bridge server accepts all snapshot creation requests and writes the snapshot data into the snapshot path set by mi::bridge::IIray_bridge_application::set_snapshot_path(). By installing a custom IIray_bridge_snapshot_handler it is possible to limit the snapshots created per user and how to store the .cb snapshot file data.

Note that all callback methods of this interface can be called concurrently, so implementations must be thread safe.

Member Function Documentation

 on_snapshot_creation()

virtual Sint32 mi::bridge::IIray_bridge_snapshot_handler::on_snapshot_creation ( IServer_session session,
Uint32  context_id,
const char *  scene_name,
bool  incremental,
const char *  suggested_snapshot_name,
const char *  cb_file_data,
IString final_snapshot_name,
IString error_message 
)
pure virtual

If the call to on_snapshot_request() allowed the snapshot and it was created successfully, then this method will be called with the result.

It is up to the implementation to save the contents of the .cb file data to a file on disk, store it in a data base, or something similar.

Parameters
sessionThe session of the request.
context_idThe id of the snapshot context that made the request. Only one snapshot can be created at a time per session/context_id pair.
scene_nameThe name of the scene the snapshot is for.
incrementalTrue if the snapshot is incremental, false otherwise.
suggested_snapshot_nameThis is the name for the snapshot provided by the client, or an empty string if the client didn't provide a name. In that case it is the responsibility of the implementation to provide a unique name for the snapshot within the context of where it is stored.
cb_file_dataA string containing the contents of the .cb file that can be used to import the snapshot or delete it.
[out]final_snapshot_nameThe name for the snapshot that the implementation decided to use. If the client supplied name is kept, it must still be set here.
[out]error_messageSet with a short message describing the error, or leave as is.
Returns
An error code indicating if handling the snapshot went well.
  • 0 If the snapshot could be handled successfully.
  • -1 to -1000 Reserved error codes.
  • <-1000 Handler specific error codes.

 on_snapshot_error()

virtual void mi::bridge::IIray_bridge_snapshot_handler::on_snapshot_error ( IServer_session session,
Uint32  context_id,
Sint32  error_code,
const char *  error_message 
)
pure virtual

If the call to on_snapshot_request() allows the snapshot but the snapshot creation failed, then this callback is called instead of on_snapshot_creation().

This allows the server to perform cleanup or show the error in a UI or something similar. The client will be notified about the error without the handler needing to take action.

Parameters
sessionThe session of the request.
context_idThe id of the snapshot context that made the request. Only one snapshot can be created at a time per session/context_id pair.
error_codeAn error code indicating what the error was.
error_messageA short description of the error.

 on_snapshot_request()

virtual bool mi::bridge::IIray_bridge_snapshot_handler::on_snapshot_request ( IServer_session session,
Uint32  context_id 
)
pure virtual

This function is called when the Iray Bridge application receives a requests to create a snapshot to decide if the snapshot is allowed or not.

Parameters
sessionThe session of the request.
context_idThe id of the snapshot context that made the request. Only one snapshot can be created at a time per session/context_id pair.
Returns
True to allow the creation of a snapshot, false to reject it.