ClientRequestDetails.cpp

Go to the documentation of this file.
00001 #include "tao/PI/ClientRequestDetails.h"
00002 
00003 #if TAO_HAS_INTERCEPTORS == 1
00004 
00005 #if !defined (__ACE_INLINE__)
00006 #include "tao/PI/ClientRequestDetails.inl"
00007 #endif /* defined INLINE */
00008 
00009 ACE_RCSID (PI,
00010            ClientRequestDetails,
00011            "ClientRequestDetails.cpp,v 1.3 2006/04/19 09:22:56 jwillemsen Exp")
00012 
00013 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00014 
00015 namespace TAO
00016 {
00017   void
00018   ClientRequestDetails::apply_policies (
00019       const CORBA::PolicyList &policies
00020       ACE_ENV_ARG_DECL)
00021   {
00022     // Flag to check for duplicate ProcessingModePolicy objects in the list.
00023     bool processing_mode_applied = false;
00024 
00025     const CORBA::ULong plen = policies.length ();
00026 
00027     for (CORBA::ULong i = 0; i < plen; ++i)
00028       {
00029         CORBA::Policy_var policy = CORBA::Policy::_duplicate (policies[i]);
00030 
00031         if (CORBA::is_nil (policy.in ()))
00032           {
00033             // Just ignore nil policies...
00034             continue;
00035           }
00036 
00037         // Obtain the PolicyType from the current Policy object.
00038         const CORBA::PolicyType policy_type =
00039           policy->policy_type (ACE_ENV_SINGLE_ARG_PARAMETER);
00040         ACE_CHECK;
00041 
00042         if (policy_type == PortableInterceptor::PROCESSING_MODE_POLICY_TYPE)
00043           {
00044             if (processing_mode_applied)
00045               {
00046                 // This is the second time we have run into this policy type,
00047                 // and that is not allowed.
00048                 ACE_THROW (CORBA::INV_POLICY ());
00049               }
00050 
00051             // Flip the flag to true in order to trap any dupes.
00052             processing_mode_applied = true;
00053 
00054             // Narrow the Policy to the ProcessingModePolicy interface.
00055             PortableInterceptor::ProcessingModePolicy_var pm_policy =
00056                     PortableInterceptor::ProcessingModePolicy::_narrow (
00057                                                  policy.in ()
00058                                                  ACE_ENV_ARG_PARAMETER);
00059             ACE_CHECK;
00060 
00061             // Save the value of the ProcessingModePolicy in our data member.
00062             this->processing_mode_ =
00063               pm_policy->processing_mode (ACE_ENV_SINGLE_ARG_PARAMETER);
00064             ACE_CHECK;
00065           }
00066         else
00067           {
00068             // We don't support the current policy type.
00069             ACE_THROW (CORBA::INV_POLICY ());
00070           }
00071       }
00072   }
00073 }
00074 
00075 TAO_END_VERSIONED_NAMESPACE_DECL
00076 
00077 #endif  /* TAO_HAS_INTERCEPTORS == 1 */

Generated on Thu Nov 9 12:51:39 2006 for TAO_PI by doxygen 1.3.6