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