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.
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
Return values
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);