summaryrefslogtreecommitdiff
path: root/TAO/tao/factories.h
blob: 496dae62ed24ccb1d8968e24a04e7f682ad8251b (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// This may look like C, but it's really -*- C++ -*-

// ============================================================================
//
// = LIBRARY
//    TAO
// 
// = FILENAME
//     factories.h
//
// = AUTHOR
//     Chris Cleeland
//
// = VERSION
//     $Id$
// ============================================================================

#if !defined (TAO_FACTORIES_H)
#  define TAO_FACTORIES_H

#if 0
#  include "ace/SOCK_Acceptor.h"
#  include "ace/SOCK_Connector.h"
#  include "ace/Strategies_T.h"
#  include "ace/Connector.h"
#  include "ace/Synch.h"

#  include "tao/params.h"
#  include "tao/connect.h"
#  include "tao/objtable.h"
#endif

class TAO_Client_Connection_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
  // = TITLE
  //      <Svc_Handler> used on the client side and returned
  //      by the <TAO_Client_Factory::CONNECTOR>.
{
public:
  TAO_Client_Connection_Handler (ACE_Thread_Manager* = 0);
  // Do-nothing constructor

  virtual int open (void*);
  // Initialization hook

  void in_use (CORBA::Boolean);
  // Set the in-use flag.

  CORBA::Boolean in_use (void);
  // Return state of the in-use flag.

private:
  CORBA::Boolean in_use_;
  // True value indicates that something is using this handler.
};

class TAO_Client_Factory
  // = TITLE
  //    Abstract factory used by the client to turn out various
  //    strategies used on the client side.
{
public:
  typedef ACE_Strategy_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR> 
          CONNECTOR;
  typedef ACE_NOOP_Creation_Strategy<TAO_Client_Connection_Handler> 
          NULL_CREATION_STRATEGY;
  typedef ACE_Cached_Connect_Strategy<TAO_Client_Connection_Handler, 
                                      ACE_SOCK_CONNECTOR,
				      ACE_SYNCH_RW_MUTEX>
          CACHED_CONNECT_STRATEGY;

#if defined (TAO_HAS_CLIENT_CONCURRENCY)
  CONCURRENCY_STRATEGY *concurrency_strategy (void);
#endif
  
  CONNECTOR *connector (void);
  // Return a pointer to a connector using appropriate strategies.

  TAO_Client_Factory (void);
  ~TAO_Client_Factory (void);
  
private:
#if defined (TAO_HAS_CLIENT_CONCURRENCY)
  CONCURRENCY_STRATEGY *concurrency_strategy_;
#endif
  CONNECTOR connector_;
  NULL_CREATION_STRATEGY null_creation_strategy_;
  CACHED_CONNECT_STRATEGY caching_connect_strategy_;
};

class TAO_Server_Factory
  // = TITLE
  //    Abstract factory used by the server side to turn out various
  //    strategies of special utility to it.
{
public:
  // = SERVER-SIDE
  typedef ACE_Creation_Strategy<TAO_OA_Connection_Handler> CREATION_STRATEGY;
  typedef ACE_Accept_Strategy<TAO_OA_Connection_Handler, ACE_SOCK_ACCEPTOR> ACCEPT_STRATEGY;
  typedef ACE_Concurrency_Strategy<TAO_OA_Connection_Handler> CONCURRENCY_STRATEGY;
  typedef ACE_Scheduling_Strategy<TAO_OA_Connection_Handler> SCHEDULING_STRATEGY;

  CREATION_STRATEGY *creation_strategy (void);
  // return concrete creation strategy

  ACCEPT_STRATEGY *accept_strategy (void);
  // return concrete acceptor strategy

  CONCURRENCY_STRATEGY *concurrency_strategy (void);
  // return the concurrency strategy used

  SCHEDULING_STRATEGY *scheduling_strategy (void);
  // return the scheduling strategy used

  TAO_Object_Table *object_lookup_strategy (void);
  // return the concrete object lookup strategy

  TAO_Server_Factory (void);
  // constructor
  
private:
  // = COMMON
  ACE_Thread_Strategy<TAO_OA_Connection_Handler> threaded_strategy_;
  // The threaded strategy used for passively establishing connections.
  ACE_Reactive_Strategy<TAO_OA_Connection_Handler> reactive_strategy_;
  // A strategy for passively establishing connections which utilizes the Reactor.

  // = SERVER
  CONCURRENCY_STRATEGY *concurrency_strategy_;
  // concrete concurrency strategy

  TAO_Object_Table *objtable_;
  // instance of object table
#if 0
  // Someday we'll need these!
  CREATION_STRATEGY *creation_strategy_;
  ACCEPT_STRATEGY *accept_strategy_;
  SCHEDULING_STRATEGY *scheduling_strategy_;
#endif
};

#endif /* TAO_FACTORIES_H */