1 #include "tao/PI/ClientRequestDetails.h"
2 #include "tao/SystemException.h"
4 #if TAO_HAS_INTERCEPTORS == 1
6 #if !defined (__ACE_INLINE__)
7 #include "tao/PI/ClientRequestDetails.inl"
8 #endif /* defined INLINE */
10 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
15 ClientRequestDetails::apply_policies (const CORBA::PolicyList
&policies
)
17 // Flag to check for duplicate ProcessingModePolicy objects in the list.
18 bool processing_mode_applied
= false;
20 const CORBA::ULong plen
= policies
.length ();
22 for (CORBA::ULong i
= 0; i
< plen
; ++i
)
24 CORBA::Policy_var policy
= CORBA::Policy::_duplicate (policies
[i
]);
26 if (CORBA::is_nil (policy
.in ()))
28 // Just ignore nil policies...
32 // Obtain the PolicyType from the current Policy object.
33 const CORBA::PolicyType policy_type
=
34 policy
->policy_type ();
36 if (policy_type
== PortableInterceptor::PROCESSING_MODE_POLICY_TYPE
)
38 if (processing_mode_applied
)
40 // This is the second time we have run into this policy type,
41 // and that is not allowed.
42 throw ::CORBA::INV_POLICY ();
45 // Flip the flag to true in order to trap any dupes.
46 processing_mode_applied
= true;
48 // Narrow the Policy to the ProcessingModePolicy interface.
49 PortableInterceptor::ProcessingModePolicy_var pm_policy
=
50 PortableInterceptor::ProcessingModePolicy::_narrow (
53 // Save the value of the ProcessingModePolicy in our data member.
54 this->processing_mode_
= pm_policy
->processing_mode ();
58 // We don't support the current policy type.
59 throw ::CORBA::INV_POLICY ();
65 TAO_END_VERSIONED_NAMESPACE_DECL
67 #endif /* TAO_HAS_INTERCEPTORS == 1 */