diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2004-03-26 22:34:47 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2004-03-26 22:34:47 +0000 |
commit | d797827f7a5bf4b4a69636d4dd04664294ce36cf (patch) | |
tree | fe5cdd0cbbacb7cb493d1decba2e5681cd95c39d /TAO/tao | |
parent | 26969ef713e17fdfba52cf12c96e8dd60cb45cbe (diff) | |
download | ATCD-d797827f7a5bf4b4a69636d4dd04664294ce36cf.tar.gz |
ChangeLogTag:Fri Mar 26 14:32:35 2004 Ossama Othman <ossama@dre.vanderbilt.edu>
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp | 14 | ||||
-rw-r--r-- | TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h | 2 | ||||
-rw-r--r-- | TAO/tao/IORInterceptor/IORInterceptor_List.cpp | 25 | ||||
-rw-r--r-- | TAO/tao/IORInterceptor/IORInterceptor_List.h | 9 | ||||
-rw-r--r-- | TAO/tao/Interceptor_List.cpp | 99 | ||||
-rw-r--r-- | TAO/tao/Interceptor_List.h | 16 |
6 files changed, 77 insertions, 88 deletions
diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp index fcc272f85b6..43ae330d3a1 100644 --- a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp +++ b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.cpp @@ -1,7 +1,6 @@ // $Id$ #include "IORInterceptor_Adapter_Impl.h" -#include "tao/ORB_Core.h" ACE_RCSID (IORInterceptor, IORInterceptor_Adapter_Impl, @@ -25,12 +24,12 @@ TAO_IORInterceptor_Adapter_Impl::add_interceptor ( void TAO_IORInterceptor_Adapter_Impl::destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC (()) { - TAO_IORInterceptor_List::TYPE &inter = + TAO_IORInterceptor_List::TYPE & i = this->ior_interceptor_list_.interceptors (); - size_t len = inter.size (); + const size_t len = i.size (); size_t ilen = len; for (size_t k = 0; k < len; ++k) @@ -40,7 +39,7 @@ TAO_IORInterceptor_Adapter_Impl::destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL) // occurs afterwards. --ilen; - inter[k]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + i[k].in()->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; // Since Interceptor::destroy() can throw an exception, decrease @@ -48,12 +47,13 @@ TAO_IORInterceptor_Adapter_Impl::destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL) // interceptors may not have been destroyed yet. Note that this // size reduction is fast since no memory is actually // deallocated. - inter.size (ilen); + i.size (ilen); } + delete this; } -TAO_IORInterceptor_List* +TAO_IORInterceptor_List * TAO_IORInterceptor_Adapter_Impl::interceptor_list (void) ACE_THROW_SPEC ((CORBA::SystemException)) { diff --git a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h index bad52cc9e2d..160476a9949 100644 --- a/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h +++ b/TAO/tao/IORInterceptor/IORInterceptor_Adapter_Impl.h @@ -48,7 +48,7 @@ public: ACE_THROW_SPEC ((CORBA::SystemException)); virtual void destroy_interceptors (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + ACE_THROW_SPEC (()); virtual TAO_IORInterceptor_List *interceptor_list (void) ACE_THROW_SPEC ((CORBA::SystemException)); diff --git a/TAO/tao/IORInterceptor/IORInterceptor_List.cpp b/TAO/tao/IORInterceptor/IORInterceptor_List.cpp index 6193341f9b2..d31f6348adc 100644 --- a/TAO/tao/IORInterceptor/IORInterceptor_List.cpp +++ b/TAO/tao/IORInterceptor/IORInterceptor_List.cpp @@ -1,19 +1,17 @@ -// -*- C++ -*- -// // $Id$ -#include "IORInterceptor_List.h" -#include "IORInterceptor_Adapter_Impl.h" -#include "tao/CORBA_String.h" +#include "IORInterceptor_List.h" #if !defined (__ACE_INLINE__) # include "IORInterceptor_List.inl" #endif /* ! __ACE_INLINE__ */ -ACE_RCSID (tao, + +ACE_RCSID (IORInterceptor, Interceptor_List, "$Id$") + TAO_IORInterceptor_List::TAO_IORInterceptor_List (void) : interceptors_ () { @@ -21,13 +19,8 @@ TAO_IORInterceptor_List::TAO_IORInterceptor_List (void) TAO_IORInterceptor_List::~TAO_IORInterceptor_List (void) { - size_t len = this->interceptors_.size (); - - for (size_t i = 0; i < len; ++i) - CORBA::release (this->interceptors_[i]); } - size_t TAO_IORInterceptor_List::length (void) { @@ -43,7 +36,7 @@ TAO_IORInterceptor_List::length (size_t len) PortableInterceptor::Interceptor_ptr TAO_IORInterceptor_List::interceptor (size_t index) { - return this->interceptors_[index]; + return this->interceptors_[index].in (); } void @@ -51,8 +44,8 @@ TAO_IORInterceptor_List::add_interceptor ( PortableInterceptor::IORInterceptor_ptr interceptor ACE_ENV_ARG_DECL) { - size_t index = this->add_interceptor_i (interceptor - ACE_ENV_ARG_PARAMETER); + const size_t index = this->add_interceptor_i (interceptor + ACE_ENV_ARG_PARAMETER); ACE_CHECK; this->interceptors_[index] = @@ -62,10 +55,10 @@ TAO_IORInterceptor_List::add_interceptor ( #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Array_Base<PortableInterceptor::IORInterceptor_ptr>; +template class ACE_Array_Base<PortableInterceptor::IORInterceptor_var>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Array_Base<PortableInterceptor::IORInterceptor_ptr> +#pragma instantiate ACE_Array_Base<PortableInterceptor::IORInterceptor_var> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tao/IORInterceptor/IORInterceptor_List.h b/TAO/tao/IORInterceptor/IORInterceptor_List.h index 8cdf9d05bef..3d77e7aec7a 100644 --- a/TAO/tao/IORInterceptor/IORInterceptor_List.h +++ b/TAO/tao/IORInterceptor/IORInterceptor_List.h @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "IORInterceptorC.h" + #include "tao/Interceptor_List.h" /** @@ -34,16 +36,15 @@ class TAO_IORInterceptor_Export TAO_IORInterceptor_List public: /// Define a trait for the underlying portable interceptor array. - typedef - ACE_Array_Base<PortableInterceptor::IORInterceptor_ptr> TYPE; + typedef ACE_Array_Base<PortableInterceptor::IORInterceptor_var> TYPE; public: /// Constructor TAO_IORInterceptor_List (void); - /// Destructor - ~TAO_IORInterceptor_List (void); + /// Destructor. + virtual ~TAO_IORInterceptor_List (void); /// Register an IOR interceptor. void add_interceptor (PortableInterceptor::IORInterceptor_ptr diff --git a/TAO/tao/Interceptor_List.cpp b/TAO/tao/Interceptor_List.cpp index eff319a309d..fb01e8e4af6 100644 --- a/TAO/tao/Interceptor_List.cpp +++ b/TAO/tao/Interceptor_List.cpp @@ -1,5 +1,3 @@ -// -*- C++ -*- -// // $Id$ #include "tao/Interceptor_List.h" @@ -34,43 +32,48 @@ TAO_Interceptor_List::add_interceptor_i ( { if (!CORBA::is_nil (interceptor)) { - /// If the Interceptor is not anonymous, make sure an - /// Interceptor with the same isn't already registered. - CORBA::String_var name = interceptor->name ( - ACE_ENV_SINGLE_ARG_PARAMETER - ); - ACE_CHECK_RETURN (0); - const size_t old_len = this->length (); - if (ACE_OS::strlen (name.in ()) != 0) + // Don't bother checking the name for duplicates if no + // interceptors have been registered. This saves an + // allocation. + if (old_len > 0) { - // @@ This simple search algorithm isn't the greatest thing - // in the world, but since we only register interceptors - // when bootstrapping an ORB, there will be no run-time - // penalty. - // - // Another source of inefficiency is that Interceptors - // duplicate their name each time the name() accessor is - // called! This can slow down bootstrap time noticeably - // when registering a huge number of interceptors. We - // could cache the names somewhere, but since this is - // only a bootstrapping issue there's no rush to - // implement such a scheme. - - /// Prevent interceptors with the same name from being - /// registered. Anonymous interceptors are okay. - for (size_t i = 0; i < old_len; ++i) - { - CORBA::String_var existing_name = - this->interceptor (i)->name (); + /// If the Interceptor is not anonymous, make sure an + /// Interceptor with the same isn't already registered. + CORBA::String_var name = + interceptor->name (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); - if (ACE_OS::strcmp (existing_name.in (), - name.in ()) == 0) + if (ACE_OS::strlen (name.in ()) != 0) + { + // @@ This simple search algorithm isn't the greatest + // thing in the world, but since we only register + // interceptors when bootstrapping an ORB, there will + // be no run-time penalty. + // + // Another source of inefficiency is that + // Interceptors duplicate their name each time the + // name() accessor is called! This can slow down + // bootstrap time noticeably when registering a huge + // number of interceptors. We could cache the names + // somewhere, but since this is only a bootstrapping + // issue there's no rush to implement such a scheme. + + // Prevent interceptors with the same name from being + // registered. Anonymous interceptors are okay. + for (size_t i = 0; i < old_len; ++i) { - ACE_THROW_RETURN - (PortableInterceptor::ORBInitInfo::DuplicateName (), - 0); + CORBA::String_var existing_name = + this->interceptor (i)->name (); + + if (ACE_OS::strcmp (existing_name.in (), + name.in ()) == 0) + { + ACE_THROW_RETURN + (PortableInterceptor::ORBInitInfo::DuplicateName (), + 0); + } } } } @@ -107,10 +110,6 @@ TAO_ClientRequestInterceptor_List::TAO_ClientRequestInterceptor_List (void) TAO_ClientRequestInterceptor_List::~TAO_ClientRequestInterceptor_List (void) { - const size_t len = this->interceptors_.size (); - - for (size_t i = 0; i < len; ++i) - CORBA::release (this->interceptors_[i]); } size_t @@ -129,7 +128,7 @@ TAO_ClientRequestInterceptor_List::length (size_t len) PortableInterceptor::Interceptor_ptr TAO_ClientRequestInterceptor_List::interceptor (size_t index) { - return this->interceptors_[index]; + return this->interceptors_[index].in (); } void @@ -137,8 +136,8 @@ TAO_ClientRequestInterceptor_List::add_interceptor ( PortableInterceptor::ClientRequestInterceptor_ptr interceptor ACE_ENV_ARG_DECL) { - size_t index = this->add_interceptor_i (interceptor - ACE_ENV_ARG_PARAMETER); + const size_t index = this->add_interceptor_i (interceptor + ACE_ENV_ARG_PARAMETER); ACE_CHECK; this->interceptors_[index] = @@ -154,10 +153,6 @@ TAO_ServerRequestInterceptor_List::TAO_ServerRequestInterceptor_List (void) TAO_ServerRequestInterceptor_List::~TAO_ServerRequestInterceptor_List (void) { - size_t len = this->interceptors_.size (); - - for (size_t i = 0; i < len; ++i) - CORBA::release (this->interceptors_[i]); } size_t @@ -175,7 +170,7 @@ TAO_ServerRequestInterceptor_List::length (size_t len) PortableInterceptor::Interceptor_ptr TAO_ServerRequestInterceptor_List::interceptor (size_t index) { - return this->interceptors_[index]; + return this->interceptors_[index].in (); } void @@ -183,8 +178,8 @@ TAO_ServerRequestInterceptor_List::add_interceptor ( PortableInterceptor::ServerRequestInterceptor_ptr interceptor ACE_ENV_ARG_DECL) { - size_t index = this->add_interceptor_i (interceptor - ACE_ENV_ARG_PARAMETER); + const size_t index = this->add_interceptor_i (interceptor + ACE_ENV_ARG_PARAMETER); ACE_CHECK; this->interceptors_[index] = @@ -197,8 +192,8 @@ TAO_ServerRequestInterceptor_List::add_interceptor ( # if TAO_HAS_INTERCEPTORS == 1 -template class ACE_Array_Base<PortableInterceptor::ClientRequestInterceptor_ptr>; -template class ACE_Array_Base<PortableInterceptor::ServerRequestInterceptor_ptr>; +template class ACE_Array_Base<PortableInterceptor::ClientRequestInterceptor_var>; +template class ACE_Array_Base<PortableInterceptor::ServerRequestInterceptor_var>; # endif /* TAO_HAS_INTERCEPTORS == 1 */ @@ -206,8 +201,8 @@ template class ACE_Array_Base<PortableInterceptor::ServerRequestInterceptor_ptr> # if TAO_HAS_INTERCEPTORS == 1 -#pragma instantiate ACE_Array_Base<PortableInterceptor::ClientRequestInterceptor_ptr> -#pragma instantiate ACE_Array_Base<PortableInterceptor::ServerRequestInterceptor_ptr> +#pragma instantiate ACE_Array_Base<PortableInterceptor::ClientRequestInterceptor_var> +#pragma instantiate ACE_Array_Base<PortableInterceptor::ServerRequestInterceptor_var> # endif /* TAO_HAS_INTERCEPTORS == 1 */ diff --git a/TAO/tao/Interceptor_List.h b/TAO/tao/Interceptor_List.h index 5a82c00a38f..55ed2090158 100644 --- a/TAO/tao/Interceptor_List.h +++ b/TAO/tao/Interceptor_List.h @@ -34,10 +34,10 @@ class TAO_Export TAO_Interceptor_List { public: - /// Constructor + /// Constructor. TAO_Interceptor_List (void); - /// Destructor + /// Destructor. virtual ~TAO_Interceptor_List (void); protected: @@ -76,15 +76,15 @@ public: /// Define a trait for the underlying portable interceptor array. typedef - ACE_Array_Base<PortableInterceptor::ClientRequestInterceptor_ptr> TYPE; + ACE_Array_Base<PortableInterceptor::ClientRequestInterceptor_var> TYPE; public: /// Constructor TAO_ClientRequestInterceptor_List (void); - /// Destructor - ~TAO_ClientRequestInterceptor_List (void); + /// Destructor. + virtual ~TAO_ClientRequestInterceptor_List (void); /// Register a client request interceptor. void add_interceptor (PortableInterceptor::ClientRequestInterceptor_ptr i @@ -124,15 +124,15 @@ public: /// Define a trait for the underlying portable interceptor array. typedef - ACE_Array_Base<PortableInterceptor::ServerRequestInterceptor_ptr> TYPE; + ACE_Array_Base<PortableInterceptor::ServerRequestInterceptor_var> TYPE; public: /// Constructor TAO_ServerRequestInterceptor_List (void); - /// Destructor - ~TAO_ServerRequestInterceptor_List (void); + /// Destructor. + virtual ~TAO_ServerRequestInterceptor_List (void); /// Register a server request interceptor. void add_interceptor (PortableInterceptor::ServerRequestInterceptor_ptr i |