icommand.h File Reference
Description
neuray services command system
Code Example
icommand.h
//*****************************************************************************
// Copyright 1986, 2011 NVIDIA Corporation. All rights reserved.
//*****************************************************************************
//*****************************************************************************
#ifndef MI_NSERVICES_ICOMMAND_H
#define MI_NSERVICES_ICOMMAND_H
#include <mi/nservices/ifactory.h>
#include <mi/neuraylib/iuser_class.h>
#include <mi/base/handle.h>
namespace mi {
class IData;
class IString;
class IMap;
namespace neuraylib {
class IPlugin_api;
class IScope;
class ITransaction;
}
namespace nservices {
class ICommand_context;
class ICommand_request;
class ICommand_response;
class IEvent_context;
class IScene;
class IConverter;
class ICommand_context : public
mi::base::Interface_declare<0xEC0692F7,0x67B0,0x4EC8,0xA1,0x7E,0x54,0x93,0xFD,0x51,0x21,0x90>
{
public:
// command information
virtual const char * get_command_name() const = 0;
virtual Uint32
get_num_arguments() const = 0;
virtual const IData *get_argument(const char *name) const = 0;
virtual Sint32
get_argument(
Uint32 index,
const char **name,
const IData **value) const = 0;
template <class T>
const T* get_argument(const char *name) const {
const base::IInterface *ptr_iinterface = get_argument(name);
if (ptr_iinterface) {
const T *ptr_T = ptr_iinterface->get_interface<T>();
ptr_iinterface->release();
return ptr_T;
}
return NULL;
};
virtual const ICommand_response* execute_command(ICommand_request *command_request) = 0;
virtual ICommand_response* create_command_response()const = 0;
// neuray library
virtual neuraylib::IPlugin_api* get_plugin_api() const = 0;
virtual neuraylib::ITransaction* get_transaction() = 0;
virtual Sint32
create_new_transaction(bool commit=true) = 0;
virtual Sint32
change_scope(const char *scope_name) = 0;
virtual Sint32
change_scope(neuraylib::IScope *scope) = 0;
virtual neuraylib::ITransaction* get_user_state() = 0;
// data
virtual IConverter *get_converter() const = 0;
// events
virtual IEvent_context* get_event_context() const = 0;
virtual IFactory *get_factory() const = 0;
// attachments
virtual IMap* get_attachments()const = 0;
virtual IMap* get_command_attachments()const = 0;
};
class IArgument_description : public
mi::base::Interface_declare<0x610AE7D9,0x3399,0x4BE4,0xA4,0x0D,0x4B,0x88,0x5F,0x0E,0xB5,0x83>
{
public:
virtual void set_name(const char *name) = 0;
virtual const char *get_name() const = 0;
virtual void set_type_name(const char *type_name) = 0;
virtual const char *get_type_name() const = 0;
virtual void set_description(const char *description) = 0;
virtual const char *get_description() const = 0;
virtual bool has_default_value() const = 0;
virtual mi::Sint32
set_default_value(const IData *value) = 0;
virtual const IData *get_default_value() const = 0;
};
class IService_command : public
mi::base::Interface_declare<0x8C0D5810,0x4381,0x4C11,0xBB,0x7E,0xBD,0xCE,0xEA,0x3A,0x99,0x01>
{
public:
virtual const char *get_name() const = 0;
virtual const char *get_namespace() const = 0;
virtual const char *get_description() const = 0;
virtual Sint32
get_argument_description(
IFactory *factory,
const char *argument_name,
IArgument_description *argument) const = 0;
virtual Sint32
get_argument_description(
IFactory *factory,
Uint32 index,
IArgument_description *argument) const = 0;
virtual const char *get_return_type_name() const = 0;
// If the method
virtual const ICommand_response *execute(ICommand_context *context) const = 0;
virtual const char* get_return_description()const = 0;
virtual const char* get_metadata(const char *key)const = 0;
virtual const char* get_metadata_key(mi::Uint32 index)const = 0;
virtual const char* get_metadata_value(mi::Uint32 index)const = 0;
};
class ICommand_request : public
mi::base::Interface_declare<0x137B0549,0xF6F0,0xDBDA,0x7B,0x58,0x0D,0x36,0x74,0xDC,0xC4,0xC9>
{
public:
virtual const char * get_command_name() const = 0;
virtual Uint32
get_num_arguments() const = 0;
virtual const IData *get_argument(const char *name) const = 0;
template <class T>
const T* get_argument(const char *name) const {
const base::IInterface *ptr_iinterface = get_argument(name);
if (ptr_iinterface) {
const T *ptr_T = ptr_iinterface->get_interface<T>();
ptr_iinterface->release();
return ptr_T;
}
return NULL;
};
virtual Sint32
get_argument(
Uint32 index,
const char **name,
const IData **value) const = 0;
virtual void set_command_name(const char *command) = 0;
virtual Sint32
set_argument(const char *name, const IData *value) = 0;
virtual IMap *get_attachments()const = 0;
};
class ICommand_response : public
mi::base::Interface_declare<0x46F33C7D,0xE1E4,0xE5FA,0x63,0xAA,0x71,0x69,0x7E,0x95,0x44,0x4B>
{
public:
virtual const ICommand_request* get_request() const = 0;
virtual bool is_error() const = 0;
virtual Sint32
get_error_code() const = 0;
virtual const char *get_error_message() const = 0;
virtual const IData* get_extra_error_information() const = 0;
template <class T>
const T* get_extra_error_information() const {
const base::IInterface *ptr_iinterface = get_extra_error_information();
if (ptr_iinterface) {
const T *ptr_T = ptr_iinterface->get_interface<T>();
ptr_iinterface->release();
return ptr_T;
}
return NULL;
};
virtual const IData* get_result() const = 0;
template <class T>
const T* get_result() const {
const base::IInterface *ptr_iinterface = get_result();
if (ptr_iinterface) {
const T *ptr_T = ptr_iinterface->get_interface<T>();
ptr_iinterface->release();
return ptr_T;
}
return NULL;
};
virtual void set_error(Sint32 code,
const char *message,
const IData *extra_information = NULL) = 0;
virtual void set_result(const IData *value) = 0;
};
class IPath_remapper : public
mi::base::Interface_declare<0xF414D5E6,0xF037,0x42FD,0x93,0xEA,0x89,0x90,0xA7,0x2A,0xDD,0x7D>
{
public:
virtual IString *get_absolute_path(const char *path) const = 0;
};
// end group mi_nservices_commands
} // namespace nservices
} // namespace mi
#endif // MI_NSERVICES_ICOMMAND_H
Namespaces
- namespace mi
- namespace mi::neuraylib
- namespace
- Namespace for the neuray Services API. More...
Classes
- class
- Describes an argument to a service command. More...
- class
- The context is which a command is executed. More...
- class
- A request to execute a web service command. More...
- class
- A response from a neuray service command. More...
- class
- This class is used to map relative paths passed in as arguments to commands to absolute paths on the local filesystem. More...
- class
- Interface for Neuray Service Commands. More...