Overview | The create_exception operation returns a new exception definition (CORBA::ExceptionDef) contained in the CORBA::Container on which it is invoked. |
Original interface | CORBA module: Container Interface |
Exceptions | CORBA::SystemException |
Intended Usage
The create_exception operation returns a new CORBA::ExceptionDef contained in the CORBA::Container on which it is invoked. A representation of the new CORBA::ExceptionDef object is created in the Interface Repository persistent database and a pointer to the memory representation of the CORBA::ExceptionDef object is returned to the caller.
The id, name, version, and members attributes are set as specified. The type attribute is also set.
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 the CORBA::Container on which the create_exception is invoked.
Syntax
ExceptionDef * create_exception(RepositoryId id Indentifier name VersionSpec version StructMemberSeq & members);
Input parameters
The members parameter defines the members of the exception definition. Each element of the members parameter has 3 fields. The name field is the name of the element. The type field (a reference to a CORBA::TypeCode *) is not used for create_exception and should be set to CORBA::_tc_void. The type_def field references a CORBA::IDLType * that defines the type definition of the member element.
The members parameter can have a length of zero to indicate that the exception definition has no members.
Return values
Example
// C++ // assume that 'this_module' and 'this_struct' // have already been initialized CORBA::ModuleDef * this_module; CORBA::StructDef * this_struct; // establish the 'create_exception' rep_id, name, and version parameters CORBA::RepositoryId rep_id = "UniqueRepositoryId"; CORBA::Identifier name = "this_exception"; CORBA::VersionSpec version = "1.0"; // establish and initialize a CORBA::StructMemberSeq // with which to create the CORBA::ExceptionDef CORBA::StructMemberSeq members_list; members_list length (1); members_list[0].name = CORBA::string_dup ("exception_0"); members_list[0].type = CORBA::_tc_void; members_list[0].type_def = this_struct; // create the exception definition this_module-> create_exception ( rep_id, name, version, members_list); delete (members_list); //cleanup.