Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / PortableServer / POA_Cached_Policies.cpp
blob04c49144bb8c3eea00a869a5bbc0b5d103cdc5ec
1 #include "tao/PortableServer/POA_Cached_Policies.h"
2 #include "tao/PortableServer/POA_Policy_Set.h"
3 #include "tao/PortableServer/IdAssignmentPolicyC.h"
4 #include "tao/PortableServer/IdUniquenessPolicyC.h"
5 #include "tao/PortableServer/ImplicitActivationPolicyC.h"
6 #include "tao/PortableServer/LifespanPolicyC.h"
7 #include "tao/PortableServer/RequestProcessingPolicyC.h"
8 #include "tao/PortableServer/ServantRetentionPolicyC.h"
9 #include "tao/PortableServer/ThreadPolicyC.h"
11 #if !defined (__ACE_INLINE__)
12 # include "tao/PortableServer/POA_Cached_Policies.inl"
13 #endif /* ! __ACE_INLINE__ */
15 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
17 namespace TAO
19 namespace Portable_Server
21 Cached_Policies::Cached_Policies () :
22 thread_ (::PortableServer::ORB_CTRL_MODEL),
23 lifespan_ (::PortableServer::TRANSIENT),
24 id_uniqueness_ (::PortableServer::UNIQUE_ID),
25 id_assignment_ (::PortableServer::SYSTEM_ID),
26 implicit_activation_ (::PortableServer::NO_IMPLICIT_ACTIVATION),
27 servant_retention_ (::PortableServer::RETAIN),
28 request_processing_ (::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY),
29 priority_model_ (Cached_Policies::NOT_SPECIFIED),
30 server_priority_ (TAO_INVALID_PRIORITY),
31 network_priority_model_ (Cached_Policies::NO_NETWORK_PRIORITY),
32 request_diffserv_codepoint_ (0),
33 reply_diffserv_codepoint_ (0)
38 Cached_Policies::~Cached_Policies ()
42 void
43 Cached_Policies::update (TAO_POA_Policy_Set &policy_set)
45 for (CORBA::ULong i = 0; i < policy_set.num_policies (); i++)
47 CORBA::Policy_var policy = policy_set.get_policy_by_index (i);
49 this->update_policy (policy.in ());
53 void
54 Cached_Policies::update_policy (const CORBA::Policy_ptr policy)
56 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
57 ::PortableServer::ThreadPolicy_var thread
58 = ::PortableServer::ThreadPolicy::_narrow (policy);
60 if (!CORBA::is_nil (thread.in ()))
62 this->thread_ = thread->value ();
64 return;
66 #endif /* TAO_HAS_MINIMUM_POA == 0 */
68 #if !defined (CORBA_E_MICRO)
69 ::PortableServer::LifespanPolicy_var lifespan
70 = ::PortableServer::LifespanPolicy::_narrow (policy);
72 if (!CORBA::is_nil (lifespan.in ()))
74 this->lifespan_ = lifespan->value ();
76 return;
78 #endif
80 #if !defined (CORBA_E_MICRO)
81 ::PortableServer::IdUniquenessPolicy_var id_uniqueness
82 = ::PortableServer::IdUniquenessPolicy::_narrow (policy);
84 if (!CORBA::is_nil (id_uniqueness.in ()))
86 this->id_uniqueness_ = id_uniqueness->value ();
88 return;
90 #endif
92 #if !defined (CORBA_E_MICRO)
93 ::PortableServer::IdAssignmentPolicy_var id_assignment
94 = ::PortableServer::IdAssignmentPolicy::_narrow (policy);
96 if (!CORBA::is_nil (id_assignment.in ()))
98 this->id_assignment_ = id_assignment->value ();
100 return;
102 #endif
104 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
106 ::PortableServer::ImplicitActivationPolicy_var implicit_activation
107 = ::PortableServer::ImplicitActivationPolicy::_narrow (policy);
109 if (!CORBA::is_nil (implicit_activation.in ()))
111 this->implicit_activation_ = implicit_activation->value ();
113 return;
116 ::PortableServer::ServantRetentionPolicy_var servant_retention
117 = ::PortableServer::ServantRetentionPolicy::_narrow (policy);
119 if (!CORBA::is_nil (servant_retention.in ()))
121 this->servant_retention_ = servant_retention->value ();
123 return;
126 ::PortableServer::RequestProcessingPolicy_var request_processing
127 = ::PortableServer::RequestProcessingPolicy::_narrow (policy);
129 if (!CORBA::is_nil (request_processing.in ()))
131 this->request_processing_ = request_processing->value ();
133 return;
136 #endif /* TAO_HAS_MINIMUM_POA == 0 */
138 #if defined (CORBA_E_MICRO)
139 ACE_UNUSED_ARG (policy);
140 #endif
145 TAO_END_VERSIONED_NAMESPACE_DECL