The OperationDef
interface describes an IDL operation. It inherits from Contained
. The parameters and exceptions of the operation are not available directly as attributes but are available by using the Contained::describe( )
inherited operation.
An example use of OperationDef
is to construct an NVList
for a specific operation.
module CORBA { enum OperationMode { OP_NORMAL, OP_ONEWAY }; enum ParameterMode { PARAM_IN, PARAM_OUT, PARAM_INOUT }; struct ParameterDescription { Identifier <name>; TypeCode <type>; IDLType type_def; ParameterMode <mode>; } typedef sequence <ParameterDescription> ParDescriptionSeq; typedef Identifier <ContextIdentifier>; typedef sequence <ContextIdentifier> ContextIdSeq; typedef sequence <ExceptionDescription> ExcDescriptionSeq; interface OperationDef : Contained { readonly attribute TypeCode <result>; attribute IDLType <result_def>; attribute ParDescriptionSeq <params>; attribute OperationMode <mode>; attribute ContextIdSeq <contexts>; attribute ExceptionDefSeq <exceptions>; }; };
This method gives the list of context identifiers specified in the context clause of the operation.
attribute ContextIdentifierSeq contexts;
OperationDef::exceptions
is the list of exceptions that the operation can raise.
attribute ExceptionDefSeq
The operation describe( )
is inherited from Contained
. It returns a structure of type Contained::Description
:
struct Description { DefinitionKind <kind>; any <value>; };
<kind>
DefinitionKind
for the kind
member is dk_Operation
".
<value>
OperationDescription
:struct OperationDescription { Identifier <name>; RepositoryId <id>; RepositoryId defined_in; VersionSpec <version>; TypeCode <result>; OperationDef::OperationMode <mode>; ContextIdSeq <contexts>; ParDescriptionSeq <parameters>; ExcDescriptionSeq <exceptions>; };
The TypeCode
of the <value>
member is:
_tc_OperationDescription
Contained::describe( )
ExceptionDef
This method specifies whether the operation is normal (NORMAL
) or oneway (ONEWAY
).
attribute OperationMode <mode>;
Because the C++ compiler does not support nesting, NORMAL
is renamed to NORMAL_OP
. This prevents a conflict with the enum AttributeDef::AttributeMode
.
This method specifies the parameters for this operation.
attribute ParDescriptionSeq <params>;
It is a sequence of structures of type ParameterDescription
:
struct ParameterDescription { Identifier <name>; TypeCode <type>; IDLType type_def; ParameterMode <mode>; };
The <name>
member provides the name for the parameter. The <type>
member identifies the TypeCode
for the parameter. The <mode>
specifies whether the parameter is an in
PARAM_IN
), an out
(PARAM_OUT
), or an inout
(PARAM_INOUT
).
This method specifies the TypeCode
of the operation's return value.
readonly attribute TypeCode <result>;
CORBA::Typecode
OperationDef::result_def
This method defines the return type for this operation. The attribute result_def
also contains the return type and setting it also updates the result
attribute.
attribute IDLType <result_def>;