RealityServer Web Services API Programmer's Manual

Extensions

[RealityServer Web Services API]

Description

The RealityServer Web Services provides several ways in which to extend the core functionality. Custom User Commands

Custom User Data Types

Events

HTTP Authorization

State Setup

Web Services Protocols

User Access Control

Instances of each of these extensions are implemented in plugins and loaded at RealityServer Web Services startup.

To achieve this a special type of neuray library plugin is provided, mi::rswservices::IServices_plugin. Implement this class and register it with the neuray library in the usual manner. When mi::rswservices::IServices_plugin::initialize is called use mi::rswservices::IExtension_context to register RealityServer Web Services extensions. mi::rswservices::IServices_plugin::shutdown is called on exit at which time you can perform any required cleanup. Note that it is not necessary to remove installed extensions at shutdown. These methods are provided so extensions can be removed while RealityServer Web Services is running.

Below is a sample of how to install the Service_command_vector3_add command described in neuray Services commands.

‎#include <mi/rswservices.h>
#include "service_command_vector3_add.h"  // for Service_command_vector3_add

class Vector3_commands_plugin : public mi::rswservices::IServices_plugin
{
public:
    // Gets the name of the plugin
    virtual const char* get_name() const { return "Vector3 commands plugin"; }

    // Gets the version of the plugin
    virtual mi::Sint32 get_version() const { return 1; }

    // Gets the compiler used to compile the plugin
    virtual const char* get_compiler() const { return "unknown"; }

    // Releases the plugin giving back all allocated resources
    virtual void release() { delete this; }

    // Initializes the plugin
    virtual void initialize(mi::rswservices::IExtension_context* context)
    {
        if (context == NULL) {
            return;
        }
        Service_command_vector3_add *cmd = new Service_command_vector3_add();
        context->install_command(cmd);
        cmd->release();
    }
    virtual void shutdown(mi::rswservices::IExtension_context* context)
    {

    }
};

// Factory to create an instance of Vector3_commands_plugin
extern "C"
MI_DLL_EXPORT
mi::base::Plugin* mi_plugin_factory(
mi::Sint32 index,         // index of the plugin
void* context)            // context given to the library, ignore
{
    if( index != 0)
        return 0;
    return new Vector3_commands_plugin();
}

Classes

class 
Context which can be used to register user implemented functionality. More...
class 
The basic interface to be implemented by RealityServer Web Services plugins. More...

Defines

#define MI_REALITYSERVER_WEB_SERVICES_PLUGIN_TYPE
The plugin type for RealityServer(R) Web Services plugins.

Defines

#define MI_REALITYSERVER_WEB_SERVICES_PLUGIN_TYPE

The plugin type for RealityServer(R) Web Services plugins.

Value

"RealityServer Web Services API v3"