neuray API Programmer's Manual

ibridge_client.h File Reference

Description

Bridge client.

Code Example

ibridge_client.h

‎//*****************************************************************************
// Copyright 1986, 2016 NVIDIA Corporation. All rights reserved.
//*****************************************************************************
//*****************************************************************************

#ifndef MI_NEURAYLIB_IBRIDGE_CLIENT_H
#define MI_NEURAYLIB_IBRIDGE_CLIENT_H

#include <mi/base/enums.h>
#include <mi/base/interface_implement.h>
#include <mi/neuraylib/iserializer.h>

namespace mi {

class IMap;
class IString;

namespace base { class ILogger; }

namespace neuraylib {
class IDeserializer;
class ITransaction;
class IScope;
class IProgress_callback;
class ITag_set;
}

namespace bridge {

class IClient_video_context;













enum Client_job_state
{
    CLIENT_JOB_DETECTING_CHANGES = 0,

    CLIENT_JOB_PREPARING = 1,

    CLIENT_JOB_QUERYING_CACHE_STATUS = 2,

    CLIENT_JOB_UPLOADING = 3,

    CLIENT_JOB_PENDING = 4,

    CLIENT_JOB_DONE = 5,

    CLIENT_JOB_FORCE_32_BIT = 0xffffffffU
};

mi_static_assert( sizeof( Client_job_state) == sizeof( Uint32));

class IClient_job_progress : public
    mi::base::Interface_declare<0x7f51a745,0xfcf0,0x4b2d,0x92,0x93,0x2b,0x84,0xd7,0x8c,0xc0,0xe6>
{
public:
    virtual Client_job_state 
               get_state() const = 0;

    virtual Size 
               get_updated_element_count() const = 0;

    virtual Size 
               get_pending_hash_calculation_count() const = 0;

    virtual Size 
               get_pending_cache_status_count() const = 0;

    virtual Size 
               get_cache_miss_count() const = 0;

    virtual Size 
               get_cache_miss_bytes() const = 0;

    virtual Size 
               get_uploaded_cache_miss_count() const = 0;

    virtual Size 
               get_uploaded_cache_miss_bytes() const = 0;

    virtual Size 
               get_pending_data_serialization_count() const = 0;

    virtual const char* get_currently_uploaded_element_name() const = 0;

    virtual Size 
               get_currently_uploaded_element_size() const = 0;

    virtual Size 
               get_currently_uploaded_element_uploaded_bytes() const = 0;
};

class IElement_set : public
    mi::base::Interface_declare<0x2242471d,0x96f3,0x4962,0x84,0x7e,0xd1,0x20,0xa9,0x6b,0xb6,0x98>
{
public:
    virtual Size 
               get_length() const = 0;

    virtual const char* get_element( Size index) const = 0;

    virtual void add_element( const char* element_name) = 0;
};

class IClient_job : public
    mi::base::Interface_declare<0xe02e4aeb,0x6edd,0x4e40,0xbb,0xe0,0x6c,0xc5,0xe7,0x69,0xa6,0xe,
    neuraylib::ISerializable>
{
public:
    virtual void get_references( neuraylib::ITag_set* result) const = 0;

    virtual void get_references( IElement_set* result) const = 0;

    virtual bool upload_only() const = 0;

    virtual void receive_remote_result(
        neuraylib::IDeserializer* deserializer, bool last_result) = 0;

    virtual void progress_callback( IClient_job_progress* job_progress) = 0;

    virtual void error_callback( Sint32 error_code, const char* msg) = 0;
};

template <Uint32 i_id1, Uint16 i_id2, Uint16 i_id3
, Uint8 i_id4, Uint8 i_id5, Uint8 i_id6, Uint8 i_id7
, Uint8 i_id8, Uint8 i_id9, Uint8 i_id10, Uint8 i_id11
, class I = IClient_job>
class Client_job : public base::Interface_implement<I>
{
public:
    typedef 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;

    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;

    static bool compare_iid( const base::Uuid& iid)
    {
        if( iid == IID())
            return true;
        return I::compare_iid( iid);
    }

    virtual const base::IInterface* get_interface( const base::Uuid& interface_id) const
    {
        if( interface_id == IID()) {
            const Self* self = static_cast<const Self*>( this);
            self->retain();
            return self;
        }
        return I::get_interface_static( this, interface_id);
    }

    virtual base::IInterface* get_interface( const base::Uuid& interface_id)
    {
        if( interface_id == IID()) {
            Self* self = static_cast<Self*>( this);
            self->retain();
            return self;
        }
        return I::get_interface_static( this, interface_id);
    }

    using base::Interface_implement< I>::get_interface;

    virtual base::Uuid 
               get_class_id() const
    {
        return IID();
    }

    virtual void deserialize( neuraylib::IDeserializer* deserializer)
    {
        // avoid warnings
        (void) deserializer;
    }

    virtual void get_references( neuraylib::ITag_set* result) const
    {
        // avoid warnings
        (void) result;
    }

    virtual void get_references( IElement_set* result) const
    {
        // avoid warnings
        (void) result;
    }

