~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to TAO/tao/PortableServer/ORB_Manager.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- C++ -*- */
2
 
 
3
 
//=============================================================================
4
 
/**
5
 
 *  @file   ORB_Manager.h
6
 
 *
7
 
 *  ORB_Manager.h,v 1.10 2003/10/28 18:29:30 bala Exp
8
 
 *
9
 
 *  @author Chris Cleeland <cleeland@cs.wustl.edu>
10
 
 */
11
 
//=============================================================================
12
 
 
13
 
#ifndef TAO_ORB_MANAGER_H
14
 
#define TAO_ORB_MANAGER_H
15
 
#include /**/ "ace/pre.h"
16
 
 
17
 
#include "PortableServer.h"
18
 
 
19
 
#if !defined (ACE_LACKS_PRAGMA_ONCE)
20
 
# pragma once
21
 
#endif /* ACE_LACKS_PRAGMA_ONCE */
22
 
 
23
 
#include "tao/ORB.h"
24
 
 
25
 
/**
26
 
 * @class TAO_ORB_Manager
27
 
 *
28
 
 * @brief Helper class for simple ORB/POA initialization and
29
 
 * registering servants with the POA.
30
 
 *
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.
34
 
 */
35
 
class TAO_PortableServer_Export TAO_ORB_Manager
36
 
{
37
 
public:
38
 
  // = Initialization and termination methods.
39
 
  /** Constructor.
40
 
   *
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()
44
 
   *              call.
45
 
   *
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.
49
 
   *
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.
54
 
   */
55
 
  TAO_ORB_Manager (CORBA::ORB_ptr orb = 0,
56
 
                   PortableServer::POA_ptr poa = 0,
57
 
                   PortableServer::POAManager_ptr poa_manager = 0);
58
 
 
59
 
  /** Initialize the ORB/root POA, using the supplied command line
60
 
   *  arguments or the default ORB components.
61
 
   *
62
 
   *  @return -1 on failure, 0 on success
63
 
   */
64
 
  int init (int &argc,
65
 
            char *argv[]
66
 
            ACE_ENV_ARG_DECL_WITH_DEFAULTS);
67
 
 
68
 
  /** Initialize the ORB/root POA, using the supplied command line
69
 
    * arguments or the default ORB components.
70
 
    *
71
 
    * @return -1 on failure, 0 on success
72
 
    */
73
 
  int init (int &argc,
74
 
            char *argv[],
75
 
            const char *orb_name
76
 
            ACE_ENV_ARG_DECL_WITH_DEFAULTS);
77
 
 
78
 
  /**
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.
82
 
   *
83
 
   * @return -1 on failure, 0 on success
84
 
   */
85
 
  int init_child_poa (int &argc,
86
 
                      char *argv[],
87
 
                      const char *poa_name
88
 
                      ACE_ENV_ARG_DECL_WITH_DEFAULTS);
89
 
 
90
 
  /**
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.
94
 
   */
95
 
  int init_child_poa (int &argc,
96
 
                      char *argv[],
97
 
                      const char *poa_name,
98
 
                      const char *orb_name
99
 
                      ACE_ENV_ARG_DECL_WITH_DEFAULTS);
100
 
 
101
 
  /** Shut down.  Invoke the destroy() methods on the orb and poa.
102
 
   *
103
 
   * @return -1 on failure, 0 on success
104
 
   */
105
 
  int fini (ACE_ENV_SINGLE_ARG_DECL);
106
 
 
107
 
  /// Destructor.
108
 
  ~TAO_ORB_Manager (void);
109
 
 
110
 
  // = Accessor methods.
111
 
 
112
 
  /**
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
117
 
   *  call on a server.
118
 
   *
119
 
   *  @return -1 on failure, 0 on success
120
 
   */
121
 
  int activate_poa_manager (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
122
 
 
123
 
  /**
124
 
   * Activate <servant>, using the POA <activate_object> call.  Users
125
 
   * can call this method multiple times to activate multiple objects.
126
 
   *
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.
130
 
   */
131
 
  char *activate (PortableServer::Servant servant
132
 
                  ACE_ENV_ARG_DECL_WITH_DEFAULTS);
133
 
 
134
 
  /** Deactivate object in RootPOA.
135
 
   *
136
 
   *  @param id  a string representation of the Object ID
137
 
   *             of the servant to deactivate in the POA
138
 
   */
139
 
  void deactivate (const char *id
140
 
                   ACE_ENV_ARG_DECL_WITH_DEFAULTS);
141
 
 
142
 
  /**
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
146
 
   * the child_poa.
147
 
   *
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.
151
 
   *
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.
155
 
   */
156
 
  char *activate_under_child_poa (const char *object_name,
157
 
                                  PortableServer::Servant servant
158
 
                                  ACE_ENV_ARG_DECL_WITH_DEFAULTS);
159
 
 
160
 
  /** Deactivate object in child POA.
161
 
   *
162
 
   *  @param id  string representation of the object ID, which represents
163
 
   *             the object to deactivate in the POA
164
 
   */
165
 
  void deactivate_under_child_poa (const char *id
166
 
                                   ACE_ENV_ARG_DECL_WITH_DEFAULTS);
167
 
 
168
 
  /** Run the ORB event loop with the specified <tv> time value.
169
 
   *
170
 
   * @param tv  the time interval for how long to run the ORB event loop.
171
 
   * @return -1 on failure, 0 on success
172
 
   */
173
 
  int run (ACE_Time_Value &tv
174
 
           ACE_ENV_ARG_DECL_WITH_DEFAULTS);
175
 
  int run (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS);
176
 
 
177
 
  /**
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
181
 
   * it.
182
 
   *
183
 
   * @return orb  ORB pointer which has been duplicated, so caller
184
 
   *              must release pointer when done.
185
 
   */
186
 
  CORBA::ORB_ptr orb (void);
187
 
 
188
 
  /**
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.
192
 
   *
193
 
   * @return poa  Root POA pointer which has been duplicated.  Caller
194
 
   *              must release pointer when done.
195
 
   */
196
 
  PortableServer::POA_ptr root_poa (void);
197
 
 
198
 
  /**
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.
202
 
   *
203
 
   * @return Child POA pointer which has been duplicated.  Caller
204
 
   *         must release pointer when done.
205
 
   */
206
 
  PortableServer::POA_ptr child_poa (void);
207
 
 
208
 
  /**
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
212
 
   * returning it.
213
 
   *
214
 
   * @return POAManager pointer which has been duplicated.  Caller
215
 
   *         must release pointer when done.
216
 
   */
217
 
  PortableServer::POAManager_ptr poa_manager (void);
218
 
 
219
 
protected:
220
 
  /// The ORB.
221
 
  CORBA::ORB_var orb_;
222
 
 
223
 
  /// The POA for this ORB.
224
 
  PortableServer::POA_var poa_;
225
 
 
226
 
  /// Child poa under the root POA.
227
 
  PortableServer::POA_var child_poa_;
228
 
 
229
 
  /// The POA manager of poa_.
230
 
  PortableServer::POAManager_var poa_manager_;
231
 
};
232
 
 
233
 
 
234
 
#include /**/ "ace/post.h"
235
 
#endif /* TAO_ORB_MANAGER_H */