Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / DynamicInterface / ExceptionList.cpp
blob7bdd96745b16669584953081b443b03db1ac7017
1 #include "tao/DynamicInterface/ExceptionList.h"
2 #include "tao/AnyTypeCode/TypeCode.h"
3 #include "tao/SystemException.h"
5 #if !defined (__ACE_INLINE__)
6 # include "tao/DynamicInterface/ExceptionList.inl"
7 #endif /* __ACE_INLINE__ */
9 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
11 CORBA::ExceptionList::ExceptionList (CORBA::ULong len,
12 CORBA::TypeCode_ptr *tc_list)
13 : refcount_ (1)
15 for (CORBA::ULong i = 0; i < len; ++i)
17 this->add (tc_list [i]);
21 CORBA::ExceptionList::~ExceptionList ()
23 for (CORBA::ULong i = 0; i < this->count (); ++i)
25 CORBA::TypeCode_ptr *tc = 0;
27 if (this->tc_list_.get (tc, i) == -1)
29 return;
32 ::CORBA::release (*tc);
36 void
37 CORBA::ExceptionList::add (CORBA::TypeCode_ptr tc)
39 this->tc_list_.enqueue_tail (CORBA::TypeCode::_duplicate (tc));
42 void
43 CORBA::ExceptionList::add_consume (CORBA::TypeCode_ptr tc)
45 this->tc_list_.enqueue_tail (tc);
48 CORBA::TypeCode_ptr
49 CORBA::ExceptionList::item (CORBA::ULong slot)
51 CORBA::TypeCode_ptr *tc = 0;
53 if (this->tc_list_.get (tc, slot) == -1)
55 throw ::CORBA::TypeCode::Bounds ();
57 else
59 return CORBA::TypeCode::_duplicate (*tc);
63 void
64 CORBA::ExceptionList::remove (CORBA::ULong)
66 throw ::CORBA::NO_IMPLEMENT ();
69 CORBA::ExceptionList_ptr
70 CORBA::ExceptionList::_duplicate ()
72 this->_incr_refcount ();
73 return this;
76 void
77 CORBA::ExceptionList::_destroy ()
79 this->_decr_refcount ();
82 void
83 CORBA::ExceptionList::_incr_refcount ()
85 ++this->refcount_;
88 void
89 CORBA::ExceptionList::_decr_refcount ()
91 CORBA::ULong const refcount = --this->refcount_;
93 if (refcount == 0)
95 delete this;
99 TAO_END_VERSIONED_NAMESPACE_DECL