neuray API Programmer's Manual

mi::bridge::IApplication Class Reference

[Bridge server]

Description

This class represents a Bridge application. When a client opens a session to a Bridge server it also specifies the application it wants to connect to. The features of the application are defined by the Bridge jobs registered with the application.

See also:

mi::bridge::IBridge_server::create_application()

Public Member Functions

virtual Sint32 close() =0
Closes the application and any open sessions. More...
virtual const char* get_disk_cache() const =0
Returns the disk cache location. More...
virtual base::​Message_severity get_log_forwarding_limit() const =0
Returns the maximum verbosity of log messages that will be forwarded to the client. More...
virtual IApplication_session_handlerget_session_handler() const =0
Returns the current session handler, or NULL if no session handler has been set.
virtual bool  is_open() =0
Indicates whether the application is open, i.e., whether it accepts client sessions.
virtual Sint32 open() =0
Opens the application so that clients can open sessions to it. More...
virtual Sint32 register_job( const base::​Uuid& job_class_id, neuraylib::​IUser_class_factory* factory) =0
Registers a Bridge job with the application. More...
template< class T>Sint32 register_job()
Registers a Bridge job with the application. More...
virtual Sint32 set_disk_cache( const char* location) =0
Sets the disk cache to use. More...
virtual Sint32 set_log_forwarding_limit( base::​Message_severity limit) =0
Sets the maximum verbosity of log messages that will be forwarded to the client. More...
virtual Sint32 set_session_handler( IApplication_session_handler* handler) =0
Sets the session handler that will be called when clients connect. More...
virtual Sint32 unregister_job( const base::​Uuid& job_class_id) =0
Unregisters a Bridge job with the application. More...
template< class T>Sint32 unregister_job()
Unregisters a Bridge job with the application. More...

Member Functions

virtual Sint32 mi::​bridge::​IApplication::close() [pure virtual]

Closes the application and any open sessions.

Returns

  • 0: Success.
  • -1: The application is already closed.
  • <= -2: Unspecified error.

virtual const char* mi::​bridge::​IApplication::get_disk_cache() const [pure virtual]

Returns the disk cache location.

See also:

set_disk_cache()

virtual base::​Message_severity mi::​bridge::​IApplication::get_log_forwarding_limit() const [pure virtual]

Returns the maximum verbosity of log messages that will be forwarded to the client.

See also:

set_log_forwarding_limit()

Returns

The current log forwarding limit

virtual IApplication_session_handler* mi::​bridge::​IApplication::get_session_handler() const [pure virtual]

Returns the current session handler, or NULL if no session handler has been set.

virtual bool mi::​bridge::​IApplication::is_open() [pure virtual]

Indicates whether the application is open, i.e., whether it accepts client sessions.

virtual Sint32 mi::​bridge::​IApplication::open() [pure virtual]

Opens the application so that clients can open sessions to it.

See also:

set_disk_cache()).

  • -2: The application is already open.

  • <= -3: Unspecified error.

Returns

  • 0: Success
  • -1: Mandatory configuration is incomplete (

virtual Sint32 mi::​bridge::​IApplication::register_job( const base::​Uuid& job_class_id, neuraylib::​IUser_class_factory* factory) [pure virtual]

Registers a Bridge job with the application. All jobs to be executed via the Bridge need to be registered with the corresponding application.

See also:

unregister_job()

Parameters

job_class_id
The class ID of the job. You can simply pass IID() of your class derived from mi::bridge::IServer_job.
factory
The factory method of the job.

Returns

0 in case of success, <0 in case of failure.

template< class T>

Sint32 mi::​bridge::​IApplication::register_job() [inline]

Registers a Bridge job with the application. All jobs to be executed via the Bridge need to be registered with the corresponding application.

This templated member function is a wrapper of the non-template variant for the user's convenience. It uses the default class factory mi::neuraylib::User_class_factory specialized for T.

See also:

unregister_job()

Returns

0 in case of success, <0 in case of failure.

virtual Sint32 mi::​bridge::​IApplication::set_disk_cache( const char* location) [pure virtual]

Sets the disk cache to use.

Note:

The disk cache must be set before the application can be opened for client sessions. The disk cache can not be changed after it has been successfully set.

See also:

get_disk_cache(), mi::neuraylib::ICache_manager_factory

Parameters

location
The location of the disk cache. This can be either a directory on the local machine (prefix "path:") or the address of some cache manager (prefix "address:").

Returns

  • 0: Success.
  • -1: Invalid argument (disk_cache is NULL or has an incorrect format).
  • -2: No disk cache found at the specified location.
  • -3: The disk cache was already set.
  • <= -4: Unspecified error.

virtual Sint32 mi::​bridge::​IApplication::set_log_forwarding_limit( base::​Message_severity limit) [pure virtual]

Sets the maximum verbosity of log messages that will be forwarded to the client. Note that the log level that will be forwarded is requested by the client, and this setting will only override the client request in case the server needs to restrict logging further, for instance because of security considerations. So if the client requests that info level messages and more severe will be forwarded and the server sets the limit to warning severity, then only warning log messages will be forwarded.

Defaults to mi::base::details::MESSAGE_SEVERITY_DEBUG which will allow the client to request forwarding of all log messages. Set to mi::base::details::MESSAGE_SEVERITY_FATAL to turn of log forwarding.

See also:

get_log_forwarding_limit()

Parameters

limit
The log message limit to set.
virtual Sint32 mi::​bridge::​IApplication::set_session_handler( IApplication_session_handler* handler) [pure virtual]

Sets the session handler that will be called when clients connect. The session handler will be called as part of the handshake between client and server to decide whether to accept or to reject the client, e.g., based on a security token supplied by the client. The server will always accept clients if no session handler is set (default behavior). The session handler can also be used to keep track of which sessions are connected to the application and their state by adding an mi::bridge::IServer_session_state_callback to the session.

Parameters

handler
The handler to be set or NULL to remove the current handler.
virtual Sint32 mi::​bridge::​IApplication::unregister_job( const base::​Uuid& job_class_id) [pure virtual]

Unregisters a Bridge job with the application.

See also:

register_job()

Parameters

job_class_id
The class id of the job.

Returns

0 in case of success, <0 in case of failure.

template< class T>

Sint32 mi::​bridge::​IApplication::unregister_job() [inline]

Unregisters a Bridge job with the application. This templated member function is a wrapper of the non-template variant for the user's convenience.

See also:

register_job()

Returns

0 in case of success, <0 in case of failure.