Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / PortableServer / Active_Policy_Strategies.h
blobc0ff0e06b216ddc6683de88eb3de06841bac53fa
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Active_Policy_Strategies.h
7 * @author Johnny Willemsen <jwillemsen@remedy.nl>
8 */
9 //=============================================================================
11 #ifndef TAO_PORTABLESERVER_ACTIVE_POLICY_STRATEGIES_H
12 #define TAO_PORTABLESERVER_ACTIVE_POLICY_STRATEGIES_H
14 #include /**/ "ace/pre.h"
16 #include "tao/orbconf.h"
17 #include <memory>
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "tao/PortableServer/ThreadPolicyC.h"
24 #include "tao/PortableServer/IdAssignmentPolicyC.h"
25 #include "tao/PortableServer/IdUniquenessPolicyC.h"
26 #include "tao/PortableServer/ServantRetentionPolicyC.h"
27 #include "tao/PortableServer/LifespanPolicyC.h"
28 #include "tao/PortableServer/ImplicitActivationPolicyC.h"
29 #include "tao/PortableServer/RequestProcessingPolicyC.h"
31 #include "tao/PortableServer/ThreadStrategy.h"
32 #include "tao/PortableServer/IdAssignmentStrategy.h"
33 #include "tao/PortableServer/IdUniquenessStrategy.h"
34 #include "tao/PortableServer/ImplicitActivationStrategy.h"
35 #include "tao/PortableServer/LifespanStrategy.h"
36 #include "tao/PortableServer/RequestProcessingStrategy.h"
37 #include "tao/PortableServer/ServantRetentionStrategy.h"
39 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
41 class TAO_Root_POA;
43 namespace TAO
45 namespace Portable_Server
47 class Cached_Policies;
49 /**
50 * This class stores the active policy strategies used for a certain POA.
52 class Active_Policy_Strategies
54 public:
55 Active_Policy_Strategies () = default;
57 void update (Cached_Policies &policies, TAO_Root_POA* poa);
59 void cleanup ();
61 ThreadStrategy *thread_strategy () const;
63 RequestProcessingStrategy *request_processing_strategy () const;
65 IdAssignmentStrategy *id_assignment_strategy () const;
67 IdUniquenessStrategy *id_uniqueness_strategy () const;
69 LifespanStrategy *lifespan_strategy () const;
71 ImplicitActivationStrategy *implicit_activation_strategy () const;
73 ServantRetentionStrategy *servant_retention_strategy () const;
75 private:
76 void create (::PortableServer::ThreadPolicyValue value);
77 void create (::PortableServer::IdAssignmentPolicyValue value);
78 void create (::PortableServer::IdUniquenessPolicyValue value);
79 void create (::PortableServer::ServantRetentionPolicyValue value);
80 void create (::PortableServer::LifespanPolicyValue value);
81 void create (::PortableServer::ImplicitActivationPolicyValue value);
82 void create (::PortableServer::RequestProcessingPolicyValue value, ::PortableServer::ServantRetentionPolicyValue srvalue);
84 private:
85 std::unique_ptr<ThreadStrategy> thread_strategy_ {};
86 std::unique_ptr<IdAssignmentStrategy> id_assignment_strategy_ {};
87 std::unique_ptr<IdUniquenessStrategy> id_uniqueness_strategy_ {};
88 std::unique_ptr<ServantRetentionStrategy> servant_retention_strategy_ {};
89 std::unique_ptr<LifespanStrategy> lifespan_strategy_ {};
90 std::unique_ptr<ImplicitActivationStrategy> implicit_activation_strategy_ {};
91 std::unique_ptr<RequestProcessingStrategy> request_processing_strategy_ {};
94 /**
95 * This class quards the cleanup of strategies if something went wrong
96 * in the code that called Active_Policy_Strategies::update().
98 class Active_Policy_Strategies_Cleanup_Guard
100 public:
101 Active_Policy_Strategies_Cleanup_Guard () = delete;
102 Active_Policy_Strategies_Cleanup_Guard (Active_Policy_Strategies *p);
103 ~Active_Policy_Strategies_Cleanup_Guard ();
104 Active_Policy_Strategies *_retn ();
106 private:
107 Active_Policy_Strategies *ptr_;
112 TAO_END_VERSIONED_NAMESPACE_DECL
114 #if defined (__ACE_INLINE__)
115 # include "tao/PortableServer/Active_Policy_Strategies.inl"
116 #endif /* __ACE_INLINE__ */
118 #include /**/ "ace/post.h"
120 #endif /* TAO_PORTABLESERVER_ACTIVE_POLICY_STRATEGIES_H */