Template for portable interceptor lists. More...
#include <Interceptor_List_T.h>
Classes | |
struct | RegisteredInterceptor |
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 (void) |
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) const |
Private Types | |
typedef ACE_Array_Base < RegisteredInterceptor > | RegisteredArray |
Private Attributes | |
RegisteredArray | interceptors_ |
Dynamic array of registered interceptors. |
Template for portable interceptor lists.
Template for the various portable interceptor lists used internally by TAO.
Definition at line 51 of file Interceptor_List_T.h.
typedef InterceptorType::_ptr_type TAO::Interceptor_List< InterceptorType, DetailsType >::InterceptorType_ptr_type |
Definition at line 56 of file Interceptor_List_T.h.
typedef InterceptorType::_var_type TAO::Interceptor_List< InterceptorType, DetailsType >::InterceptorType_var_type |
Define the traits for the underlying portable interceptor array.
Definition at line 55 of file Interceptor_List_T.h.
typedef ACE_Array_Base<RegisteredInterceptor > TAO::Interceptor_List< InterceptorType, DetailsType >::RegisteredArray [private] |
Definition at line 84 of file Interceptor_List_T.h.
TAO::Interceptor_List< InterceptorType, DetailsType >::Interceptor_List | ( | void | ) |
void TAO::Interceptor_List< InterceptorType, DetailsType >::add_interceptor | ( | InterceptorType_ptr_type | i | ) |
If the Interceptor is not anonymous, make sure an Interceptor with the same isn't already registered.
Increase the length of the Interceptor sequence by one.
Definition at line 44 of file Interceptor_List_T.cpp.
{ if (!CORBA::is_nil (interceptor)) { size_t const old_len = this->interceptors_.size (); // Don't bother checking the name for duplicates if no // interceptors have been registered. This saves an // allocation. if (old_len > 0) { /// If the Interceptor is not anonymous, make sure an /// Interceptor with the same isn't already registered. CORBA::String_var name = interceptor->name (); 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 runtime 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 (ACE_OS::strcmp (existing_name.in (), name.in ()) == 0) { throw PortableInterceptor::ORBInitInfo::DuplicateName (); } } } } /// Increase the length of the Interceptor sequence by one. size_t const new_len = old_len + 1; this->interceptors_.size (new_len); // Add the interceptor this->interceptors_[old_len].interceptor_ = InterceptorType::_duplicate (interceptor); } else { throw CORBA::INV_OBJREF ( CORBA::SystemException::_tao_minor_code ( 0, EINVAL ), CORBA::COMPLETED_NO); } }
void TAO::Interceptor_List< InterceptorType, DetailsType >::add_interceptor | ( | InterceptorType_ptr_type | i, | |
const CORBA::PolicyList & | policies | |||
) |
Register an interceptor with policies.
If the Interceptor is not anonymous, make sure an Interceptor with the same isn't already registered.
Increase the length of the Interceptor sequence by one.
Definition at line 114 of file Interceptor_List_T.cpp.
{ if (!CORBA::is_nil (interceptor)) { size_t const old_len = this->interceptors_.size (); // Don't bother checking the name for duplicates if no // interceptors have been registered. This saves an // allocation. if (old_len > 0) { /// If the Interceptor is not anonymous, make sure an /// Interceptor with the same isn't already registered. CORBA::String_var name = interceptor->name (); 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 runtime 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 (ACE_OS::strcmp (existing_name.in (), name.in ()) == 0) { throw PortableInterceptor::ORBInitInfo::DuplicateName (); } } } } // Create a DetailsType object, and attempt to apply the policies. DetailsType details; details.apply_policies(policies); /// Increase the length of the Interceptor sequence by one. size_t const new_len = old_len + 1; this->interceptors_.size (new_len); // Add the interceptor this->interceptors_[old_len].interceptor_ = InterceptorType::_duplicate (interceptor); // Set the details this->interceptors_[old_len].details_ = details; } else { throw CORBA::INV_OBJREF ( CORBA::SystemException::_tao_minor_code ( 0, EINVAL ), CORBA::COMPLETED_NO ); } }
void TAO::Interceptor_List< InterceptorType, DetailsType >::destroy_interceptors | ( | void | ) |
Definition at line 194 of file Interceptor_List_T.cpp.
{ size_t const len = this->interceptors_.size (); size_t ilen = len; try { for (size_t k = 0; k < len; ++k) { // Destroy the interceptors in reverse order in case the // array list is only partially destroyed and another // invocation occurs afterwards. --ilen; this->interceptor (k)->destroy (); // Since Interceptor::destroy() can throw an exception, // decrease the size of the interceptor array incrementally // since some interceptors may not have been destroyed yet. // Note that this size reduction is fast since no memory is // actually deallocated. this->interceptors_.size (ilen); } } catch (...) { // Exceptions should not be propagated beyond this call. if (TAO_debug_level > 3) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Exception in ") ACE_TEXT ("Interceptor_List") ACE_TEXT ("::destroy_interceptors ()\n"))); } } }
Interceptor_List< InterceptorType, DetailsType >::InterceptorType_ptr_type TAO::Interceptor_List< InterceptorType, DetailsType >::interceptor | ( | size_t | index | ) |
Return the interceptor in sequence element index.
Definition at line 30 of file Interceptor_List_T.cpp.
{ return this->interceptors_[index].interceptor_.in (); }
Interceptor_List< InterceptorType, DetailsType >::RegisteredInterceptor & TAO::Interceptor_List< InterceptorType, DetailsType >::registered_interceptor | ( | size_t | index | ) |
Return the registered interceptor in sequence element index.
Definition at line 22 of file Interceptor_List_T.cpp.
{ return this->interceptors_[index]; }
size_t TAO::Interceptor_List< InterceptorType, DetailsType >::size | ( | void | ) | const |
Definition at line 37 of file Interceptor_List_T.cpp.
{ return this->interceptors_.size (); }
RegisteredArray TAO::Interceptor_List< InterceptorType, DetailsType >::interceptors_ [private] |
Dynamic array of registered interceptors.
Definition at line 87 of file Interceptor_List_T.h.