summaryrefslogtreecommitdiff
path: root/TAO/tao/PortableServer/Active_Policy_Strategies.h
blob: c0ff0e06b216ddc6683de88eb3de06841bac53fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// -*- C++ -*-

//=============================================================================
/**
 *  @file Active_Policy_Strategies.h
 *
 *  @author  Johnny Willemsen  <jwillemsen@remedy.nl>
 */
//=============================================================================

#ifndef TAO_PORTABLESERVER_ACTIVE_POLICY_STRATEGIES_H
#define TAO_PORTABLESERVER_ACTIVE_POLICY_STRATEGIES_H

#include /**/ "ace/pre.h"

#include "tao/orbconf.h"
#include <memory>

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "tao/PortableServer/ThreadPolicyC.h"
#include "tao/PortableServer/IdAssignmentPolicyC.h"
#include "tao/PortableServer/IdUniquenessPolicyC.h"
#include "tao/PortableServer/ServantRetentionPolicyC.h"
#include "tao/PortableServer/LifespanPolicyC.h"
#include "tao/PortableServer/ImplicitActivationPolicyC.h"
#include "tao/PortableServer/RequestProcessingPolicyC.h"

#include "tao/PortableServer/ThreadStrategy.h"
#include "tao/PortableServer/IdAssignmentStrategy.h"
#include "tao/PortableServer/IdUniquenessStrategy.h"
#include "tao/PortableServer/ImplicitActivationStrategy.h"
#include "tao/PortableServer/LifespanStrategy.h"
#include "tao/PortableServer/RequestProcessingStrategy.h"
#include "tao/PortableServer/ServantRetentionStrategy.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

class TAO_Root_POA;

namespace TAO
{
  namespace Portable_Server
  {
    class Cached_Policies;

    /**
     * This class stores the active policy strategies used for a certain POA.
     */
    class Active_Policy_Strategies
    {
    public:
      Active_Policy_Strategies () = default;

      void update (Cached_Policies &policies, TAO_Root_POA* poa);

      void cleanup ();

      ThreadStrategy *thread_strategy () const;

      RequestProcessingStrategy *request_processing_strategy () const;

      IdAssignmentStrategy *id_assignment_strategy () const;

      IdUniquenessStrategy *id_uniqueness_strategy () const;

      LifespanStrategy *lifespan_strategy () const;

      ImplicitActivationStrategy *implicit_activation_strategy () const;

      ServantRetentionStrategy *servant_retention_strategy () const;

    private:
      void create (::PortableServer::ThreadPolicyValue value);
      void create (::PortableServer::IdAssignmentPolicyValue value);
      void create (::PortableServer::IdUniquenessPolicyValue value);
      void create (::PortableServer::ServantRetentionPolicyValue value);
      void create (::PortableServer::LifespanPolicyValue value);
      void create (::PortableServer::ImplicitActivationPolicyValue value);
      void create (::PortableServer::RequestProcessingPolicyValue value, ::PortableServer::ServantRetentionPolicyValue srvalue);

    private:
      std::unique_ptr<ThreadStrategy> thread_strategy_ {};
      std::unique_ptr<IdAssignmentStrategy> id_assignment_strategy_ {};
      std::unique_ptr<IdUniquenessStrategy> id_uniqueness_strategy_ {};
      std::unique_ptr<ServantRetentionStrategy> servant_retention_strategy_ {};
      std::unique_ptr<LifespanStrategy> lifespan_strategy_ {};
      std::unique_ptr<ImplicitActivationStrategy> implicit_activation_strategy_ {};
      std::unique_ptr<RequestProcessingStrategy> request_processing_strategy_ {};
    };

    /**
     * This class quards the cleanup of strategies if something went wrong
     * in the code that called Active_Policy_Strategies::update().
     */
    class Active_Policy_Strategies_Cleanup_Guard
    {
    public:
      Active_Policy_Strategies_Cleanup_Guard () = delete;
      Active_Policy_Strategies_Cleanup_Guard (Active_Policy_Strategies *p);
      ~Active_Policy_Strategies_Cleanup_Guard ();
      Active_Policy_Strategies *_retn ();

    private:
      Active_Policy_Strategies *ptr_;
    };
  }
}

TAO_END_VERSIONED_NAMESPACE_DECL

#if defined (__ACE_INLINE__)
# include "tao/PortableServer/Active_Policy_Strategies.inl"
#endif /* __ACE_INLINE__ */

#include /**/ "ace/post.h"

#endif /* TAO_PORTABLESERVER_ACTIVE_POLICY_STRATEGIES_H */