blob: 17145076c281c5272dc36f5472b7c906ff4ec72c (
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
|
/* -*- C++ -*- */
// = LIBRARY
// TAO
// = FILENAME
// params.hh
// = AUTHOR
// Chris Cleeland
// = VERSION
// $Id$
#ifndef ACE_ROA_PARAMS_H
# define ACE_ROA_PARAMS_H
# if defined(__IIOP_BUILD)
# include "boa.hh"
# else
# include <corba/boa.hh>
# endif
# include <ace/SOCK_Acceptor.h>
# include <ace/Strategies_T.h>
class ROA;
class ROA_Handler;
typedef ROA* ROA_ptr;
class ROA_Parameters
// = TITLE
// Currently a catch-all for "global" information needed by TAO
// and used until it's determined where things REALLY need to go.
// = WARNING
// NOT THREAD SAFE!
{
public:
typedef BOA::dsi_handler UpcallFunc;
typedef void (*ForwardFunc)(CORBA_OctetSeq&, CORBA_Object_ptr&, void*, CORBA_Environment&);
static ROA_Parameters* instance();
// Get a handle to the singleton instance.
// = THREAD-RELATED THINGS
//
// Need to add a member function to return a
// pointer to the concurrency strategy (ala
// ACE_Concurrency_Strategy).
int using_threads();
// Returns non-zero if the ORB should use
// threading.
void using_threads(int i);
// Sets the threading flag to <i>.
unsigned int thread_flags();
// Returns flags to be passed to <ACE_OS::thr_create()>
// on thread creation.
void thread_flags(unsigned int f);
// Set flags to be passed to <ACE_OS::thr_create()>
// on thread creation.
void* context();
void context(void* p);
// = HOOK BACK TO APPLICATION
UpcallFunc upcall();
// 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();
// 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.
ROA_ptr oa();
// 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(ROA_ptr anOA);
// Set the handle to the One True Object Adapter.
protected:
ROA_Parameters();
// Insure that instances can't be created willy-nilly
// by just any old shmoe.
private:
static ROA_Parameters* _instance;
int using_threads_; // If non-zero, threads are used for processing requests
unsigned int thread_flags_; // Flags passed to <thr_create> when threads created
void* context_p_;
UpcallFunc upcall_; // Function pointer to application upcall
ForwardFunc forwarder_; //
ROA_ptr oa_; // Pointer to One True Object Adapter
};
class ROA_Factory
{
public:
typedef ACE_Creation_Strategy<ROA_Handler> CREATION_STRATEGY;
typedef ACE_Accept_Strategy<ROA_Handler, ACE_SOCK_ACCEPTOR> ACCEPT_STRATEGY;
typedef ACE_Concurrency_Strategy<ROA_Handler> CONCURRENCY_STRATEGY;
typedef ACE_Scheduling_Strategy<ROA_Handler> SCHEDULING_STRATEGY;
CREATION_STRATEGY* creation_strategy();
ACCEPT_STRATEGY* accept_strategy();
CONCURRENCY_STRATEGY* concurrency_strategy();
SCHEDULING_STRATEGY* scheduling_strategy();
static ROA_Factory* instance();
protected:
ROA_Factory();
private:
static ROA_Factory* _instance;
CONCURRENCY_STRATEGY* concurrency_strategy_;
ACE_Thread_Strategy<ROA_Handler> threaded_strategy_;
// Someday we'll need these!
#if 0
CREATION_STRATEGY* creation_strategy_;
ACCEPT_STRATEGY* accept_strategy_;
SCHEDULING_STRATEGY* scheduling_strategy_;
#endif
};
# if defined(__ACE_INLINE__)
# include "params.i"
# endif
#endif
|