3 //=============================================================================
5 * @file SystemException.h
7 * CORBA::SystemException class header.
9 * @author DOC Group at Vanderbilt U, Wash U, and UCI
10 * @author Ossama Othman <ossama@dre.vanderbilt.edu>
12 //=============================================================================
14 #ifndef TAO_SYSTEM_EXCEPTION_H
15 #define TAO_SYSTEM_EXCEPTION_H
17 #include /**/ "ace/pre.h"
19 // Do not try removing this. If you remove this for subsetting lots of
20 // things go wrong in TAO.
21 #include "tao/orbconf.h"
23 #if !defined (ACE_LACKS_PRAGMA_ONCE)
25 #endif /* ACE_LACKS_PRAGMA_ONCE */
27 #include "tao/Exception.h"
29 #ifdef THREAD_CANCELLED
30 # undef THREAD_CANCELLED
31 #endif /* THREAD_CANCELLED */
33 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
38 // This is already done in orbconf.h. But this file is totally
39 // decoupled from its contents that we have to do this here. Including
40 // orbconf.h is probably going to be a overhead.
47 class SystemException
;
52 typedef CORBA::SystemException
* (*excp_factory
)();
58 * @enum CompletionStatus
60 * @brief Completion status for CORBA system exceptions
62 * Enumerations that denote how an operation was (not) completed
63 * when a @c CORBA::SystemException is thrown.
67 COMPLETED_YES
, ///< Successful or exceptional completion.
68 COMPLETED_NO
, ///< Didn't change any state; retry is OK.
69 COMPLETED_MAYBE
///< Can't say what happened; retry unsafe.
73 * @class SystemException
75 * @brief SystemException
77 * System exceptions are those defined in the CORBA specification;
78 * OMG-IDL defines these.
80 class TAO_Export SystemException
: public Exception
85 * @note This constructor should be protected, but VC7.1 at
86 * warning level 4 complains about the inaccessible copy
87 * constructor preventing it from being caught. However,
88 * that probably isn't true for most cases since CORBA
89 * exceptions are typically caught by reference, not by
92 SystemException (const SystemException
& src
);
95 virtual ~SystemException () = default;
97 /// Get the minor status.
100 /// Set the minor status.
101 void minor (ULong m
);
103 /// Get the completion status.
104 CORBA::CompletionStatus
completed () const;
106 /// Set the operation completion status.
107 void completed (CORBA::CompletionStatus c
);
109 /// Narrow to a SystemException.
110 static SystemException
*_downcast (CORBA::Exception
*exception
);
112 /// The const version of narrow operation to a SystemException
113 static const SystemException
*_downcast(const CORBA::Exception
*exception
);
115 virtual void _raise () const = 0;
117 // = TAO-specific extension.
119 /// Print the system exception @c ex to output determined by @c f.
120 /// This function is not CORBA compliant.
121 void _tao_print_system_exception (FILE *f
= stdout
) const;
123 /// Returns a string containing information about the exception. This
124 /// function is not CORBA compliant.
125 virtual ACE_CString
_info () const;
127 virtual void _tao_encode (TAO_OutputCDR
&cdr
) const;
129 virtual void _tao_decode (TAO_InputCDR
&cdr
);
131 /// Helper to create a minor status value.
132 static CORBA::ULong
_tao_minor_code (u_int location
, int errno_value
);
134 /// Helper to translate a platform-specific errno to a TAO errno
136 static CORBA::ULong
_tao_errno (int errno_value
);
139 virtual CORBA::Exception
*_tao_duplicate () const;
142 /// Default constructor.
145 /// Assignment operator.
146 SystemException
& operator= (const SystemException
&src
);
148 /// Constructor using a repository id.
149 SystemException (CORBA::ULong code
, CORBA::CompletionStatus completed
);
151 /// Constructor using a repository id.
152 SystemException (const char *repository_id
,
153 const char *local_name
,
155 CORBA::CompletionStatus completed
);
157 /// Return the exception description associated with the given OMG
159 static const char *_tao_get_omg_exception_description (
160 const CORBA::SystemException
&exc
, CORBA::ULong minor_code
);
166 /// Completion status.
167 CORBA::CompletionStatus completed_
;
170 // Declarations for all of the CORBA standard exceptions.
172 // @@ - shouldn't have a default minor code, at least for code that's
173 // inside the ORB. All minor codes should be symbolically catalogued.
175 #define TAO_SYSTEM_EXCEPTION(name) \
176 class TAO_Export name : public SystemException \
180 name (CORBA::ULong code, \
181 CORBA::CompletionStatus completed); \
182 static name * _downcast (CORBA::Exception* exception); \
183 static name const * _downcast (CORBA::Exception const * exception); \
184 virtual void _raise () const; \
185 virtual CORBA::TypeCode_ptr _tao_type () const; \
186 static void _tao_any_destructor (void*); \
187 virtual CORBA::Exception *_tao_duplicate () const; \
188 static CORBA::SystemException *_tao_create (); \
191 TAO_SYSTEM_EXCEPTION(UNKNOWN) // the unknown exception
192 TAO_SYSTEM_EXCEPTION(BAD_PARAM
) // an invalid parameter was passed
193 TAO_SYSTEM_EXCEPTION(NO_MEMORY
) // memory allocation failure
194 TAO_SYSTEM_EXCEPTION(IMP_LIMIT
) // violated implementation limit
195 TAO_SYSTEM_EXCEPTION(COMM_FAILURE
) // communication failure
196 TAO_SYSTEM_EXCEPTION(INV_OBJREF
) // invalid object reference
197 TAO_SYSTEM_EXCEPTION(OBJECT_NOT_EXIST
) // no such object
198 TAO_SYSTEM_EXCEPTION(NO_PERMISSION
) // no permission for operation
199 TAO_SYSTEM_EXCEPTION(INTERNAL
) // ORB internal error
200 TAO_SYSTEM_EXCEPTION(MARSHAL
) // error marshaling param/result
201 TAO_SYSTEM_EXCEPTION(INITIALIZE
) // ORB initialization failure
202 TAO_SYSTEM_EXCEPTION(NO_IMPLEMENT
) // implementation unavailable
203 TAO_SYSTEM_EXCEPTION(BAD_TYPECODE
) // bad typecode
204 TAO_SYSTEM_EXCEPTION(BAD_OPERATION
) // invalid operation
205 TAO_SYSTEM_EXCEPTION(NO_RESOURCES
) // out of resources for request
206 TAO_SYSTEM_EXCEPTION(NO_RESPONSE
) // response not yet available
207 TAO_SYSTEM_EXCEPTION(PERSIST_STORE
) // persistent storage failure
208 TAO_SYSTEM_EXCEPTION(BAD_INV_ORDER
) // routine invocations out of order
209 TAO_SYSTEM_EXCEPTION(TRANSIENT
) // transient error, try again later
210 TAO_SYSTEM_EXCEPTION(FREE_MEM
) // cannot free memory
211 TAO_SYSTEM_EXCEPTION(INV_IDENT
) // invalid identifier syntax
212 TAO_SYSTEM_EXCEPTION(INV_FLAG
) // invalid flag was specified
213 TAO_SYSTEM_EXCEPTION(INTF_REPOS
) // interface repository unavailable
214 TAO_SYSTEM_EXCEPTION(BAD_CONTEXT
) // error processing context object
215 TAO_SYSTEM_EXCEPTION(OBJ_ADAPTER
) // object adapter failure
216 TAO_SYSTEM_EXCEPTION(DATA_CONVERSION
) // data conversion error
217 TAO_SYSTEM_EXCEPTION(INV_POLICY
) // invalid policies present
218 TAO_SYSTEM_EXCEPTION(REBIND
) // rebind needed
219 TAO_SYSTEM_EXCEPTION(TIMEOUT
) // operation timed out
220 TAO_SYSTEM_EXCEPTION(TRANSACTION_UNAVAILABLE
) // no transaction
221 TAO_SYSTEM_EXCEPTION(TRANSACTION_MODE
) // invalid transaction mode
222 TAO_SYSTEM_EXCEPTION(TRANSACTION_REQUIRED
) // operation needs transaction
223 TAO_SYSTEM_EXCEPTION(TRANSACTION_ROLLEDBACK
) // operation was a no-op
224 TAO_SYSTEM_EXCEPTION(INVALID_TRANSACTION
) // invalid TP context passed
225 TAO_SYSTEM_EXCEPTION(CODESET_INCOMPATIBLE
) // incompatible code set
226 TAO_SYSTEM_EXCEPTION(BAD_QOS
) // bad quality of service
227 TAO_SYSTEM_EXCEPTION(INVALID_ACTIVITY
)
228 TAO_SYSTEM_EXCEPTION(ACTIVITY_COMPLETED
)
229 TAO_SYSTEM_EXCEPTION(ACTIVITY_REQUIRED
)
230 TAO_SYSTEM_EXCEPTION(THREAD_CANCELLED
)
232 #undef TAO_SYSTEM_EXCEPTION
234 } // End CORBA namespace
236 TAO_END_VERSIONED_NAMESPACE_DECL
238 #if defined (__ACE_INLINE__)
239 # include "tao/SystemException.inl"
240 #endif /* __ACE_INLINE__ */
242 #include /**/"ace/post.h"
244 #endif /* TAO_SYSTEM_EXCEPTION_H */