00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef TAO_EXCEPTION_H
00016 #define TAO_EXCEPTION_H
00017
00018 #include "ace/pre.h"
00019
00020
00021
00022 #include "tao/orbconf.h"
00023
00024 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 # pragma once
00026 #endif
00027
00028
00029 #if defined (TAO_HAS_EXCEPTIONS)
00030 #define TAO_RAISE(EXCEPTION) throw EXCEPTION
00031 #else
00032 #define TAO_RAISE(EXCEPTION)
00033 #endif
00034
00035 #include "tao/TAO_Export.h"
00036 #include "tao/Basic_Types.h"
00037 #include "tao/CORBA_String.h"
00038 #include "ace/SStringfwd.h"
00039 #include "ace/iosfwd.h"
00040 #include "ace/CORBA_macros.h"
00041
00042 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00043 class ACE_Allocator;
00044 ACE_END_VERSIONED_NAMESPACE_DECL
00045
00046 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00047
00048 class TAO_OutputCDR;
00049 class TAO_InputCDR;
00050
00051 #if defined (THREAD_CANCELLED)
00052 #undef THREAD_CANCELLED
00053 #endif
00054
00055
00056
00057
00058 #if defined (minor)
00059 #undef minor
00060 #endif
00061
00062 namespace CORBA
00063 {
00064 class TypeCode;
00065 typedef TypeCode * TypeCode_ptr;
00066
00067 class Environment;
00068
00069 class Any;
00070 typedef Any * Any_ptr;
00071
00072 class SystemException;
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 enum exception_type
00084 {
00085 NO_EXCEPTION,
00086 USER_EXCEPTION,
00087 SYSTEM_EXCEPTION
00088 };
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109 class TAO_Export Exception
00110 {
00111 public:
00112
00113 virtual ~Exception (void);
00114
00115
00116 Exception (const Exception &src);
00117
00118
00119 virtual void _raise (void) const = 0;
00120
00121
00122 static Exception * _downcast (Exception * x);
00123 static Exception const * _downcast (Exception const * x);
00124
00125
00126 virtual const char * _rep_id (void) const;
00127
00128
00129 virtual const char * _name (void) const;
00130
00131
00132
00133
00134 virtual CORBA::TypeCode_ptr _tao_type (void) const = 0;
00135
00136
00137
00138
00139
00140 void _tao_print_exception (const char *info,
00141 FILE *f = stdout) const;
00142
00143 #if defined (ACE_USES_WCHAR)
00144
00145
00146
00147
00148 void _tao_print_exception (const ACE_WCHAR_T *info,
00149 FILE *f = stdout) const;
00150 #endif // ACE_USES_WCHAR
00151
00152
00153
00154 virtual ACE_CString _info (void) const = 0;
00155
00156 virtual void _tao_encode (TAO_OutputCDR &cdr
00157 ACE_ENV_ARG_DECL) const = 0;
00158
00159 virtual void _tao_decode (TAO_InputCDR &cdr
00160 ACE_ENV_ARG_DECL) = 0;
00161
00162
00163 static void _tao_any_destructor (void *);
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188 virtual CORBA::Exception *_tao_duplicate (void) const = 0;
00189
00190 protected:
00191
00192
00193 Exception (void);
00194
00195
00196 Exception & operator = (const Exception & src);
00197
00198
00199 Exception (const char *repository_id,
00200 const char *local_name);
00201
00202 private:
00203
00204
00205 CORBA::String_var id_;
00206
00207
00208 CORBA::String_var name_;
00209
00210 };
00211
00212 #if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
00213
00214
00215 TAO_Export ACE_OSTREAM_TYPE& operator<< (ACE_OSTREAM_TYPE &os,
00216 const CORBA::Exception &e);
00217
00218 TAO_Export ACE_OSTREAM_TYPE& operator<< (ACE_OSTREAM_TYPE &os,
00219 const CORBA::Exception *e);
00220
00221 #endif
00222 }
00223
00224 namespace TAO
00225 {
00226
00227 TAO_Export CORBA::SystemException *create_system_exception (const char *id);
00228 }
00229
00230 TAO_END_VERSIONED_NAMESPACE_DECL
00231
00232 #if defined (__ACE_INLINE__)
00233 # include "tao/Exception.i"
00234 #endif
00235
00236 #include "ace/post.h"
00237
00238 #endif