diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2004-09-03 06:00:45 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2004-09-03 06:00:45 +0000 |
commit | 4cc66bca1246335c8bc53595499d3ca4301f7b37 (patch) | |
tree | a2a5cd600c2ee1eeb991f4a4854115ebfb70916c /TAO/tao/Exception.h | |
parent | 36fb06ddece99a6208807c8c3a3f48daedac91f8 (diff) | |
download | ATCD-4cc66bca1246335c8bc53595499d3ca4301f7b37.tar.gz |
ChangeLogTag:Thu Sep 2 22:21:35 2004 Ossama Othman <ossama@dre.vanderbilt.edu>
Diffstat (limited to 'TAO/tao/Exception.h')
-rw-r--r-- | TAO/tao/Exception.h | 295 |
1 files changed, 39 insertions, 256 deletions
diff --git a/TAO/tao/Exception.h b/TAO/tao/Exception.h index 76759a0e755..f0db1280c40 100644 --- a/TAO/tao/Exception.h +++ b/TAO/tao/Exception.h @@ -8,13 +8,13 @@ * * This file defines way in which CORBA exceptions are reported. * - * @author Copyright 1994-1995 by Sun Microsystems Inc. * @author DOC Group at Vanderbilt U., Wash U, and UCI */ //============================================================================= #ifndef TAO_EXCEPTION_H #define TAO_EXCEPTION_H + #include /**/ "ace/pre.h" // Do not try removing this. If you remove this for subsetting lots of @@ -32,11 +32,12 @@ #define TAO_RAISE(EXCEPTION) #endif /* ACE_HAS_EXCEPTIONS */ +#include "tao/TAO_Export.h" +#include "tao/Basic_Types.h" +#include "tao/CORBA_String.h" #include "ace/SStringfwd.h" #include "ace/iosfwd.h" #include "ace/CORBA_macros.h" -#include "tao/TAO_Export.h" -#include "tao/Basic_Types.h" class ACE_Allocator; @@ -63,26 +64,26 @@ class TAO_InputCDR; namespace CORBA { class TypeCode; - typedef TypeCode *TypeCode_ptr; + typedef TypeCode * TypeCode_ptr; class Environment; class Any; - typedef Any *Any_ptr; - - enum CompletionStatus - { - // = Completion Status for System exceptions + typedef Any * Any_ptr; - COMPLETED_YES, // successful or exceptional completion - COMPLETED_NO, // didn't change any state; retry is OK - COMPLETED_MAYBE // can't say what happened; retry unsafe - }; + class SystemException; + /** + * @enum exception_type + * + * @brief Enumeration used to identify the type of CORBA exception. + * + * CORBA exceptions generally fall into two categories, user + * exceptions and system exceptions. This enumeration is used when + * identifying the type of CORBA exception. + */ enum exception_type { - // = Exception type. - NO_EXCEPTION, USER_EXCEPTION, SYSTEM_EXCEPTION @@ -96,25 +97,18 @@ namespace CORBA * @brief Exception * * CORBA2-specified exception hierarchy. All exceptions have a - * type (represented by a TypeCode) and a widely scoped type ID - * (in the TypeCode) that generated by any OMG-IDL compiler and - * available through the Interface Repositories. Think of it as a + * type (represented by a @c TypeCode) and a widely scoped type ID + * (in the @c TypeCode) that are generated by any OMG-IDL compiler + * and available through the Interface Repository. Think of it as a * "globally scoped" name distinguishing each exception. + * + * @todo According to the OMG CORBA C++ Mapping version 1.1, all + * constructors, copy constructors and assignment operators + * should be moved to "protected" section in class + * declarations. Since the current MS Visual C++ 6.0 compiler + * will cause some problems to TAO's exception mechanism, we + * defer doing this until we drop support for MSVC++ 6. */ - - /* NOTE: - According to the OMG CORBA C++ Mapping version 1.1, all - constructors, copy constructors and assignment operators - should be moved to "protected" section in class declarations - - Since the current MS Visual C++ 6.0 compiler will cause some - problems to TAO's exception mechanism, so we defer doing this until - we full migrate from VC 6.0 to VC 7.0 and higher version. - - This later change only affect the "Exception.h" file and won't - affect the "Exception.cpp" file. - */ - class TAO_Export Exception { public: @@ -148,12 +142,14 @@ namespace CORBA // = To implement the narrow method. virtual int _is_a (const char* repository_id) const; - /// Constructor from a respository id. + /// Construct from a respository id. Exception (const char *repository_id, const char *local_name); - /// Print the exception <ex> to output determined by <f>. This - /// function is not CORBA compliant. + /// Print the exception to output determined by @a f. + /** + * @note This method is TAO-specific. + */ void _tao_print_exception (const char *info, FILE *f = stdout) const; @@ -195,233 +191,19 @@ namespace CORBA virtual CORBA::Exception *_tao_duplicate (void) const = 0; protected: - /// Default constructor is protected. - Exception (void); - - private: - /// Storage of our repository id and local name. - char *id_; - char *name_; - }; - - /** - * @class UserException - * - * @brief User exceptions are those defined by application developers - * using OMG-IDL. - */ - class TAO_Export UserException : public Exception - { - public: - - /// Copy constructor. - UserException (const UserException &src); - - /// Destructor. - ~UserException (void); - - /// Assignment operator. - UserException &operator= (const UserException &src); - - /// The narrow operation. - static UserException *_downcast (CORBA::Exception *exception); - - /// The const version of narrow operation - static const UserException *_downcast (const CORBA::Exception *exception); - - virtual void _raise (void) const = 0; - - // = TAO specific extension. - - /// Constructor from a repository id. - UserException (const char *repository_id, - const char *local_name); - - virtual int _is_a (const char *interface_id) const; - - // Used for narrowing - - /// Returns a string containing information about the exception. This - /// function is not CORBA compliant. - virtual ACE_CString _info (void) const; - //protected: /// Default constructor. - UserException (void); - }; - - - - /** - * @class SystemException - * - * @brief SystemException - * - * System exceptions are those defined in the CORBA spec; OMG-IDL - * defines these. - */ - class TAO_Export SystemException : public Exception - { - public: - /// Default constructtor - SystemException (void); - - - /// Copy constructor. - SystemException (const SystemException &src); - - /// Destructor. - ~SystemException (void); - - /// Assignment operator. - SystemException &operator= (const SystemException &src); - - /// Get the minor status. - ULong minor (void) const; - - /// Set the minor status. - void minor (ULong m); - - /// Get the completion status. - CORBA::CompletionStatus completed (void) const; - - /// Set the operation completion status. - void completed (CORBA::CompletionStatus c); - - /// Narrow to a SystemException. - static SystemException *_downcast (CORBA::Exception *exception); - - /// The const version of narrow operation to a SystemException - static const SystemException *_downcast(const CORBA::Exception *exception); - - virtual void _raise (void) const = 0; - - // = TAO-specific extension. - - /// Helper for the _downcast operation. - virtual int _is_a (const char *type_id) const; - - /// Print the system exception @c ex to output determined by @c f. - /// This function is not CORBA compliant. - void _tao_print_system_exception (FILE *f = stdout) const; - - /// Create an exception from the available exception - /// virtual CORBA::Exception *_tao_duplicate (void) const; - - /// Returns a string containing information about the exception. This - /// function is not CORBA compliant. - virtual ACE_CString _info (void) const; - - virtual void _tao_encode (TAO_OutputCDR &cdr - ACE_ENV_ARG_DECL_NOT_USED) const; - virtual void _tao_decode (TAO_InputCDR &cdr - ACE_ENV_ARG_DECL_NOT_USED); - - /// Helper to create a minor status value. - static CORBA::ULong _tao_minor_code (u_int location, - int errno_value); - - /// Helper to translate a platform-specific errno to a TAO errno - /// value. - static CORBA::ULong _tao_errno (int errno_value); - - /// Overridden base class method to help compilers that use - /// explicit template instantiations going - virtual CORBA::Exception *_tao_duplicate (void) const {return 0;} - - protected: - - /// Constructor using a repository id. - SystemException (CORBA::ULong code, - CORBA::CompletionStatus completed); - - /// Constructor using a repository id. - SystemException (const char *repository_id, - const char *local_name, - CORBA::ULong code, - CORBA::CompletionStatus completed); - - /// Return the exception description associated with the given OMG - /// minor code. - static const char *_tao_get_omg_exception_description ( - const CORBA::SystemException &exc, - CORBA::ULong minor_code); + Exception (void); private: - /// Minor code. - CORBA::ULong minor_; - /// Completion status. - CORBA::CompletionStatus completed_; + /// Repository Id + CORBA::String_var id_; - }; + /// Local name. + CORBA::String_var name_; - // Declarations for all of the CORBA standard exceptions. - // - // @@ - shouldn't have a default minor code, at least for code that's - // inside the ORB. All minor codes should be symbolically catalogued. - -#define TAO_SYSTEM_EXCEPTION(name) \ - class TAO_Export name : public SystemException \ - { \ - public: \ - name (void); \ - name (CORBA::ULong code, \ - CORBA::CompletionStatus completed); \ - static name * _downcast (CORBA::Exception* exception); \ - virtual void _raise (void) const; \ - virtual CORBA::TypeCode_ptr _type (void) const; \ - static void _tao_any_destructor (void*); \ - virtual CORBA::Exception *_tao_duplicate (void) const; \ - static CORBA::SystemException *_tao_create (void); \ - }; \ - TAO_Export void operator<<= (CORBA::Any &, const CORBA::name &); \ - TAO_Export void operator<<= (CORBA::Any &, CORBA::name *); \ - TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, \ - const CORBA::name *&) - - TAO_SYSTEM_EXCEPTION(UNKNOWN); // the unknown exception - TAO_SYSTEM_EXCEPTION(BAD_PARAM); // an invalid parameter was passed - TAO_SYSTEM_EXCEPTION(NO_MEMORY); // memory allocation failure - TAO_SYSTEM_EXCEPTION(IMP_LIMIT); // violated implementation limit - TAO_SYSTEM_EXCEPTION(COMM_FAILURE); // communication failure - TAO_SYSTEM_EXCEPTION(INV_OBJREF); // invalid object reference - TAO_SYSTEM_EXCEPTION(OBJECT_NOT_EXIST); // no such object - TAO_SYSTEM_EXCEPTION(NO_PERMISSION); // no permission for operation - TAO_SYSTEM_EXCEPTION(INTERNAL); // ORB internal error - TAO_SYSTEM_EXCEPTION(MARSHAL); // error marshaling param/result - TAO_SYSTEM_EXCEPTION(INITIALIZE); // ORB initialization failure - TAO_SYSTEM_EXCEPTION(NO_IMPLEMENT); // implementation unavailable - TAO_SYSTEM_EXCEPTION(BAD_TYPECODE); // bad typecode - TAO_SYSTEM_EXCEPTION(BAD_OPERATION); // invalid operation - TAO_SYSTEM_EXCEPTION(NO_RESOURCES); // out of resources for request - TAO_SYSTEM_EXCEPTION(NO_RESPONSE); // response not yet available - TAO_SYSTEM_EXCEPTION(PERSIST_STORE); // persistent storage failure - TAO_SYSTEM_EXCEPTION(BAD_INV_ORDER); // routine invocations out of order - TAO_SYSTEM_EXCEPTION(TRANSIENT); // transient error, try again later - TAO_SYSTEM_EXCEPTION(FREE_MEM); // cannot free memory - TAO_SYSTEM_EXCEPTION(INV_IDENT); // invalid identifier syntax - TAO_SYSTEM_EXCEPTION(INV_FLAG); // invalid flag was specified - TAO_SYSTEM_EXCEPTION(INTF_REPOS); // interface repository unavailable - TAO_SYSTEM_EXCEPTION(BAD_CONTEXT); // error processing context object - TAO_SYSTEM_EXCEPTION(OBJ_ADAPTER); // object adapter failure - TAO_SYSTEM_EXCEPTION(DATA_CONVERSION); // data conversion error - TAO_SYSTEM_EXCEPTION(INV_POLICY); // invalid policies present - TAO_SYSTEM_EXCEPTION(REBIND); // rebind needed - TAO_SYSTEM_EXCEPTION(TIMEOUT); // operation timed out - TAO_SYSTEM_EXCEPTION(TRANSACTION_UNAVAILABLE); // no transaction - TAO_SYSTEM_EXCEPTION(TRANSACTION_MODE); // invalid transaction mode - TAO_SYSTEM_EXCEPTION(TRANSACTION_REQUIRED); // operation needs transaction - TAO_SYSTEM_EXCEPTION(TRANSACTION_ROLLEDBACK); // operation was a no-op - TAO_SYSTEM_EXCEPTION(INVALID_TRANSACTION); // invalid TP context passed - TAO_SYSTEM_EXCEPTION(CODESET_INCOMPATIBLE); // incompatible code set - TAO_SYSTEM_EXCEPTION(BAD_QOS); // bad quality of service - TAO_SYSTEM_EXCEPTION(INVALID_ACTIVITY); - TAO_SYSTEM_EXCEPTION(ACTIVITY_COMPLETED); - TAO_SYSTEM_EXCEPTION(ACTIVITY_REQUIRED); - TAO_SYSTEM_EXCEPTION(THREAD_CANCELLED); - -#undef TAO_SYSTEM_EXCEPTION + }; #if !defined (ACE_LACKS_IOSTREAM_TOTALLY) @@ -461,7 +243,7 @@ public: ACE_ENV_ARG_DECL); /// Runtime initialization of all standard exception typecodes. - /// Called from <CORBA::ORB_init>. + /// Called from @c CORBA::ORB_init. static void init (ACE_ENV_SINGLE_ARG_DECL); /// Runtime finalization of all standard exception typecodes. @@ -509,4 +291,5 @@ TAO_Export void operator<<= (CORBA::Any &, CORBA::Exception *); #endif /* __ACE_INLINE__ */ #include /**/"ace/post.h" + #endif /* TAO_EXCEPTION_H */ |