Go to the documentation of this file.00001
00002
00003 #include "tao/Exception.h"
00004 #include "tao/SystemException.h"
00005 #include "tao/Environment.h"
00006 #include "tao/ORB_Constants.h"
00007 #include "tao/CORBA_String.h"
00008 #include "tao/CDR.h"
00009 #include "tao/debug.h"
00010
00011 #include "ace/Malloc.h"
00012 #include "ace/SString.h"
00013 #include "ace/OS_NS_string.h"
00014
00015
00016 #if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
00017
00018
00019 #include "ace/streams.h"
00020 #endif
00021
00022 #if !defined (__ACE_INLINE__)
00023 # include "tao/Exception.inl"
00024 #endif
00025
00026 #include "ace/OS_NS_stdio.h"
00027
00028 ACE_RCSID (tao,
00029 Exception,
00030 "$Id: Exception.cpp 84489 2009-02-17 14:04:16Z johnnyw $")
00031
00032
00033
00034
00035 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00036
00037 CORBA::Exception::Exception (const char * repository_id,
00038 const char * local_name)
00039 : id_ (CORBA::string_dup (repository_id)),
00040 name_ (CORBA::string_dup (local_name))
00041 {
00042 ACE_ASSERT (this->id_.in () != 0 && this->name_.in () != 0);
00043 }
00044
00045 CORBA::Exception::Exception (const CORBA::Exception &src)
00046 : id_ (CORBA::string_dup (src.id_)),
00047 name_ (CORBA::string_dup (src.name_))
00048 {
00049 ACE_ASSERT (this->id_.in () != 0 && this->name_.in () != 0);
00050 }
00051
00052
00053
00054
00055
00056 CORBA::Exception::Exception (void)
00057 : id_ (),
00058 name_ ()
00059 {
00060 }
00061
00062 CORBA::Exception::~Exception (void)
00063 {
00064 }
00065
00066 CORBA::Exception &
00067 CORBA::Exception::operator= (const CORBA::Exception &src)
00068 {
00069 if (this != &src)
00070 {
00071 this->id_ = CORBA::string_dup (src.id_);
00072 ACE_ASSERT (this->id_.in () != 0);
00073
00074 this->name_ = CORBA::string_dup (src.name_);
00075 ACE_ASSERT (this->name_.in () != 0);
00076 }
00077
00078 return *this;
00079 }
00080
00081 const char *
00082 CORBA::Exception::_rep_id (void) const
00083 {
00084 return this->id_.in ();
00085 }
00086
00087 const char *
00088 CORBA::Exception::_name (void) const
00089 {
00090 return this->name_.in ();
00091 }
00092
00093 void
00094 CORBA::Exception::_tao_print_exception (const char *user_provided_info,
00095 FILE *) const
00096 {
00097 ACE_ERROR ((LM_ERROR,
00098 ACE_TEXT ("(%P|%t) EXCEPTION, %C\n")
00099 ACE_TEXT ("%C\n"),
00100 user_provided_info,
00101 this->_info ().c_str ()));
00102 }
00103
00104 #if defined (ACE_USES_WCHAR)
00105 void
00106 CORBA::Exception::_tao_print_exception (const ACE_WCHAR_T *info,
00107 FILE *f) const
00108 {
00109
00110
00111
00112 this->_tao_print_exception (ACE_TEXT_ALWAYS_CHAR (info), f);
00113 }
00114 #endif // ACE_USES_WCHAR
00115
00116 void
00117 CORBA::Exception::_tao_any_destructor (void *x)
00118 {
00119 CORBA::Exception *tmp = static_cast<CORBA::Exception *> (x);
00120 delete tmp;
00121 }
00122
00123 #if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
00124
00125 namespace CORBA
00126 {
00127 ACE_OSTREAM_TYPE& operator<< (ACE_OSTREAM_TYPE &os,
00128 const CORBA::Exception &e)
00129 {
00130 os << e._name () << " (" << e._rep_id () << ')';
00131
00132 return os;
00133 }
00134
00135 ACE_OSTREAM_TYPE& operator<< (ACE_OSTREAM_TYPE &os,
00136 const CORBA::Exception *e)
00137 {
00138 os << e->_name () << " (" << e->_rep_id () << ')';
00139
00140 return os;
00141 }
00142 }
00143
00144 #endif
00145
00146 TAO_END_VERSIONED_NAMESPACE_DECL