diff options
Diffstat (limited to 'TAO/tao/Policy_Set.cpp')
-rw-r--r-- | TAO/tao/Policy_Set.cpp | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/TAO/tao/Policy_Set.cpp b/TAO/tao/Policy_Set.cpp index 1ec2b80722b..a8f8db0e797 100644 --- a/TAO/tao/Policy_Set.cpp +++ b/TAO/tao/Policy_Set.cpp @@ -3,17 +3,16 @@ #include "tao/Policy_Set.h" #include "tao/SystemException.h" #include "tao/debug.h" +#include "ace/CORBA_macros.h" #if !defined (__ACE_INLINE__) # include "tao/Policy_Set.inl" #endif /* ! __ACE_INLINE__ */ - ACE_RCSID (tao, Policy_Set, "$Id$") - TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Policy_Set::TAO_Policy_Set (TAO_Policy_Scope scope) @@ -29,7 +28,7 @@ TAO_Policy_Set::~TAO_Policy_Set (void) { this->cleanup_i (); } - catch ( ::CORBA::Exception&) + catch (const ::CORBA::Exception&) { // Ignore exceptions... } @@ -61,18 +60,21 @@ TAO_Policy_Set::TAO_Policy_Set (const TAO_Policy_Set &rhs) CORBA::Policy_var copy = policy->copy (); + TAO_Cached_Policy_Type const cached_type = + copy->_tao_cached_type (); + // Add the "cacheable" policies into the cache. - if (copy->_tao_cached_type () != TAO_CACHED_POLICY_UNCACHED) + if (cached_type != TAO_CACHED_POLICY_UNCACHED + && cached_type >= 0) { - this->cached_policies_[copy->_tao_cached_type ()] = - copy.ptr (); + this->cached_policies_[cached_type] = copy.ptr (); } this->policy_list_[i] = copy._retn (); } } - catch ( ::CORBA::Exception& ex) + catch (const ::CORBA::Exception& ex) { if (TAO_debug_level > 4) ex._tao_print_exception ("TAO_Policy_Set::TAO_Policy_Set"); @@ -83,8 +85,7 @@ TAO_Policy_Set::TAO_Policy_Set (const TAO_Policy_Set &rhs) } void -TAO_Policy_Set::copy_from (TAO_Policy_Set *source - ) +TAO_Policy_Set::copy_from (TAO_Policy_Set *source) { if (source == 0) { @@ -113,10 +114,14 @@ TAO_Policy_Set::copy_from (TAO_Policy_Set *source CORBA::ULong const length = this->policy_list_.length (); this->policy_list_.length (length + 1); + TAO_Cached_Policy_Type const cached_type = + copy->_tao_cached_type (); + // Add the "cacheable" policies into the cache. - if (copy->_tao_cached_type () != TAO_CACHED_POLICY_UNCACHED) + if (cached_type != TAO_CACHED_POLICY_UNCACHED + && cached_type >= 0) { - this->cached_policies_[copy->_tao_cached_type ()] = copy.ptr (); + this->cached_policies_[cached_type] = copy.ptr (); } this->policy_list_[length] = copy._retn (); @@ -146,8 +151,7 @@ TAO_Policy_Set::cleanup_i (void) // @@ !!! Add comments regarding Policy lifetimes, etc. void TAO_Policy_Set::set_policy_overrides (const CORBA::PolicyList &policies, - CORBA::SetOverrideType set_add - ) + CORBA::SetOverrideType set_add) { // @@ The spec does not say what to do on this case. if (set_add != CORBA::SET_OVERRIDE && set_add != CORBA::ADD_OVERRIDE) @@ -199,8 +203,7 @@ TAO_Policy_Set::set_policy_overrides (const CORBA::PolicyList &policies, } void -TAO_Policy_Set::set_policy (const CORBA::Policy_ptr policy - ) +TAO_Policy_Set::set_policy (const CORBA::Policy_ptr policy) { if (! this->compatible_scope (policy->_tao_scope())) { @@ -239,9 +242,11 @@ TAO_Policy_Set::set_policy (const CORBA::Policy_ptr policy // If this is a policy that gets accessed on the critical path, // save a pointer to it in the cache. - TAO_Cached_Policy_Type cached_policy_type = policy->_tao_cached_type (); + TAO_Cached_Policy_Type const cached_policy_type = + policy->_tao_cached_type (); - if (cached_policy_type != TAO_CACHED_POLICY_UNCACHED) + if (cached_policy_type != TAO_CACHED_POLICY_UNCACHED + && cached_policy_type >= 0) { this->cached_policies_[cached_policy_type] = copy.ptr (); } @@ -251,8 +256,7 @@ TAO_Policy_Set::set_policy (const CORBA::Policy_ptr policy } CORBA::PolicyList * -TAO_Policy_Set::get_policy_overrides (const CORBA::PolicyTypeSeq &types - ) +TAO_Policy_Set::get_policy_overrides (const CORBA::PolicyTypeSeq &types) { CORBA::ULong const slots = types.length (); CORBA::PolicyList *policy_list_ptr = 0; @@ -336,8 +340,7 @@ TAO_Policy_Set::get_cached_const_policy (TAO_Cached_Policy_Type type) const } CORBA::Policy_ptr -TAO_Policy_Set::get_cached_policy (TAO_Cached_Policy_Type type - ) +TAO_Policy_Set::get_cached_policy (TAO_Cached_Policy_Type type) { if (type != TAO_CACHED_POLICY_UNCACHED && type < TAO_CACHED_POLICY_MAX_CACHED) |