summaryrefslogtreecommitdiff
path: root/TAO/tao/params.h
blob: b38937052b2452c41d967258c04497d755eb0f69 (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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/* -*- C++ -*- */

// ============================================================================
//
// = LIBRARY
//    TAO
// 
// = FILENAME
//    params.hh
//
// = AUTHOR
//    Chris Cleeland
// 
// ============================================================================

#if !defined (TAO_PARAMS_H)
#  define TAO_PARAMS_H

#  include "ace/OS.h"

#  include "tao/orb.h" // get types
#  include "tao/boa.h" // Need the DSI Handler
#  include "tao/sequence.h" // for CORBA_OctetSeq

// Forward decls.

class ROA;
typedef ROA* ROA_ptr;
class TAO_OA_Connection_Handler;

class ACE_Svc_Export TAO_ORB_Parameters
// = TITLE
//    Parameters that are specific to the ORB.  These parameters can be
//    for the client, the server, or for both.
{
public:
  // = SERVER-SIDE
};

typedef enum 
  {
    TAO_NONE,
    TAO_LINEAR,
    TAO_DYNAMIC_HASH,
    TAO_ACTIVE_DEMUX,
    TAO_USER_DEFINED
  } TAO_Demux_Strategy;

class ACE_Svc_Export TAO_OA_Parameters
// = TITLE
//    Parameters specific to an Object Adapter.  By definition, this
//    is only on the server side, since a client does not have an object
//    adapter.
//
// = NOTES
//    This can be subclassed in order to have OA-specific parameters, e.g.,
//    the Realtime Object Adapter might subclass this and add its own
//    parameters.
{
public:
  static TAO_OA_Parameters *instance (void);
  // Global access point to the Singleton.

  static TAO_OA_Parameters *instance (TAO_OA_Parameters*);
  // Set the Singleton instance.

  typedef CORBA_BOA::dsi_handler UpcallFunc;
  typedef void (*ForwardFunc)(CORBA_OctetSeq &,
			      CORBA_Object_ptr &, void *, 
			      CORBA_Environment &);

  TAO_OA_Parameters (void);

  // = THREAD-RELATED THINGS
  // 
  // Need to add a member function to return a pointer to the
  // concurrency strategy (ala ACE_Concurrency_Strategy).
  int using_threads (void);
  // Returns non-zero if the ORB should use threading.

  void using_threads (int i);
  // Sets the threading flag to <i>.

  u_int thread_flags (void);
  // Returns flags to be passed to <ACE_OS::thr_create()>
  // on thread creation.

  void thread_flags (u_int f);
  // Set flags to be passed to <ACE_OS::thr_create()> on thread
  // creation.

  void *context (void);
  void context (void *p);

  // = HOOK BACK TO APPLICATION
  UpcallFunc upcall(void);
  // Pointer to the function which is the upcall from the Object
  // Adapter into the application code.  At some point this should go
  // away and be replaced with an argument to a method like
  // <ROA::register_object()>, or something.

  void upcall (UpcallFunc f);
  // Set the upcall function (see <upcall()>).

  ForwardFunc forwarder (void);
  // Haven't figured out what the forwarder really does...don't really
  // care right now.

  void forwarder (ForwardFunc f);
  // Haven't figured out what the forwarder really does...don't really
  // care right now.

  CORBA_BOA_ptr oa (void);
  // Return the handle to the One True Object Adapter.  The code from
  // which <{TAO}> is derived makes a vast assumption that there will
  // only be one Object Adapter in process.

  void oa (CORBA_BOA_ptr anOA);
  // Set the handle to the One True Object Adapter.

  void addr (ACE_INET_Addr &addr);
  // Set the address on which we're listening.

  ACE_INET_Addr addr (void);
  // Get the address on which we're listening.

  void demux_strategy (const char *strategy);
  // Specify the demultiplexing strategy to be used via <{strategy}>.
  // Valid values are one of (case matters) "linear", "dynamic_hash",
  // "user_def", or "active_demux".  If the value is not valid, then
  // <Dynamic Hash> is used as a default.
  
  void demux_strategy (TAO_Demux_Strategy s);
  // Specify the demultiplexing strategy to be used.
  
  TAO_Demux_Strategy demux_strategy (void);
  // Return the demultiplexing strategy being used.

  void userdef_lookup_strategy (TAO_Object_Table *&ot);
  // provide a way for user defined object key lookup strategies to be plugged
  // in 

  TAO_Object_Table *userdef_lookup_strategy (void);
  // return the lookup strategy

  void tablesize (CORBA_ULong tablesize);
  // set the table size for lookup table

  CORBA_ULong tablesize (void);
  // get the table size for the lookup table

protected:
  static TAO_OA_Parameters *instance_;
  // Pointer to the Singleton instance.

  static ACE_SYNCH_MUTEX ace_singleton_lock_;
  // Lock the creation of the singleton.  

  static TAO_OA_Parameters *&instance_i (void);
  // Get pointer to the Singleton instance

  static ACE_SYNCH_MUTEX &singleton_lock_i (void);
  // Get reference to Singleton lock;

private:

  int using_threads_;		
  // If non-zero, threads are used for processing requests

  u_int thread_flags_;	
  // Flags passed to <thr_create> when threads created

  void *context_p_;

  UpcallFunc upcall_;		
  // Function pointer to application upcall

  ForwardFunc forwarder_;	

  CORBA_BOA_ptr oa_;		
  // Pointer to One True Object Adapter

  TAO_Demux_Strategy demux_;  
  // demux strategy

  ACE_INET_Addr addr_;          
  // host + port number we are listening on

  CORBA_ULong tablesize_;       
  // size of object lookup table

  TAO_Object_Table *ot_;
  // concrete lookup table instance
};

// Create a type for the singleton
typedef TAO_OA_Parameters TAO_OA_PARAMS;

#  if defined(__ACE_INLINE__)
#    include "params.i"
#  endif

#endif /* TAO_PARAMS_H */