diff options
author | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-28 21:24:23 +0000 |
---|---|---|
committer | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-28 21:24:23 +0000 |
commit | b10915847f35fa9fde79c41a8ddd79ea41316d4e (patch) | |
tree | d97e87881604d4fe938dcce7cbe7df882f78fe14 | |
parent | a56fba0986564654adf603fa3761624df1f372fe (diff) | |
download | ATCD-b10915847f35fa9fde79c41a8ddd79ea41316d4e.tar.gz |
ChangeLogTag:Mon Jul 28 16:12:15 2003 Gan Deng <gan.deng@vanderbilt.edu>
-rw-r--r-- | TAO/tao/Exception.cpp | 32 | ||||
-rw-r--r-- | TAO/tao/Exception.h | 31 |
2 files changed, 59 insertions, 4 deletions
diff --git a/TAO/tao/Exception.cpp b/TAO/tao/Exception.cpp index 3ff45849531..94ee1cbdd66 100644 --- a/TAO/tao/Exception.cpp +++ b/TAO/tao/Exception.cpp @@ -203,6 +203,18 @@ CORBA::UserException::_downcast (CORBA::Exception* exception) return 0; } +const CORBA::UserException* +CORBA::UserException::_downcast (const CORBA::Exception *exception) +{ + if (exception->_is_a ("IDL:omg.org/CORBA/UserException:1.0")) + { + return ACE_dynamic_cast (const CORBA::UserException *, + exception); + } + + return 0; +} + ACE_CString CORBA::UserException::_info (void) const { @@ -239,6 +251,14 @@ CORBA::SystemException::SystemException (const char *repository_id, { } +CORBA::SystemException::SystemException (CORBA::ULong code, + CORBA::CompletionStatus completed) + : minor_ (code), + completed_ (completed) +{ +} + + CORBA::SystemException::SystemException (const CORBA::SystemException &src) : CORBA::Exception (src), minor_ (src.minor_), @@ -283,6 +303,18 @@ CORBA::SystemException::_downcast (CORBA::Exception* exception) return 0; } +const CORBA::SystemException* +CORBA::SystemException::_downcast (const CORBA::Exception *exception) +{ + if (exception->_is_a ("IDL:omg.org/CORBA/SystemException:1.0")) + { + return ACE_dynamic_cast (const CORBA::SystemException *, + exception); + } + + return 0; +} + void CORBA::SystemException::_tao_encode (TAO_OutputCDR &cdr ACE_ENV_ARG_DECL) const diff --git a/TAO/tao/Exception.h b/TAO/tao/Exception.h index 7c0ef5677e3..877bb2f7e0a 100644 --- a/TAO/tao/Exception.h +++ b/TAO/tao/Exception.h @@ -56,6 +56,20 @@ namespace CORBA * available through the Interface Repositories. Think of it as a * "globally scoped" name distinguishing each exception. */ + + /* 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: @@ -75,13 +89,13 @@ namespace CORBA // = The static narrow operation. static Exception *_downcast (Exception *x); - // = These are TAO-specific extensions. - /// Return the repository ID of the Exception. - const char *_rep_id (void) const; + virtual const char *_rep_id (void) const; /// Return the name of the Exception. - const char *_name (void) const; + virtual const char *_name (void) const; + + // = These are TAO-specific extensions. /// Will be overridden in the concrete derived classes. virtual CORBA::TypeCode_ptr _type (void) const; @@ -167,6 +181,9 @@ namespace CORBA /// The narrow operation. static UserException *_downcast (CORBA::Exception *exception); + /// The const version of narrow operation + static const UserException *_downcast(const CORBA::Exception *exception); + // = TAO specific extension. /// Constructor from a repository id. @@ -225,6 +242,8 @@ namespace CORBA /// 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); // = TAO-specific extension. @@ -263,6 +282,10 @@ namespace CORBA 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, |