=default for generated implementation copy ctor
[ACE_TAO.git] / TAO / tao / PortableServer / Active_Policy_Strategies.cpp
blob244401662bf389090da4e3e73d18519b90ad3507
1 // -*- C++ -*-
2 #include "tao/PortableServer/Active_Policy_Strategies.h"
3 #include "tao/PortableServer/POA_Cached_Policies.h"
5 #include "tao/PortableServer/ThreadStrategySingle.h"
6 #include "tao/PortableServer/ThreadStrategyORBControl.h"
7 #include "tao/PortableServer/IdAssignmentStrategySystem.h"
8 #include "tao/PortableServer/IdAssignmentStrategyUser.h"
9 #include "tao/PortableServer/IdUniquenessStrategyMultiple.h"
10 #include "tao/PortableServer/IdUniquenessStrategyUnique.h"
11 #include "tao/PortableServer/ImplicitActivationStrategyExplicit.h"
12 #include "tao/PortableServer/ImplicitActivationStrategyImplicit.h"
13 #include "tao/PortableServer/LifespanStrategyPersistent.h"
14 #include "tao/PortableServer/LifespanStrategyTransient.h"
15 #include "tao/PortableServer/RequestProcessingStrategyAOMOnly.h"
16 #include "tao/PortableServer/RequestProcessingStrategyDefaultServant.h"
17 #include "tao/PortableServer/RequestProcessingStrategyServantLocator.h"
18 #include "tao/PortableServer/RequestProcessingStrategyServantActivator.h"
19 #include "tao/PortableServer/ServantRetentionStrategyNonRetain.h"
20 #include "tao/PortableServer/ServantRetentionStrategyRetain.h"
22 #if !defined (__ACE_INLINE__)
23 # include "tao/PortableServer/Active_Policy_Strategies.inl"
24 #endif /* __ACE_INLINE__ */
26 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
28 namespace TAO
30 namespace Portable_Server
32 void
33 Active_Policy_Strategies::update (Cached_Policies &policies,
34 ::TAO_Root_POA *poa)
36 this->create (policies.thread());
37 this->create (policies.id_assignment());
38 this->create (policies.id_uniqueness());
39 this->create (policies.servant_retention());
40 this->create (policies.lifespan());
41 this->create (policies.implicit_activation());
42 this->create (policies.request_processing(), policies.servant_retention());
44 /**/
45 if (this->lifespan_strategy_)
47 this->lifespan_strategy_->strategy_init (poa);
50 if (this->request_processing_strategy_)
52 this->request_processing_strategy_->strategy_init (poa);
55 if (this->id_uniqueness_strategy_)
57 this->id_uniqueness_strategy_->strategy_init (poa);
60 if (this->servant_retention_strategy_)
62 this->servant_retention_strategy_->strategy_init (poa);
66 void
67 Active_Policy_Strategies::cleanup ()
69 if (this->lifespan_strategy_)
71 this->lifespan_strategy_->strategy_cleanup ();
73 this->lifespan_strategy_.reset (nullptr);
74 if (this->request_processing_strategy_)
76 this->request_processing_strategy_->strategy_cleanup ();
78 this->request_processing_strategy_.reset (nullptr);
79 if (this->id_uniqueness_strategy_)
81 this->id_uniqueness_strategy_->strategy_cleanup ();
83 this->id_uniqueness_strategy_.reset (nullptr);
84 this->implicit_activation_strategy_.reset (nullptr);
85 this->thread_strategy_.reset (nullptr);
86 if (this->servant_retention_strategy_)
88 this->servant_retention_strategy_->strategy_cleanup ();
90 this->servant_retention_strategy_.reset (nullptr);
91 this->id_assignment_strategy_.reset (nullptr);
94 void
95 Active_Policy_Strategies::create (::PortableServer::ThreadPolicyValue value)
97 switch (value)
99 case ::PortableServer::SINGLE_THREAD_MODEL :
101 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_MICRO) && !defined (CORBA_E_COMPACT)
102 this->thread_strategy_ = std::make_unique<ThreadStrategySingle> ();
103 #endif /* TAO_HAS_MINIMUM_POA == 0 */
104 break;
106 case ::PortableServer::ORB_CTRL_MODEL :
108 this->thread_strategy_ = std::make_unique<ThreadStrategyORBControl> ();
109 break;
114 void
115 Active_Policy_Strategies::create (::PortableServer::IdAssignmentPolicyValue value)
117 switch (value)
119 case ::PortableServer::SYSTEM_ID :
121 this->id_assignment_strategy_ = std::make_unique<IdAssignmentStrategySystem> ();
122 break;
124 case ::PortableServer::USER_ID :
126 #if !defined (CORBA_E_MICRO)
127 this->id_assignment_strategy_ = std::make_unique<IdAssignmentStrategyUser> ();
128 #endif /* CORBA_E_MICRO */
129 break;
134 void
135 Active_Policy_Strategies::create (::PortableServer::IdUniquenessPolicyValue value)
137 switch (value)
139 case ::PortableServer::MULTIPLE_ID :
141 #if !defined (CORBA_E_MICRO)
142 this->id_uniqueness_strategy_ = std::make_unique<IdUniquenessStrategyMultiple> ();
143 #endif /* CORBA_E_MICRO */
144 break;
146 case ::PortableServer::UNIQUE_ID :
148 this->id_uniqueness_strategy_ = std::make_unique<IdUniquenessStrategyUnique> ();
149 break;
154 void
155 Active_Policy_Strategies::create (::PortableServer::ServantRetentionPolicyValue value)
157 switch (value)
159 case ::PortableServer::RETAIN :
161 this->servant_retention_strategy_ = std::make_unique<ServantRetentionStrategyRetain> ();
162 break;
164 case ::PortableServer::NON_RETAIN :
166 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_MICRO) && !defined (CORBA_E_COMPACT)
167 this->servant_retention_strategy_ = std::make_unique<ServantRetentionStrategyNonRetain> ();
168 #endif /* TAO_HAS_MINIMUM_POA == 0 */
169 break;
174 void
175 Active_Policy_Strategies::create (::PortableServer::LifespanPolicyValue value)
177 switch (value)
179 case ::PortableServer::PERSISTENT :
181 #if !defined (CORBA_E_MICRO)
182 this->lifespan_strategy_ = std::make_unique<LifespanStrategyPersistent> ();
183 #endif /* CORBA_E_MICRO */
184 break;
186 case ::PortableServer::TRANSIENT :
188 this->lifespan_strategy_ = std::make_unique<LifespanStrategyTransient> ();
189 break;
194 void
195 Active_Policy_Strategies::create (::PortableServer::ImplicitActivationPolicyValue value)
197 switch (value)
199 case ::PortableServer::IMPLICIT_ACTIVATION :
201 #if !defined (CORBA_E_MICRO) && !defined (CORBA_E_COMPACT)
202 this->implicit_activation_strategy_= std::make_unique<ImplicitActivationStrategyImplicit> ();
203 #endif /* CORBA_E_MICRO */
204 break;
206 case ::PortableServer::NO_IMPLICIT_ACTIVATION :
208 this->implicit_activation_strategy_ = std::make_unique<ImplicitActivationStrategyExplicit> ();
209 break;
214 void
215 Active_Policy_Strategies::create (
216 ::PortableServer::RequestProcessingPolicyValue value,
217 ::PortableServer::ServantRetentionPolicyValue srvalue)
219 switch (value)
221 case ::PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY :
223 this->request_processing_strategy_ = std::make_unique<RequestProcessingStrategyAOMOnly> ();
224 break;
226 case ::PortableServer::USE_DEFAULT_SERVANT :
228 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
229 this->request_processing_strategy_ = std::make_unique<RequestProcessingStrategyDefaultServant> ();
230 #endif /* TAO_HAS_MINIMUM_POA == 0 */
231 break;
233 case ::PortableServer::USE_SERVANT_MANAGER :
235 switch (srvalue)
237 case ::PortableServer::RETAIN :
239 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
240 this->request_processing_strategy_ = std::make_unique<RequestProcessingStrategyServantActivator> ();
241 #endif /* TAO_HAS_MINIMUM_POA == 0 */
242 break;
244 case ::PortableServer::NON_RETAIN :
246 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
247 this->request_processing_strategy_ = std::make_unique<RequestProcessingStrategyServantLocator> ();
248 #endif /* TAO_HAS_MINIMUM_POA == 0 */
249 break;
252 break;
259 TAO_END_VERSIONED_NAMESPACE_DECL