00001 #include "tao/DynamicInterface/ExceptionList.h" 00002 00003 ACE_RCSID (DynamicInterface, 00004 ExceptionList, 00005 "$Id: ExceptionList.cpp 76995 2007-02-11 12:51:42Z johnnyw $") 00006 00007 #include "tao/AnyTypeCode/TypeCode.h" 00008 #include "tao/SystemException.h" 00009 00010 #if !defined (__ACE_INLINE__) 00011 # include "tao/DynamicInterface/ExceptionList.inl" 00012 #endif /* __ACE_INLINE__ */ 00013 00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00015 00016 CORBA::ExceptionList::ExceptionList (CORBA::ULong len, 00017 CORBA::TypeCode_ptr *tc_list) 00018 : ref_count_ (1) 00019 { 00020 for (CORBA::ULong i = 0; i < len; ++i) 00021 { 00022 this->add (tc_list [i]); 00023 } 00024 } 00025 00026 CORBA::ExceptionList::~ExceptionList (void) 00027 { 00028 for (CORBA::ULong i = 0; i < this->count (); ++i) 00029 { 00030 CORBA::TypeCode_ptr *tc = 0; 00031 00032 if (this->tc_list_.get (tc, i) == -1) 00033 { 00034 return; 00035 } 00036 00037 ::CORBA::release (*tc); 00038 } 00039 } 00040 00041 void 00042 CORBA::ExceptionList::add (CORBA::TypeCode_ptr tc) 00043 { 00044 this->tc_list_.enqueue_tail (CORBA::TypeCode::_duplicate (tc)); 00045 } 00046 00047 void 00048 CORBA::ExceptionList::add_consume (CORBA::TypeCode_ptr tc) 00049 { 00050 this->tc_list_.enqueue_tail (tc); 00051 } 00052 00053 CORBA::TypeCode_ptr 00054 CORBA::ExceptionList::item (CORBA::ULong slot) 00055 { 00056 CORBA::TypeCode_ptr *tc = 0; 00057 00058 if (this->tc_list_.get (tc, slot) == -1) 00059 { 00060 throw ::CORBA::TypeCode::Bounds (); 00061 } 00062 else 00063 { 00064 return CORBA::TypeCode::_duplicate (*tc); 00065 } 00066 } 00067 00068 void 00069 CORBA::ExceptionList::remove (CORBA::ULong) 00070 { 00071 throw ::CORBA::NO_IMPLEMENT (); 00072 } 00073 00074 CORBA::ExceptionList_ptr 00075 CORBA::ExceptionList::_duplicate (void) 00076 { 00077 this->_incr_refcnt (); 00078 return this; 00079 } 00080 00081 void 00082 CORBA::ExceptionList::_destroy (void) 00083 { 00084 this->_decr_refcnt (); 00085 } 00086 00087 void 00088 CORBA::ExceptionList::_incr_refcnt (void) 00089 { 00090 ++this->ref_count_; 00091 } 00092 00093 void 00094 CORBA::ExceptionList::_decr_refcnt (void) 00095 { 00096 CORBA::ULong const refcount = --this->ref_count_; 00097 00098 if (refcount == 0) 00099 { 00100 delete this; 00101 } 00102 } 00103 00104 TAO_END_VERSIONED_NAMESPACE_DECL