![]() |
Overview The create_operation operation returns a new operation definition (CORBA::OperationDef) contained in the interface definition (CORBA::InterfaceDef) on which it is invoked. Original interface InterfaceDef Interface Exceptions CORBA::SystemException
Intended Usage
The create_operation operation creates a new OperationDef in the Interface Repository and returns a pointer to the memory representation of the CORBA::OperationDef object. The id, name, version, result_def, mode, params, exceptions, and contexts attributes are set as specified. The result attribute is also set based on result_def. The defined_in attribute is initialized to identify the containing CORBA::InterfaceDef.
An error is returned if an object with the specified id already exists within the Interface Repository or if an object with the specified name already exists within this CORBA::InterfaceDef.
IDL Syntax
OperationDef create_operation (in RepositoryId id, in Identifier name, in VersionSpec version, in IDLType result, in OperationMode mode, In ParDescriptionSeq params, In ExceptionDefSeq exceptions, in ContextIdSeq contexts);
Input parameters
- id
- The id represents the CORBA::RepositoryId that will uniquely identify this CORBA::OperationDef within the Interface Repository.
- name
- The name that will be associated with this CORBA::OperationDef object in the Interface Repository.
- version
- The version number that will be associated with this CORBA::OperationDef object in the Interface Repository.
- result_def
- The result_def parameter is a CORBA::IDLType * that specifies the type of the return value for the CORBA::OperationDef.
- mode
- Valid operation mode values include CORBA::OP_NORMAL (normal operation) and CORBA::OP_ONEWAY (one way operation).
- params
- The sequence defines the list of parameters that are associated with the interface.
- exceptions
- The sequence defined the list of exceptions that are associated with the interface.
- contexts
- The sequence defines the list of contexts that are associated with the interface.
Return values
- OperationDef *
- The returned value is a pointer to the created CORBA::OperationDef object. The memory is owned by the caller and can be released using CORBA::release.
Example
// C++ // assume 'this_interface', 'this_struct', 'this_exception', and // assume 'this_interface', 'this_struct', 'this_exception', and // 'pk_long_ptr' have already been defined CORBA::InterfaceDef * this_interface; CORBA::StructDef * this_struct; CORBA::ExceptionDef * this_exception; CORBA::PrimitiveDef * pk_long_ptr; // establish the 'create_operation' parameters CORBA::RepositoryId rep_id = CORBA::string_dup ("UniqueRepositoryId"); CORBA::Identifier name = CORBA::string_dup ("this_operation"); CORBA::VersionSpec version = CORBA::string_dup ("1.0"); CORBA::IDLType * result_def = this_struct; CORBA::OperationMode mode = CORBA::OP_NORMAL; CORBA::ParDescriptionSeq params; params.length (1); params[0].name = CORBA::string_dup ("parameter_0"); params[0].type = CORBA::_tc_long; params[0].type_def = pk_long_ptr; params[0].mode = CORBA::PARAM_IN; CORBA::ExceptionDefSeq exceptions; exceptions.length (1); exceptions[0] = this_exception; CORBA::ContextIdSeq contexts; contexts.length (1); contexts[0] = CORBA::string_dup ("CONTEXTS_0=value_0"); // create the operation . . . CORBA::OperationDef * this_operation; this_operation = this_interface-> create_operation (rep_id, name, version, result_def, mode, params, exceptions, contexts);