    virtual bool upload_only() const { return false; }
};

class Update_job : public mi::bridge::Client_job<
    0xf9b3c8e2,0x7688,0x4bf8,0x91,0x36,0xcd,0x3a,0x3f,0x51,0x30,0x7a>
{
    void serialize( neuraylib::ISerializer* serializer) const
    {
        // avoid warnings
        (void) serializer;
    }

    void receive_remote_result( neuraylib::IDeserializer* deserializer, bool last_result)
    {
        // avoid warnings
        (void) deserializer;
        (void) last_result;
    }
};

class IClient_transaction_callback : public
    mi::base::Interface_declare<0xa110400a,0x8dfe,0x47d5,0xaf,0x28,0x64,0xe2,0xe5,0xd5,0xa6,0x6f>
{
public:
    virtual void transaction_done_callback( Sint32 error_code) = 0;
};

class IClient_transaction : public
    mi::base::Interface_declare<0x5820ed8e,0xe2c6,0x4a35,0xa1,0xd4,0xc4,0x82,0x87,0x16,0xe0,0x36>
{
public:
    virtual Sint32 
               execute( IClient_job* job) = 0;

    virtual Sint32 
               commit( IClient_transaction_callback* callback = 0) = 0;

    virtual Sint32 
               abort( IClient_transaction_callback* callback = 0) = 0;
};

class IClient_scope : public
    mi::base::Interface_declare<0xfff9d40,0xaa9e,0x4974,0xb4,0xcd,0x85,0xb9,0x8b,0x50,0x8b,0xeb>
{
public:
    virtual IClient_transaction* create_transaction( neuraylib::ITransaction* transaction) = 0;
};

enum Client_session_state
{
    CLIENT_SESSION_CONNECTING,

    CLIENT_SESSION_CONNECTED,

    CLIENT_SESSION_PENDING,

    CLIENT_SESSION_CLOSED
};

mi_static_assert( sizeof( Client_session_state) == sizeof( Uint32));

class IClient_session_state_callback : public
    mi::base::Interface_declare<0x9ea6d3b3,0x3d0b,0x4d10,0x89,0xc8,0x89,0xf1,0x20,0x49,0xc6,0xe1>
{
public:
    virtual void session_state_callback( Client_session_state state) = 0;
};

class IClient_measure_bandwidth_callback : public
    mi::base::Interface_declare<0x80cf9612,0x3fd4,0x4ed0,0xb1,0x63,0xc0,0xd9,0x84,0xe2,0x6,0xaa>
{
public:
    virtual void progress_callback( Size bytes_done, Size total_bytes) = 0;

    virtual void done_callback( Size total_bytes, Float64 total_time) = 0;

    virtual void error_callback( Sint32 error_code) = 0;
};

class IClient_session : public
    mi::base::Interface_declare<0x70bb8712,0x1305,0x4c76,0xb9,0x38,0xad,0x27,0x91,0xea,0xbd,0x78>
{
public:
    virtual Client_session_state 
               get_state() = 0;

    virtual void add_session_state_callback( IClient_session_state_callback* callback) = 0;

    virtual void remove_session_state_callback( IClient_session_state_callback* callback) = 0;

    virtual IClient_scope* get_scope( neuraylib::IScope* local_scope) = 0;

    virtual IClient_video_context* create_video_context() = 0;

    virtual Sint32 
               measure_bandwidth(
        IClient_measure_bandwidth_callback* progress_callback,
        bool upload,
        Uint32 package_size,
        Uint32 package_count = 1) = 0;

    virtual void set_receiving_logger( base::ILogger* logger) = 0;

    virtual base::ILogger* get_receiving_logger() const = 0;

    virtual Sint32 
               set_forwarding_log_level( base::Message_severity level) = 0;

    virtual base::Message_severity 
               get_forwarding_log_level() const = 0;

    virtual Size 
               get_bytes_written() const = 0;

    virtual Size 
               get_bytes_read() const = 0;
};

class IBridge_client : public
    mi::base::Interface_declare<0xbe270827,0xad68,0x4044,0x94,0x6e,0x9d,0x41,0x4d,0xf,0x75,0x65>
{
public:
    virtual IClient_session* get_session(
        const char* application_url, const char* security_token = 0) = 0;

    virtual const char* get_bridge_protocol_version() const = 0;
};
 // end group mi_neuray_bridge_client

} // namespace bridge

} // namespace mi

#endif // MI_NEURAYLIB_IBRIDGE_CLIENT_H

Namespaces

namespace 
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
namespace 
Namespace for the Base API. More...
namespace 
Namespace for the Bridge functionality of the neuray API. More...
namespace 
Namespace for the neuray API. More...

Classes

class 
This mixin class provides a default implementation for some of the methods needed by mi::bridge::IClient_job. More...
class 
API component that serves as entry point for the client-side Bridge API. More...
class 
Represents the client-side part of a job that can be executed by the Bridge server. More...
class 
Provides detailed information about the progress of a Bridge job. More...
class 
Abstract interface for bandwidth measurement events. More...
class 
Represents the client side of a Bridge scope. More...
class 
Represents the client side of a Bridge session. More...
class 
Abstract interface for callbacks for session state changes. More...
class 
Represents the client side of a Bridge transaction. More...
class 
Abstract interface for callbacks for asynchronous transaction commit or abort events. More...
class 
Used to specify a set of elements by name. More...
class 
Base class for Bridge jobs that only update elements without executing anything. More...

Enumerations

enum  {CLIENT_JOB_DETECTING_CHANGES = 0, CLIENT_JOB_PREPARING = 1, CLIENT_JOB_QUERYING_CACHE_STATUS = 2, CLIENT_JOB_UPLOADING = 3, CLIENT_JOB_PENDING = 4, CLIENT_JOB_DONE = 5, CLIENT_JOB_FORCE_32_BIT = 0xffffffffU }
Job states of Bridge jobs. More...
enum  {CLIENT_SESSION_CONNECTING, CLIENT_SESSION_CONNECTED, CLIENT_SESSION_PENDING, CLIENT_SESSION_CLOSED }
The different states a client session can be in. More...