ibridge_server.h File Reference
Description
Bridge server.
Code Example
ibridge_server.h
//*****************************************************************************
// Copyright 1986, 2016 NVIDIA Corporation. All rights reserved.
//*****************************************************************************
//*****************************************************************************
#ifndef MI_NEURAYLIB_IBRIDGE_SERVER_H
#define MI_NEURAYLIB_IBRIDGE_SERVER_H
#include <mi/base/enums.h>
#include <mi/base/handle.h>
#include <mi/base/interface_implement.h>
#include <mi/base/uuid.h>
#include <mi/neuraylib/iserializer.h>
#include <mi/neuraylib/itransaction.h>
#include <mi/neuraylib/iuser_class_factory.h>
namespace mi {
class IString;
class IMap;
namespace http { class IServer; }
namespace neuraylib { class ICanvas; class IImport_result; class ITag_set; }
namespace bridge {
class IApplication;
class IApplication_session_handler;
class IElement_set;
class IServer_session;
class IServer_transaction;
class IServer_video_context;
class IServer_job : public
mi::base::Interface_declare<0x555dea0f,0x4eeb,0x44b9,0xba,0x81,0x5a,0x42,0x3d,0xe5,0xf8,0x30,
neuraylib::ISerializable>
{
public:
virtual void execute(
IServer_transaction* transaction, neuraylib::ISerializer* serializer) = 0;
virtual void cancel() = 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 = IServer_job>
class Server_job : public base::Interface_implement<I>
{
public:
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;
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 serialize( neuraylib::ISerializer* serializer) const
{
// avoid warnings
(void) serializer;
}
virtual void cancel() { }
};
class IServer_transaction_callback : public
mi::base::Interface_declare<0x7796c406,0xff8f,0x423d,0x8f,0x53,0x1a,0x66,0x50,0xcf,0x83,0x86>
{
public:
virtual void transaction_committed_callback() = 0;
virtual void transaction_aborted_callback( Sint32 error_code, const char* message) = 0;
};
class IIncremental_snapshot_context : public
mi::base::Interface_declare<0x5ec24e12,0x9ce9,0x4f39,0x9f,0xd5,0x35,0xf1,0xe5,0x41,0x34,0x2e>
{
public:
virtual Sint32
create_snapshot( IServer_transaction* transaction, IString* snapshot_id) = 0;
};
class IServer_transaction : public
mi::base::Interface_declare<0x67fd848e,0xce43,0x4675,0x8b,0x14,0xb2,0x54,0xd,0xd2,0x29,0x63>
{
public:
virtual IServer_session* get_session() const = 0;
virtual neuraylib::ITransaction* get_database_transaction() const = 0;
template<class T>
T* get_database_transaction() const
{
neuraylib::ITransaction* ptr_itransaction = get_database_transaction();
if ( !ptr_itransaction)
return 0;
T* ptr_T = static_cast<T*>( ptr_itransaction->get_interface( typename T::IID()));
ptr_itransaction->release();
return ptr_T;
}
virtual Sint32
add_transaction_callback( IServer_transaction_callback* callback) = 0;
virtual Sint32
remove_transaction_callback( IServer_transaction_callback* callback) = 0;
virtual Sint32
create_snapshot( const char* element, IString* snapshot_id) = 0;
virtual Sint32
create_incremental_snapshot_context(
const char* element, IString* snapshot_id, IIncremental_snapshot_context** context) = 0;
virtual Size
get_updated_element_count() const = 0;
};
enum Server_session_state
{
SERVER_SESSION_CONNECTING = 0,
SERVER_SESSION_CONNECTED = 1,
SERVER_SESSION_PENDING = 2,
SERVER_SESSION_CLOSED = 3,
SERVER_SESSION_FORCE_32_BIT = 0xffffffffU
};
mi_static_assert( sizeof( Server_session_state) == sizeof( Uint32));
class IServer_session_state_callback : public
mi::base::Interface_declare<0x12a50ba1,0x9cfc,0x4a12,0x9a,0x4b,0x52,0x13,0xf6,0x98,0x81,0x11>
{
public:
virtual void session_state_callback( IServer_session* session) = 0;
};
class IServer_session : public
mi::base::Interface_declare<0x42574f4a,0xfab1,0x4fdc,0xa0,0xc7,0x52,0x48,0xba,0xfa,0x8e,0x7d>
{
public:
virtual Server_session_state
get_state() const = 0;
virtual IApplication* get_application() const = 0;
virtual IServer_video_context* get_video_context( Sint32 context_id) = 0;
virtual void add_session_state_callback( IServer_session_state_callback* callback) = 0;
virtual void remove_session_state_callback( IServer_session_state_callback* callback) = 0;
virtual const char* get_security_token() const = 0;
virtual const char* get_session_id() const = 0;
};
class IApplication_session_handler : public
mi::base::Interface_declare<0x8913c078,0xeba2,0x4e0b,0x83,0x44,0x1,0xcb,0x2b,0x57,0x67,0x3c>
{
public:
virtual bool on_session_connect( IServer_session* session) = 0;
};
class IApplication : public
mi::base::Interface_declare<0x84c2d806,0x6e1f,0x402d,0xb2,0xa,0x2f,0xcf,0x47,0xd1,0xf,0x2e>
{
public:
virtual Sint32
register_job(
const base::Uuid& job_class_id, neuraylib::IUser_class_factory* factory) = 0;
template <class T>
Sint32
register_job()
{
mi::base::Handle< mi::neuraylib::IUser_class_factory> factory(
new neuraylib::User_class_factory< T>());
return register_job( typename T::IID(), factory.get());
}
virtual Sint32
unregister_job( const base::Uuid& job_class_id) = 0;
template <class T>
Sint32
unregister_job()
{
return unregister_job( typename T::IID());
}
virtual Sint32
set_disk_cache( const char* location) = 0;
virtual const char* get_disk_cache() const = 0;
virtual Sint32
open() = 0;
virtual Sint32
close() = 0;
virtual bool is_open() = 0;
virtual Sint32
set_session_handler( IApplication_session_handler* handler) = 0;
virtual IApplication_session_handler* get_session_handler() const = 0;
virtual Sint32
set_log_forwarding_limit( base::Message_severity limit) = 0;
virtual base::Message_severity
get_log_forwarding_limit() const = 0;
};
class IBridge_snapshot_context : public
mi::base::Interface_declare<0x9a9ceafe,0x876b,0x4647,0xbc,0xae,0xb6,0x4,0x9c,0x7b,0x9,0xfc>
{
public:
virtual neuraylib::IImport_result* import_snapshot(
neuraylib::ITransaction* transaction,
const char* snapshot_id,
const IMap* importer_options = 0) = 0;
virtual Sint32
remove_snapshot( const char* snapshot_id) = 0;
};
class IBridge_server : public
mi::base::Interface_declare<0x1fd8a3ac,0xa70c,0x4273,0xa9,0x1a,0x67,0x57,0xdf,0xc7,0xa5,0xb>
{
public:
virtual IApplication* create_application(
const char* application_path, http::IServer* http_server) = 0;
virtual IBridge_snapshot_context* create_snapshot_context( const char* disk_cache) = 0;
virtual const char* get_bridge_protocol_version() const = 0;
};
// end group mi_neuray_bridge_server
} // namespace bridge
} // namespace mi
#endif // MI_NEURAYLIB_IBRIDGE_SERVER_H
Namespaces
- namespace
- Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
- namespace
- Namespace for the Bridge functionality of the neuray API. More...
- namespace
- Namespace for the HTTP server of the neuray API. More...
- namespace
- Namespace for the neuray API. More...
Classes
- class
- This class represents a Bridge application. More...
- class
- Abstract interface that can be used to control which sessions to a Bridge application are established, based on credentials supplied by the client. More...
- class
- API component that serves as entry point for the server-side Bridge API. More...
- class
- Context to import or remove snapshots. More...
- class
- Context for incremental snapshots. More...
- class
- Represents the server-side part of a job that can be executed by the Bridge server. More...
- class
- Represents the server side of a Bridge session. More...
- class
- Abstract interface for callbacks for session state changes. More...
- class
- Represents the server side of a Bridge transaction. More...
- class
- Abstract interface for callbacks for transaction commit or abort events. More...
- class
- This mixin class provides a default implementation for some of the methods needed by mi::bridge::IServer_job. More...
Enumerations
- enum {SERVER_SESSION_CONNECTING = 0, SERVER_SESSION_CONNECTED = 1, SERVER_SESSION_PENDING = 2, SERVER_SESSION_CLOSED = 3, SERVER_SESSION_FORCE_32_BIT = 0xffffffffU }
- The different states a server session can be in. More...