neuray Services API Programmer's Manual

mi::nservices::ICommand_response Class Reference

[Commands]

Description

A response from a neuray service command. If is_error() == false then get_result() will contain the result of the command otherwise a detailed error code can be obtained from get_error_code().

Public Member Functions

virtual mi::Sint32 copy_from( const ICommand_response* response) =0
Shallow copies the response from another command response into this one. More...
virtual Sint32 get_error_code() const =0
Returns the error code. More...
virtual const char* get_error_message() const =0
Returns the error message, if there is no error returns an empty string.
virtual const IDataget_extra_error_information() const =0
Returns the extra error information, if no extra information returns NULL.
template< class T>const T* get_extra_error_information() const
Returns the extra error information, if no extra information returns NULL. More...
virtual const ICommand_requestget_request() const =0
Returns the request associated with this response. More...
virtual const IDataget_result() const =0
Returns the result of the command Do not rely on the return value of this to indicate success or failure as NULL is a valid result. More...
template< class T>const T* get_result() const
Returns the result of the command Do not rely on the return value of this to indicate success or failure as NULL is a valid result. More...
virtual bool  is_error() const =0
Indicates whether an error occurred. More...
virtual void set_error( Sint32 code, const char* message, const IData* extra_information = NULL) =0
Flag that an error has occurred. More...
virtual void set_result( const IData* value) =0
Sets the result of the command. More...

Member Functions

virtual mi::Sint32 mi::​nservices::​ICommand_response::copy_from( const ICommand_response* response) [pure virtual]

Shallow copies the response from another command response into this one. This is useful if a command wants to return the response of another command called via ICommand_context::execute_command.

Parameters

response
the command response to copy from

Returns

  • NRS_ERROR_NONE success.
  • NRS_ERROR_INVALID_PARAMETERS response is NULL

virtual Sint32 mi::​nservices::​ICommand_response::get_error_code() const [pure virtual]

Returns the error code. see Commands for information on command errors

virtual const char* mi::​nservices::​ICommand_response::get_error_message() const [pure virtual]

Returns the error message, if there is no error returns an empty string.

virtual const IData* mi::​nservices::​ICommand_response::get_extra_error_information() const [pure virtual]

Returns the extra error information, if no extra information returns NULL.

template< class T>

const T* mi::​nservices::​ICommand_response::get_extra_error_information() const [inline]

Returns the extra error information, if no extra information returns NULL. This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to call mi::base::IInterface::get_interface(const Uuid&) on the returned pointer, since the return type already is a pointer to the type T specified as template parameter.

Returns

The error information.

virtual const ICommand_request* mi::​nservices::​ICommand_response::get_request() const [pure virtual]

Returns the request associated with this response.

Returns

The request, NULL if no request has been associated.

virtual const IData* mi::​nservices::​ICommand_response::get_result() const [pure virtual]

Returns the result of the command Do not rely on the return value of this to indicate success or failure as NULL is a valid result. Use is_error() to determine errors.

Returns

The result.

template< class T>

const T* mi::​nservices::​ICommand_response::get_result() const [inline]

Returns the result of the command Do not rely on the return value of this to indicate success or failure as NULL is a valid result. Use is_error() to determine errors.

This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to call mi::base::IInterface::get_interface(const Uuid&) on the returned pointer, since the return type already is a pointer to the type T specified as template parameter.

Returns

The result.

virtual bool mi::​nservices::​ICommand_response::is_error() const [pure virtual]

Indicates whether an error occurred.

Returns

true if an error occurred

virtual void mi::​nservices::​ICommand_response::set_error( Sint32 code, const char* message, const IData* extra_information = NULL) [pure virtual]

Flag that an error has occurred. see Commands for information on command errors

Parameters

code
the error code
message
the error message
extra_information
Optional argument containing additional error information.
virtual void mi::​nservices::​ICommand_response::set_result( const IData* value) [pure virtual]

Sets the result of the command.

Note:

Parameters

value
the result. NULL is valid.