Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / TAO / tao / RTCORBA / RT_Endpoint_Utils.cpp
blob6e438394e395e0b79e55f1731c23314fbeec2325
1 #include "tao/RTCORBA/RT_Endpoint_Utils.h"
2 #include "tao/Profile_Transport_Resolver.h"
4 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
6 #include "tao/RTCORBA/RT_Endpoint_Selector_Factory.h"
7 #include "tao/RTCORBA/RT_Invocation_Endpoint_Selectors.h"
9 #include "tao/RTCORBA/RT_Stub.h"
11 #include "tao/SystemException.h"
13 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
15 CORBA::Policy_ptr
16 TAO_RT_Endpoint_Utils::policy (TAO_Cached_Policy_Type type,
17 TAO::Profile_Transport_Resolver &r)
19 CORBA::Policy_ptr policy = CORBA::Policy::_nil ();
21 TAO_RT_Stub * const rt_stub =
22 dynamic_cast<TAO_RT_Stub *> (r.stub ());
24 if (!rt_stub)
25 throw CORBA::INTERNAL ();
27 try
29 policy = rt_stub->get_cached_policy (type);
31 catch (const ::CORBA::INV_POLICY&)
33 if (r.inconsistent_policies ())
35 CORBA::PolicyList *p = r.inconsistent_policies ();
36 p->length (1);
37 (*p)[0u] = rt_stub->TAO_Stub::get_cached_policy (type);
40 throw;
43 return policy;
46 TAO_END_VERSIONED_NAMESPACE_DECL
48 #endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */