CORBA Programming Reference
Retrieves a parameter specified by the index input argument.
CORBA::Any * CORBA::TypeCode::parameter (
CORBA::Long Index) const;
This member function retrieves a parameter specified by the index input argument. For a list of parameters of each kind, see Table 14-2.
If the member function succeeds, the return value is a pointer to the parameter specified by the index input argument.
If the member function does not succeed, an exception is thrown.
The BEA Tuxedo software supports the throwing and catching of exceptions.
Caution: Use of the wrong exception constructor causes noninitialization of a data member. Exceptions that are defined to have a reason
field need to be created using the constructor that initializes that data member. If the default constructor is used instead, that data member is not initialized and, during destruction of the exception, the system may attempt to destroy nonexistent data.
When creating exceptions, be sure to use the constructor function that most fully initializes the data fields. These exceptions can be most easily identified by looking at the OMG IDL definition; they have additional data member definitions.
Descriptions of exception member functions follow:
This is the default constructor for the CORBA::SystemException
class. Minor code is initialized to 0 (zero) and the completion status is set to COMPLETED_NO
.
CORBA::SystemException::SystemException (
const CORBA::SystemException & Se)
CORBA::SystemException::SystemException(
CORBA::ULong Minor, CORBA::CompletionStatus Status)
This is the destructor for the CORBA::SystemException
class. It frees any memory used for the Exception object.
CORBA::SystemException CORBA::SystemException::operator =
const CORBA::SystemException Se)
This assignment operator copies exception information from the source exception. The Se
argument specifies the SystemException object that is to be copied by this operator.
CORBA::SystemException::completed(
CORBA::CompletionStatus Completed)
This member function sets the completion status for this exception. The Completed
argument specifies the completion status for this exception.
This member function sets the minor code for this exception. The minor
argument specifies the new minor code for this exception. The minor field is an implementation-specific value used by the application to identify the exception.
CORBA::SystemException * CORBA::SystemException::_narrow (
CORBA::Exception_ptr Exc)
This member function determines whether a specified exception can be narrowed to a system exception. The Exc
argument specifies the exception to be narrowed.
If the specified exception is a system exception, this member function returns a pointer to the system exception. If the specified exception is not a system exception, the function returns 0 (zero).
CORBA::UserException * CORBA::UserException::_narrow(
CORBA::Exception_ptr Exc)
This member function determines whether a specified exception can be narrowed to a user exception. The Exc
argument specifies the exception to be narrowed.
If the specified exception is a user exception, this member function returns a pointer to the user exception. If the specified exception is not a user exception, the function returns 0 (zero).
This section presents the standard exceptions defined for the ORB. These exception identifiers may be returned as a result of any operation invocation, regardless of the interface specification. Standard exceptions are not listed in raises
expressions.
To bound the complexity in handling the standard exceptions, the set of standard exceptions is kept to a tractable size. This constraint forces the definition of equivalence classes of exceptions, rather than enumerating many similar exceptions.
For example, an operation invocation can fail at many different points due to the inability to allocate dynamic memory. Rather than enumerate several different exceptions that correspond to the different ways that memory allocation failure causes the exception (during marshaling, unmarshaling, in the client, in the object implementation, allocating network packets, and so forth), a single exception corresponding to dynamic memory allocation failure is defined. Each standard exception includes a minor code to designate the subcategory of the exception; the assignment of values to the minor codes is left to each ORB implementation.
Each standard exception also includes a completion_status
code, which takes one of the following values:
The standard exceptions are defined below. Clients must be prepared to handle system exceptions that are not on this list, both because future versions of this specification may define additional standard exceptions, and because ORB implementations may raise nonstandard system exceptions. For more information about exceptions, see System Messages.
Table 14-3 defines the exceptions.
The CORBA::OBJECT_NOT_EXIST
exception is raised whenever an invocation on a deleted object is performed. It is an authoritative "hard" fault report. Anyone receiving it is allowed (even expected) to delete all copies of this object reference and to perform other appropriate "final recovery" style procedures.
The CORBA::TRANSACTION_REQUIRED
exception indicates that the request carried a NULL transaction context, but an active transaction is required.
The CORBA::TRANSACTION_ROLLEDBACK
exception indicates that the transaction associated with the request has already been rolled back or marked to roll back. Thus, the requested operation either could not be performed or was not performed because further computation on behalf of the transaction would be fruitless.
The CORBA::INVALID_TRANSACTION
indicates that the request carried an invalid transaction context. For example, this exception could be raised if an error occurred when trying to register a resource.
The ExceptionList
member functions allow a client or server application to provide a list of TypeCodes for all user-defined exceptions that may result when the Request is invoked. For a description of the Request member functions, see the section Request Member Functions.
The mapping of these member functions to C++ is as follows:
class CORBA
{
class ExceptionList
{
public:
Ulong count ();
void add(TypeCode_ptr tc);
void add_consume(TypeCode_ptr tc);
TypeCode_ptr item(Ulong index);
Status remove(Ulong index);
}; // ExceptionList
}// CORBA