00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file SystemException.h 00006 * 00007 * SystemException.h,v 1.11 2006/01/16 16:52:08 olli Exp 00008 * 00009 * CORBA::SystemException class header. 00010 * 00011 * @author DOC Group at Vanderbilt U, Wash U, and UCI 00012 * @author Ossama Othman <ossama@dre.vanderbilt.edu> 00013 */ 00014 //============================================================================= 00015 00016 #ifndef TAO_SYSTEM_EXCEPTION_H 00017 #define TAO_SYSTEM_EXCEPTION_H 00018 00019 #include /**/ "ace/pre.h" 00020 00021 // Do not try removing this. If you remove this for subsetting lots of 00022 // things go wrong in TAO. 00023 #include "tao/orbconf.h" 00024 00025 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00026 # pragma once 00027 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00028 00029 #include "tao/Exception.h" 00030 00031 00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00033 00034 class TAO_OutputCDR; 00035 class TAO_InputCDR; 00036 00037 #if defined (THREAD_CANCELLED) 00038 #undef THREAD_CANCELLED 00039 #endif /* THREAD_CANCELLED */ 00040 00041 // This is already done in orbconf.h. But this file is totally 00042 // decoupled from its contents that we have to do this here. Including 00043 // orbconf.h is probably going to be a overhead. 00044 #if defined (minor) 00045 #undef minor 00046 #endif /* minor */ 00047 00048 namespace CORBA 00049 { 00050 class SystemException; 00051 } 00052 00053 namespace TAO 00054 { 00055 typedef CORBA::SystemException* (*excp_factory)(void); 00056 } 00057 00058 namespace CORBA 00059 { 00060 class Environment; 00061 00062 /** 00063 * @enum CompletionStatus 00064 * 00065 * @brief Completion status for CORBA system exceptions 00066 * 00067 * Enumerations that denote how an operation was (not) completed 00068 * when a @c CORBA::SystemException is thrown. 00069 */ 00070 enum CompletionStatus 00071 { 00072 COMPLETED_YES, ///< Successful or exceptional completion. 00073 COMPLETED_NO, ///< Didn't change any state; retry is OK. 00074 COMPLETED_MAYBE ///< Can't say what happened; retry unsafe. 00075 }; 00076 00077 /** 00078 * @class SystemException 00079 * 00080 * @brief SystemException 00081 * 00082 * System exceptions are those defined in the CORBA specification; 00083 * OMG-IDL defines these. 00084 */ 00085 class TAO_Export SystemException : public Exception 00086 { 00087 public: 00088 00089 /// Copy constructor. 00090 SystemException (const SystemException & src); 00091 00092 /// Destructor. 00093 virtual ~SystemException (void); 00094 00095 /// Get the minor status. 00096 ULong minor (void) const; 00097 00098 /// Set the minor status. 00099 void minor (ULong m); 00100 00101 /// Get the completion status. 00102 CORBA::CompletionStatus completed (void) const; 00103 00104 /// Set the operation completion status. 00105 void completed (CORBA::CompletionStatus c); 00106 00107 /// Narrow to a SystemException. 00108 static SystemException *_downcast (CORBA::Exception *exception); 00109 00110 /// The const version of narrow operation to a SystemException 00111 static const SystemException *_downcast(const CORBA::Exception *exception); 00112 00113 virtual void _raise (void) const = 0; 00114 00115 // = TAO-specific extension. 00116 00117 /// Print the system exception @c ex to output determined by @c f. 00118 /// This function is not CORBA compliant. 00119 void _tao_print_system_exception (FILE *f = stdout) const; 00120 00121 /// Returns a string containing information about the exception. This 00122 /// function is not CORBA compliant. 00123 virtual ACE_CString _info (void) const; 00124 00125 virtual void _tao_encode (TAO_OutputCDR &cdr 00126 ACE_ENV_ARG_DECL) const; 00127 00128 virtual void _tao_decode (TAO_InputCDR &cdr 00129 ACE_ENV_ARG_DECL); 00130 00131 /// Helper to create a minor status value. 00132 static CORBA::ULong _tao_minor_code (u_int location, 00133 int errno_value); 00134 00135 /// Helper to translate a platform-specific errno to a TAO errno 00136 /// value. 00137 static CORBA::ULong _tao_errno (int errno_value); 00138 00139 /// Deep copy 00140 virtual CORBA::Exception *_tao_duplicate (void) const; 00141 00142 protected: 00143 00144 /// Default constructor. 00145 SystemException (void); 00146 00147 /// Assignment operator. 00148 SystemException & operator= (const SystemException &src); 00149 00150 /// Constructor using a repository id. 00151 SystemException (CORBA::ULong code, 00152 CORBA::CompletionStatus completed); 00153 00154 /// Constructor using a repository id. 00155 SystemException (const char *repository_id, 00156 const char *local_name, 00157 CORBA::ULong code, 00158 CORBA::CompletionStatus completed); 00159 00160 /// Return the exception description associated with the given OMG 00161 /// minor code. 00162 static const char *_tao_get_omg_exception_description ( 00163 const CORBA::SystemException &exc, 00164 CORBA::ULong minor_code); 00165 00166 private: 00167 /// Minor code. 00168 CORBA::ULong minor_; 00169 00170 /// Completion status. 00171 CORBA::CompletionStatus completed_; 00172 00173 }; 00174 00175 // Declarations for all of the CORBA standard exceptions. 00176 // 00177 // @@ - shouldn't have a default minor code, at least for code that's 00178 // inside the ORB. All minor codes should be symbolically catalogued. 00179 00180 #define TAO_SYSTEM_EXCEPTION(name) \ 00181 class TAO_Export name : public SystemException \ 00182 { \ 00183 public: \ 00184 name (void); \ 00185 name (CORBA::ULong code, \ 00186 CORBA::CompletionStatus completed); \ 00187 static name * _downcast (CORBA::Exception* exception); \ 00188 static name const * _downcast (CORBA::Exception const * exception); \ 00189 virtual void _raise (void) const; \ 00190 virtual CORBA::TypeCode_ptr _tao_type (void) const; \ 00191 static void _tao_any_destructor (void*); \ 00192 virtual CORBA::Exception *_tao_duplicate (void) const; \ 00193 static CORBA::SystemException *_tao_create (void); \ 00194 }; \ 00195 00196 TAO_SYSTEM_EXCEPTION(UNKNOWN) // the unknown exception 00197 TAO_SYSTEM_EXCEPTION(BAD_PARAM) // an invalid parameter was passed 00198 TAO_SYSTEM_EXCEPTION(NO_MEMORY) // memory allocation failure 00199 TAO_SYSTEM_EXCEPTION(IMP_LIMIT) // violated implementation limit 00200 TAO_SYSTEM_EXCEPTION(COMM_FAILURE) // communication failure 00201 TAO_SYSTEM_EXCEPTION(INV_OBJREF) // invalid object reference 00202 TAO_SYSTEM_EXCEPTION(OBJECT_NOT_EXIST) // no such object 00203 TAO_SYSTEM_EXCEPTION(NO_PERMISSION) // no permission for operation 00204 TAO_SYSTEM_EXCEPTION(INTERNAL) // ORB internal error 00205 TAO_SYSTEM_EXCEPTION(MARSHAL) // error marshaling param/result 00206 TAO_SYSTEM_EXCEPTION(INITIALIZE) // ORB initialization failure 00207 TAO_SYSTEM_EXCEPTION(NO_IMPLEMENT) // implementation unavailable 00208 TAO_SYSTEM_EXCEPTION(BAD_TYPECODE) // bad typecode 00209 TAO_SYSTEM_EXCEPTION(BAD_OPERATION) // invalid operation 00210 TAO_SYSTEM_EXCEPTION(NO_RESOURCES) // out of resources for request 00211 TAO_SYSTEM_EXCEPTION(NO_RESPONSE) // response not yet available 00212 TAO_SYSTEM_EXCEPTION(PERSIST_STORE) // persistent storage failure 00213 TAO_SYSTEM_EXCEPTION(BAD_INV_ORDER) // routine invocations out of order 00214 TAO_SYSTEM_EXCEPTION(TRANSIENT) // transient error, try again later 00215 TAO_SYSTEM_EXCEPTION(FREE_MEM) // cannot free memory 00216 TAO_SYSTEM_EXCEPTION(INV_IDENT) // invalid identifier syntax 00217 TAO_SYSTEM_EXCEPTION(INV_FLAG) // invalid flag was specified 00218 TAO_SYSTEM_EXCEPTION(INTF_REPOS) // interface repository unavailable 00219 TAO_SYSTEM_EXCEPTION(BAD_CONTEXT) // error processing context object 00220 TAO_SYSTEM_EXCEPTION(OBJ_ADAPTER) // object adapter failure 00221 TAO_SYSTEM_EXCEPTION(DATA_CONVERSION) // data conversion error 00222 TAO_SYSTEM_EXCEPTION(INV_POLICY) // invalid policies present 00223 TAO_SYSTEM_EXCEPTION(REBIND) // rebind needed 00224 TAO_SYSTEM_EXCEPTION(TIMEOUT) // operation timed out 00225 TAO_SYSTEM_EXCEPTION(TRANSACTION_UNAVAILABLE) // no transaction 00226 TAO_SYSTEM_EXCEPTION(TRANSACTION_MODE) // invalid transaction mode 00227 TAO_SYSTEM_EXCEPTION(TRANSACTION_REQUIRED) // operation needs transaction 00228 TAO_SYSTEM_EXCEPTION(TRANSACTION_ROLLEDBACK) // operation was a no-op 00229 TAO_SYSTEM_EXCEPTION(INVALID_TRANSACTION) // invalid TP context passed 00230 TAO_SYSTEM_EXCEPTION(CODESET_INCOMPATIBLE) // incompatible code set 00231 TAO_SYSTEM_EXCEPTION(BAD_QOS) // bad quality of service 00232 TAO_SYSTEM_EXCEPTION(INVALID_ACTIVITY) 00233 TAO_SYSTEM_EXCEPTION(ACTIVITY_COMPLETED) 00234 TAO_SYSTEM_EXCEPTION(ACTIVITY_REQUIRED) 00235 TAO_SYSTEM_EXCEPTION(THREAD_CANCELLED) 00236 00237 #undef TAO_SYSTEM_EXCEPTION 00238 00239 } // End CORBA namespace 00240 00241 TAO_END_VERSIONED_NAMESPACE_DECL 00242 00243 #if defined (__ACE_INLINE__) 00244 # include "tao/SystemException.inl" 00245 #endif /* __ACE_INLINE__ */ 00246 00247 #include /**/"ace/post.h" 00248 00249 #endif /* TAO_SYSTEM_EXCEPTION_H */