summaryrefslogtreecommitdiff
path: root/TAO/tao/LocalObject.h
blob: b22b71d60e061c096b825f44db9502bd84192ac5 (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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
// This may look like C, but it's really -*- C++ -*-
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO
//
// = FILENAME
//    LocalObject.h
//
// = DESCRIPTION
//     Header file for CORBA's base "LocalObject" type.
//
//     A "LocalObject" is an entity that can be the target of an local
//     invocation.  See the CORBA Component Model specification for details.
//
// = AUTHOR
//     Portions Copyright 1997 by Washington University
//
// ============================================================================

#ifndef TAO_CORBA_OBJECT_H
#define TAO_CORBA_OBJECT_H
#include "ace/pre.h"

#include "tao/corbafwd.h"
#include "tao/Object.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

class TAO_Export CORBA::LocalObject : public virtual CORBA::Object
{
  // @@ NW: It is not clear whether minimum CORBA should support
  //    LocalObject or not.  I think it should.
public:
  virtual ~LocalObject (void);
  // destructor

  static CORBA::LocalObject_ptr _duplicate (CORBA::LocalObject_ptr obj);
  // increment the ref count

  static CORBA::LocalObject_ptr _nil (void);
  // return a NUL object

  static CORBA::LocalObject_ptr _narrow (CORBA::Object_ptr obj,
                                         CORBA_Environment &ACE_TRY_ENV =
                                           TAO_default_environment ());
  static CORBA::LocalObject_ptr _unchecked_narrow (CORBA::Object_ptr obj,
                                                   CORBA_Environment &ACE_TRY_ENV =
                                                     TAO_default_environment ());
  // no-op it is just here to simplify some templates.

  static void _tao_any_destructor (void*);
  // @@ Does this stuff make sense at all in LocalObject?
  // Used in the implementation of CORBA::Any

  // These calls correspond to over-the-wire operations, or at least
  // do so in many common cases.  The normal implementation assumes a
  // particular simple, efficient, protocol-neutral interface for
  // making such calls, but may be overridden when it appears
  // appropriate.

  virtual CORBA::Boolean _is_a (const CORBA::Char *logical_type_id,
                                CORBA_Environment &ACE_TRY_ENV =
                                  TAO_default_environment ());
  // throws NO_IMPLEMENT.

  virtual const char* _interface_repository_id (void) const;
  // The repository ID for the most derived class, this is an
  // implementation method and does no remote invocations!

  virtual TAO_ServantBase *_servant (void) const;
  // return 0.

  virtual CORBA::Boolean _is_collocated (void) const;
  // return 0 (even if local object is always collocated, there's no
  // servant associate with the object (the object itself implement
  // all operations.

#if (TAO_HAS_MINIMUM_CORBA == 0)

  virtual CORBA::Boolean _non_existent (CORBA_Environment &ACE_TRY_ENV =
                                          TAO_default_environment ());
  // Always returns false.

  virtual CORBA::ImplementationDef_ptr
      _get_implementation (CORBA_Environment &ACE_TRY_ENV =
                             TAO_default_environment ());
  // throws NO_IMPLEMENT.


  virtual CORBA::InterfaceDef_ptr _get_interface (CORBA_Environment &ACE_TRY_ENV =
                                                    TAO_default_environment ());
  // throws NO_IMPLEMENT.

#endif /* TAO_HAS_MINIMUM_CORBA */

#if (TAO_HAS_CORBA_MESSAGING == 1)

  CORBA::Policy_ptr _get_policy (
      CORBA::PolicyType type,
      CORBA::Environment &ACE_TRY_ENV =
        TAO_default_environment ()
    );
  // throws NO_IMPLEMENT.

  CORBA::Policy_ptr _get_client_policy (
      CORBA::PolicyType type,
      CORBA::Environment &ACE_TRY_ENV =
        TAO_default_environment ()
    );
  // throws NO_IMPLEMENT.

  CORBA::Object_ptr _set_policy_overrides (
      const CORBA::PolicyList & policies,
      CORBA::SetOverrideType set_add,
      CORBA::Environment &ACE_TRY_ENV =
        TAO_default_environment ()
    );
  // throws NO_IMPLEMENT.

  CORBA::PolicyList * _get_policy_overrides (
      const CORBA::PolicyTypeSeq & types,
      CORBA::Environment &ACE_TRY_ENV =
        TAO_default_environment ()
    );
  // throws NO_IMPLEMENT.

  CORBA::Boolean _validate_connection (
      CORBA::PolicyList_out inconsistent_policies,
      CORBA::Environment &ACE_TRY_ENV =
        TAO_default_environment ()
    );
  // throws NO_IMPLEMENT.

#endif /* TAO_HAS_CORBA_MESSAGING == 1 */

  virtual CORBA::ULong _hash (CORBA::ULong maximum,
                              CORBA_Environment &ACE_TRY_ENV =
                                TAO_default_environment ());
  // Return a (potentially non-unique) hash value for this object.
  // This method relies on the representation of the object
  // reference's private state.  Since that changes easily (when
  // different ORB protocols are in use) there is no default
  // implementation.

  virtual CORBA::Boolean _is_equivalent (CORBA::Object_ptr other_obj,
                                         CORBA_Environment &ACE_TRY_ENV =
                                             TAO_default_environment ())
    ACE_THROW_SPEC (());
  // Try to determine if this object is the same as <other_obj>.  This
  // method relies on the representation of the object reference's
  // private state.  Since that changes easily (when different ORB
  // protocols are in use) there is no default implementation.

#if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8
  typedef CORBA_Object_ptr _ptr_type;
  typedef CORBA_Object_var _var_type;
#endif /* __GNUC__ */
  // Useful for template programming.

  // = TAO extensions

  // = Reference count managment.
  CORBA::ULong _incr_refcnt (void);
  // Increment the reference count.

  CORBA::ULong _decr_refcnt (void);
  // Decrement the reference count.

protected:
private:
#if (TAO_HAS_MINIMUM_CORBA==0)
  virtual void _create_request (CORBA::Context_ptr ctx,
                                const CORBA::Char *operation,
                                CORBA::NVList_ptr arg_list,
                                CORBA::NamedValue_ptr result,
                                CORBA::Request_ptr &request,
                                CORBA::Flags req_flags,
                                CORBA_Environment &ACE_TRY_ENV =
                                  TAO_default_environment ());

  virtual void _create_request (CORBA::Context_ptr ctx,
                                const CORBA::Char *operation,
                                CORBA::NVList_ptr arg_list,
                                CORBA::NamedValue_ptr result,
                                CORBA::ExceptionList_ptr exclist,
                                CORBA::ContextList_ptr ctxtlist,
                                CORBA::Request_ptr &request,
                                CORBA::Flags req_flags,
                                CORBA_Environment &ACE_TRY_ENV =
                                  TAO_default_environment ());

  // The default implementation of this method uses the same simple,
  // multi-protocol remote invocation interface as is assumed by the
  // calls above ... that's how it can have a default implementation.

  virtual CORBA::Request_ptr _request (const CORBA::Char *operation,
                                       CORBA_Environment &ACE_TRY_ENV =
                                        TAO_default_environment ());
  // DII operation to create a request.

#endif /* TAO_HAS_MINIMUM_CORBA == 0 */

  virtual TAO_ObjectKey *_key (CORBA_Environment &ACE_TRY_ENV =
                                 TAO_default_environment ());
  // Return the object key as an out parameter.  Caller should release
  // return value when finished with it.

  virtual const TAO_ObjectKey &_object_key (void);
  // Return a reference to the object key of profile in-use.
  // If there's no in-use profile, then the program will
  // probably crash.  This method does not create a new copy.

  virtual TAO_Stub *_stubobj (void) const;
  // get the underlying stub object

  virtual void _use_locate_requests (CORBA::Boolean use_it);
  // the the object to use a locate request for the first call to
  // the object

  // = Unimplemented methods
  CORBA_Object (const CORBA_Object &);
  CORBA_Object &operator = (const CORBA_Object &);
};

class TAO_Export CORBA::LocalObject_var
{
public:
  LocalObject_var (void); // default constructor
  LocalObject_var (CORBA::Object_ptr);
  LocalObject_var (const CORBA_Object_var &); // copy constructor
  ~LocalObject_var (void); // destructor

  LocalObject_var &operator= (CORBA::Object_ptr);
  LocalObject_var &operator= (const CORBA_Object_var &);
  CORBA::LocalObject_ptr operator-> (void) const;

  operator const CORBA::LocalObject_ptr &() const;
  operator CORBA::LocalObject_ptr &();
  // in, inout, out, _retn
  CORBA::LocalObject_ptr in (void) const;
  CORBA::LocalObject_ptr &inout (void);
  CORBA::LocalObject_ptr &out (void);
  CORBA::LocalObject_ptr _retn (void);
  CORBA::LocalObject_ptr ptr (void) const;

private:
  CORBA::LocalObject_ptr ptr_;
};

class TAO_Export CORBA::LocalObject_out
{
public:
  LocalObject_out (CORBA::Object_ptr &);
  LocalObject_out (CORBA_Object_var &);
  LocalObject_out (const CORBA_Object_out &);
  LocalObject_out &operator= (const CORBA_Object_out &);
  LocalObject_out &operator= (const CORBA_Object_var &);
  LocalObject_out &operator= (CORBA::Object_ptr);
  operator CORBA::LocalObject_ptr &();
  CORBA::LocalObject_ptr &ptr (void);
  CORBA::LocalObject_ptr operator-> (void);

private:
  CORBA::LocalObject_ptr &ptr_;
};

#if defined (__ACE_INLINE__)
# include "tao/Object.i"
#endif /* __ACE_INLINE__ */

#include "ace/post.h"
#endif /* TAO_CORBA_OBJECT_H */