#include <Interceptor_List_T.h>
Collaboration diagram for TAO::Interceptor_List< InterceptorType, DetailsType >:
Public Types | |
typedef InterceptorType::_var_type | InterceptorType_var_type |
Define the traits for the underlying portable interceptor array. | |
typedef InterceptorType::_ptr_type | InterceptorType_ptr_type |
Public Member Functions | |
Interceptor_List (void) | |
Constructor. | |
void | add_interceptor (InterceptorType_ptr_type i) |
void | add_interceptor (InterceptorType_ptr_type i, const CORBA::PolicyList &policies) |
Register an interceptor with policies. | |
void | destroy_interceptors () |
RegisteredInterceptor & | registered_interceptor (size_t index) |
Return the registered interceptor in sequence element index. | |
InterceptorType_ptr_type | interceptor (size_t index) |
Return the interceptor in sequence element index. | |
size_t | size (void) |
Private Types | |
typedef ACE_Array_Base< RegisteredInterceptor > | RegisteredArray |
Private Attributes | |
RegisteredArray | interceptors_ |
Dynamic array of registered interceptors. |
Template for the various portable interceptor lists used internally by TAO.
Definition at line 51 of file Interceptor_List_T.h.
|
Definition at line 56 of file Interceptor_List_T.h. Referenced by TAO::Interceptor_List< InterceptorType, DetailsType >::add_interceptor(). |
|
Define the traits for the underlying portable interceptor array.
Definition at line 55 of file Interceptor_List_T.h. |
|
Definition at line 89 of file Interceptor_List_T.h. |
|
Constructor.
Definition at line 18 of file Interceptor_List_T.cpp.
00019 { 00020 } |
|
Register an interceptor with policies. Increase the length of the Interceptor sequence by one. If the Interceptor is not anonymous, make sure an Interceptor with the same isn't already registered. Definition at line 120 of file Interceptor_List_T.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_THROW, TAO::Interceptor_List< InterceptorType, DetailsType >::interceptor(), TAO::Interceptor_List< InterceptorType, DetailsType >::interceptors_, TAO::Interceptor_List< InterceptorType, DetailsType >::InterceptorType_ptr_type, CORBA::is_nil(), ACE_Array_Base< T >::size(), ACE_OS::strcmp(), and ACE_OS::strlen().
00124 { 00125 if (!CORBA::is_nil (interceptor)) 00126 { 00127 const size_t old_len = this->interceptors_.size (); 00128 00129 // Don't bother checking the name for duplicates if no 00130 // interceptors have been registered. This saves an 00131 // allocation. 00132 if (old_len > 0) 00133 { 00134 /// If the Interceptor is not anonymous, make sure an 00135 /// Interceptor with the same isn't already registered. 00136 CORBA::String_var name = 00137 interceptor->name (ACE_ENV_SINGLE_ARG_PARAMETER); 00138 ACE_CHECK; 00139 00140 if (ACE_OS::strlen (name.in ()) != 0) 00141 { 00142 // @@ This simple search algorithm isn't the greatest 00143 // thing in the world, but since we only register 00144 // interceptors when bootstrapping an ORB, there will 00145 // be no runtime penalty. 00146 // 00147 // Another source of inefficiency is that 00148 // Interceptors duplicate their name each time the 00149 // name() accessor is called! This can slow down 00150 // bootstrap time noticeably when registering a huge 00151 // number of interceptors. We could cache the names 00152 // somewhere, but since this is only a bootstrapping 00153 // issue there's no rush to implement such a scheme. 00154 00155 // Prevent interceptors with the same name from being 00156 // registered. Anonymous interceptors are okay. 00157 for (size_t i = 0; i < old_len; ++i) 00158 { 00159 CORBA::String_var existing_name = 00160 this->interceptor (i)->name (); 00161 00162 if (ACE_OS::strcmp (existing_name.in (), 00163 name.in ()) == 0) 00164 { 00165 ACE_THROW (PortableInterceptor::ORBInitInfo::DuplicateName ()); 00166 } 00167 } 00168 } 00169 } 00170 00171 // Create a DetailsType object, and attempt to apply the policies. 00172 DetailsType details; 00173 details.apply_policies(policies ACE_ENV_ARG_PARAMETER); 00174 ACE_CHECK; 00175 00176 /// Increase the length of the Interceptor sequence by one. 00177 const size_t new_len = old_len + 1; 00178 this->interceptors_.size (new_len); 00179 00180 // Add the interceptor 00181 this->interceptors_[old_len].interceptor_ = 00182 InterceptorType::_duplicate (interceptor); 00183 00184 // Set the details 00185 this->interceptors_[old_len].details_ = details; 00186 } 00187 else 00188 { 00189 ACE_THROW ( 00190 CORBA::INV_OBJREF ( 00191 CORBA::SystemException::_tao_minor_code ( 00192 0, 00193 EINVAL 00194 ), 00195 CORBA::COMPLETED_NO 00196 ) 00197 ); 00198 } 00199 } |
|
Increase the length of the Interceptor sequence by one. If the Interceptor is not anonymous, make sure an Interceptor with the same isn't already registered. Definition at line 46 of file Interceptor_List_T.cpp. References ACE_CHECK, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_THROW, TAO::Interceptor_List< InterceptorType, DetailsType >::interceptor(), TAO::Interceptor_List< InterceptorType, DetailsType >::interceptors_, TAO::Interceptor_List< InterceptorType, DetailsType >::InterceptorType_ptr_type, CORBA::is_nil(), ACE_Array_Base< T >::size(), ACE_OS::strcmp(), and ACE_OS::strlen(). Referenced by TAO::ClientRequestInterceptor_Adapter_Impl::add_interceptor().
00049 { 00050 if (!CORBA::is_nil (interceptor)) 00051 { 00052 const size_t old_len = this->interceptors_.size (); 00053 00054 // Don't bother checking the name for duplicates if no 00055 // interceptors have been registered. This saves an 00056 // allocation. 00057 if (old_len > 0) 00058 { 00059 /// If the Interceptor is not anonymous, make sure an 00060 /// Interceptor with the same isn't already registered. 00061 CORBA::String_var name = 00062 interceptor->name (ACE_ENV_SINGLE_ARG_PARAMETER); 00063 ACE_CHECK; 00064 00065 if (ACE_OS::strlen (name.in ()) != 0) 00066 { 00067 // @@ This simple search algorithm isn't the greatest 00068 // thing in the world, but since we only register 00069 // interceptors when bootstrapping an ORB, there will 00070 // be no runtime penalty. 00071 // 00072 // Another source of inefficiency is that 00073 // Interceptors duplicate their name each time the 00074 // name() accessor is called! This can slow down 00075 // bootstrap time noticeably when registering a huge 00076 // number of interceptors. We could cache the names 00077 // somewhere, but since this is only a bootstrapping 00078 // issue there's no rush to implement such a scheme. 00079 00080 // Prevent interceptors with the same name from being 00081 // registered. Anonymous interceptors are okay. 00082 for (size_t i = 0; i < old_len; ++i) 00083 { 00084 CORBA::String_var existing_name = 00085 this->interceptor (i)->name (); 00086 00087 if (ACE_OS::strcmp (existing_name.in (), 00088 name.in ()) == 0) 00089 { 00090 ACE_THROW (PortableInterceptor::ORBInitInfo::DuplicateName ()); 00091 } 00092 } 00093 } 00094 } 00095 00096 /// Increase the length of the Interceptor sequence by one. 00097 const size_t new_len = old_len + 1; 00098 this->interceptors_.size (new_len); 00099 00100 // Add the interceptor 00101 this->interceptors_[old_len].interceptor_ = 00102 InterceptorType::_duplicate (interceptor); 00103 } 00104 else 00105 { 00106 ACE_THROW ( 00107 CORBA::INV_OBJREF ( 00108 CORBA::SystemException::_tao_minor_code ( 00109 0, 00110 EINVAL 00111 ), 00112 CORBA::COMPLETED_NO 00113 ) 00114 ); 00115 } 00116 } |
|
Definition at line 203 of file Interceptor_List_T.cpp. References ACE_CATCHALL, ACE_CHECK, ACE_DEBUG, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TEXT, ACE_TRY, ACE_TRY_CHECK, TAO::Interceptor_List< InterceptorType, DetailsType >::interceptor(), TAO::Interceptor_List< InterceptorType, DetailsType >::interceptors_, LM_DEBUG, ACE_Array_Base< T >::size(), and TAO_debug_level. Referenced by TAO::ClientRequestInterceptor_Adapter_Impl::destroy_interceptors().
00205 { 00206 const size_t len = this->interceptors_.size (); 00207 size_t ilen = len; 00208 00209 ACE_TRY 00210 { 00211 for (size_t k = 0; k < len; ++k) 00212 { 00213 // Destroy the interceptors in reverse order in case the 00214 // array list is only partially destroyed and another 00215 // invocation occurs afterwards. 00216 --ilen; 00217 00218 this->interceptor (k)->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); 00219 ACE_TRY_CHECK; 00220 00221 // Since Interceptor::destroy() can throw an exception, 00222 // decrease the size of the interceptor array incrementally 00223 // since some interceptors may not have been destroyed yet. 00224 // Note that this size reduction is fast since no memory is 00225 // actually deallocated. 00226 this->interceptors_.size (ilen); 00227 } 00228 } 00229 ACE_CATCHALL 00230 { 00231 // Exceptions should not be propagated beyond this call. 00232 if (TAO_debug_level > 3) 00233 { 00234 ACE_DEBUG ((LM_DEBUG, 00235 ACE_TEXT ("TAO (%P|%t) - Exception in ") 00236 ACE_TEXT ("Interceptor_List") 00237 ACE_TEXT ("::destroy_interceptors () \n"))); 00238 } 00239 } 00240 ACE_ENDTRY; 00241 ACE_CHECK; 00242 } |
|
Return the interceptor in sequence element index.
Definition at line 32 of file Interceptor_List_T.cpp. References TAO::Interceptor_List< InterceptorType, DetailsType >::interceptors_. Referenced by TAO::Interceptor_List< InterceptorType, DetailsType >::add_interceptor(), and TAO::Interceptor_List< InterceptorType, DetailsType >::destroy_interceptors().
00033 { 00034 return this->interceptors_[index].interceptor_.in (); 00035 } |
|
Return the registered interceptor in sequence element index.
Definition at line 24 of file Interceptor_List_T.cpp. References TAO::Interceptor_List< InterceptorType, DetailsType >::interceptors_. Referenced by TAO::ClientRequestInterceptor_Adapter_Impl::receive_exception(), TAO::ClientRequestInterceptor_Adapter_Impl::receive_other(), TAO::ClientRequestInterceptor_Adapter_Impl::receive_reply(), and TAO::ClientRequestInterceptor_Adapter_Impl::send_request().
00026 { 00027 return this->interceptors_[index]; 00028 } |
|
Definition at line 39 of file Interceptor_List_T.cpp. References TAO::Interceptor_List< InterceptorType, DetailsType >::interceptors_, and ACE_Array_Base< T >::size(). Referenced by TAO::ClientRequestInterceptor_Adapter_Impl::send_request().
00040 { 00041 return this->interceptors_.size (); 00042 } |
|