3
//=============================================================================
7
* ORB_Manager.h,v 1.10 2003/10/28 18:29:30 bala Exp
9
* @author Chris Cleeland <cleeland@cs.wustl.edu>
11
//=============================================================================
13
#ifndef TAO_ORB_MANAGER_H
14
#define TAO_ORB_MANAGER_H
15
#include /**/ "ace/pre.h"
17
#include "PortableServer.h"
19
#if !defined (ACE_LACKS_PRAGMA_ONCE)
21
#endif /* ACE_LACKS_PRAGMA_ONCE */
26
* @class TAO_ORB_Manager
28
* @brief Helper class for simple ORB/POA initialization and
29
* registering servants with the POA.
31
* This class is a TAO extension that makes it easier to write
32
* CORBA applications. It's just a wrapper and doesn't do
33
* anything special within the ORB itself.
35
class TAO_PortableServer_Export TAO_ORB_Manager
38
// = Initialization and termination methods.
41
* @param orb pointer to an ORB which is duplicated an stored
42
* internally in an ORB_var. If pointer is 0,
43
* a new ORB pointer is created internally in the init()
46
* @param poa pointer to a POA which is duplicated and stored
47
* internally in a POA_var. If pointer is 0,
48
* a pointer to the Root POA is obtained from the ORB.
50
* @param poa_manager pointer to a POA Manager which is duplicated
51
* and stored internally in a POAManager_var.
52
* If pointer is 0, a new POAManager is created
53
* internally in the init() call.
55
TAO_ORB_Manager (CORBA::ORB_ptr orb = 0,
56
PortableServer::POA_ptr poa = 0,
57
PortableServer::POAManager_ptr poa_manager = 0);
59
/** Initialize the ORB/root POA, using the supplied command line
60
* arguments or the default ORB components.
62
* @return -1 on failure, 0 on success
66
ACE_ENV_ARG_DECL_WITH_DEFAULTS);
68
/** Initialize the ORB/root POA, using the supplied command line
69
* arguments or the default ORB components.
71
* @return -1 on failure, 0 on success
76
ACE_ENV_ARG_DECL_WITH_DEFAULTS);
79
* Creates a child poa under the root poa with PERSISTENT and
80
* USER_ID policies. Call this if you want a <child_poa> with the
81
* above policies, otherwise call init.
83
* @return -1 on failure, 0 on success
85
int init_child_poa (int &argc,
88
ACE_ENV_ARG_DECL_WITH_DEFAULTS);
91
* Creates a child poa under the root poa with PERSISTENT and
92
* USER_ID policies. Call this if you want a <child_poa> with the
93
* above policies, otherwise call init. Returns -1 on failure.
95
int init_child_poa (int &argc,
99
ACE_ENV_ARG_DECL_WITH_DEFAULTS);
101
/** Shut down. Invoke the destroy() methods on the orb and poa.
103
* @return -1 on failure, 0 on success
105
int fini (ACE_ENV_SINGLE_ARG_DECL);
108
~TAO_ORB_Manager (void);
110
// = Accessor methods.
113
* Put POA manager into the <Active> state, so that incoming corba
114
* requests are processed. This method is useful for clients,
115
* which are not going to enter "orb->run" loop, yet may want to
116
* service incoming requests while waiting for a result of CORBA
119
* @return -1 on failure, 0 on success
121
int activate_poa_manager (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
124
* Activate <servant>, using the POA <activate_object> call. Users
125
* can call this method multiple times to activate multiple objects.
127
* @return 0 on failure, a string representation of the object ID if
128
* successful. Caller of this method is responsible for
129
* memory deallocation of the string.
131
char *activate (PortableServer::Servant servant
132
ACE_ENV_ARG_DECL_WITH_DEFAULTS);
134
/** Deactivate object in RootPOA.
136
* @param id a string representation of the Object ID
137
* of the servant to deactivate in the POA
139
void deactivate (const char *id
140
ACE_ENV_ARG_DECL_WITH_DEFAULTS);
143
* Precondition: init_child_poa has been called. Activate <servant>
144
* using the POA <activate_object_with_id> created from the string
145
* <object_name>. Users should call this to activate objects under
148
* @param object_name String name which will be used to create
149
* an Object ID for the servant.
150
* @param servant The servant to activate under the child POA.
152
* @return 0 on failure, a string representation of the object ID if
153
* successful. Caller of this method is responsible for
154
* memory deallocation of the string.
156
char *activate_under_child_poa (const char *object_name,
157
PortableServer::Servant servant
158
ACE_ENV_ARG_DECL_WITH_DEFAULTS);
160
/** Deactivate object in child POA.
162
* @param id string representation of the object ID, which represents
163
* the object to deactivate in the POA
165
void deactivate_under_child_poa (const char *id
166
ACE_ENV_ARG_DECL_WITH_DEFAULTS);
168
/** Run the ORB event loop with the specified <tv> time value.
170
* @param tv the time interval for how long to run the ORB event loop.
171
* @return -1 on failure, 0 on success
173
int run (ACE_Time_Value &tv
174
ACE_ENV_ARG_DECL_WITH_DEFAULTS);
175
int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
178
* Accessor which returns the ORB pointer. Following the normal
179
* CORBA memory management rules of return values from functions,
180
* this function duplicates the orb return value before returning
183
* @return orb ORB pointer which has been duplicated, so caller
184
* must release pointer when done.
186
CORBA::ORB_ptr orb (void);
189
* Accessor which returns the root poa. Following the normal CORBA
190
* memory management rules of return values from functions, this
191
* function duplicates the poa return value before returning it.
193
* @return poa Root POA pointer which has been duplicated. Caller
194
* must release pointer when done.
196
PortableServer::POA_ptr root_poa (void);
199
* Accessor which returns the child poa. Following the normal CORBA
200
* memory management rules of return values from functions, this
201
* function duplicates the poa return value before returning it.
203
* @return Child POA pointer which has been duplicated. Caller
204
* must release pointer when done.
206
PortableServer::POA_ptr child_poa (void);
209
* Accessor which returns the poa manager. Following the normal
210
* CORBA memory management rules of return values from functions,
211
* this function duplicates the poa manager return value before
214
* @return POAManager pointer which has been duplicated. Caller
215
* must release pointer when done.
217
PortableServer::POAManager_ptr poa_manager (void);
223
/// The POA for this ORB.
224
PortableServer::POA_var poa_;
226
/// Child poa under the root POA.
227
PortableServer::POA_var child_poa_;
229
/// The POA manager of poa_.
230
PortableServer::POAManager_var poa_manager_;
234
#include /**/ "ace/post.h"
235
#endif /* TAO_ORB_MANAGER_H */