OpenDDS  Snapshot(2023/04/28-20:55)
Object.cpp
Go to the documentation of this file.
1 // Copyright 1994-1995 by Sun Microsystems Inc.
2 // Copyright 1997-2002 by Washington University
3 // All Rights Reserved
4 //
5 // ORB: CORBA::Object operations
6 
7 #define TAOLIB_ERROR ACELIB_ERROR
8 #define TAOLIB_DEBUG ACELIB_DEBUG
9 
10 #include "tao/Object.h"
11 #include "tao/SystemException.h"
12 
13 #if !defined (__ACE_INLINE__)
14 # include "tao/Object.inl"
15 #endif /* ! __ACE_INLINE__ */
16 
18 {
19 }
20 
21 CORBA::Object::Object(TAO_Stub* protocol_proxy,
25  : is_local_(false)
26  , is_evaluated_(true)
27  , ior_(0)
28  , orb_core_(orb_core)
29  , protocol_proxy_(protocol_proxy)
31 {
32 }
33 
35  : is_local_(false)
36  , is_evaluated_(false)
37  , ior_(ior)
38  , orb_core_(orb_core)
39  , protocol_proxy_(0)
41 {
42 }
43 
44 void
46 {
47  ++this->refcount_;
48 }
49 
50 void
52 {
53  if (--this->refcount_ != 0)
54  return;
55 
56  delete this;
57 }
58 
61 {
62 #if defined ACE_HAS_CPP11 && defined TAO_OBJECT_USES_STD_ATOMIC_REFCOUNT
63  return this->refcount_;
64 #else
65  return this->refcount_.value ();
66 #endif /* ACE_HAS_CPP11 && TAO_OBJECT_USES_STD_ATOMIC_REFCOUNT */
67 }
68 
69 void
71 {
72 }
73 
76 {
77  return false;
78 }
79 
80 /*static*/ CORBA::Boolean
82 {
83  return false;
84 }
85 
86 bool
88 {
89  return false;
90 }
91 
92 char*
93 CORBA::Object::convert_to_ior(bool, const char*) const
94 {
95  return 0;
96 }
97 
100 {
101  return 0;
102 }
103 
104 // IS_A ... ask the object if it's an instance of the type whose
105 // logical type ID is passed as a parameter.
106 
108 CORBA::Object::_is_a(const char*)
109 {
110  throw ::CORBA::NO_IMPLEMENT();
111 }
112 
113 const char*
115 {
116  return "IDL:omg.org/CORBA/Object:1.0";
117 }
118 
121 {
122  return false;
123 }
124 
127 {
128  return this->is_local_;
129 }
130 
131 TAO_Stub *
133 {
134  return this->protocol_proxy_;
135 }
136 
137 TAO_Stub *
139 {
140 
141  return this->protocol_proxy_;
142 }
143 
146 {
147  {
148  // Locality-constrained object.
149 
150  // Note that we reinterpret_cast to an "unsigned long" instead
151  // of CORBA::ULong since we need to first cast to an integer
152  // large enough to hold an address to avoid compile-time
153  // warnings on some 64-bit platforms.
154  const CORBA::ULong hash =
155  static_cast<CORBA::ULong>(reinterpret_cast<ptrdiff_t>(this));
156 
157  return hash % maximum;
158  }
159 }
160 
163 {
164  if (other_obj == 0)
165  {
166  return false;
167  }
168 
169  if (other_obj == this)
170  {
171  return true;
172  }
173 
174  return false;
175 }
176 
177 // TAO's extensions
178 
181 {
182  return 0;
183 }
184 
185 void
187 {
188 }
189 
192 {
193  return !obj;
194 }
195 
196 
197 
198 #if (TAO_HAS_MINIMUM_CORBA == 0)
199 
200 #if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
201 void
203  const char*,
207  CORBA::Flags)
208 {
209 }
210 #endif
211 
212 #if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
213 void
215  const char*,
221  CORBA::Flags)
222 {
223 }
224 #endif
225 
226 #if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
228 CORBA::Object::_request(const char*)
229 {
230  return 0;
231 }
232 #endif
233 
236 {
237  return false;
238 }
239 
240 
241 #if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO)
244 {
245  return 0;
246 }
247 
250 {
251  return 0;
252 }
253 #endif
254 
255 char*
257 {
258  return 0;
259 }
260 
261 #endif /* TAO_HAS_MINIMUM_CORBA */
262 
263 // ****************************************************************
264 
265 // @@ Does it make sense to support policy stuff for locality constrained
266 // objects? Also, does it make sense to bind policies with stub object?
267 // - nw.
268 
269 #if (TAO_HAS_CORBA_MESSAGING == 1)
270 
273 {
274  throw ::CORBA::NO_IMPLEMENT();
275 }
276 
279 {
280  throw ::CORBA::NO_IMPLEMENT();
281 }
282 
285 {
286  throw ::CORBA::NO_IMPLEMENT();
287 }
288 
291 {
292  throw ::CORBA::NO_IMPLEMENT();
293 }
294 
297 {
298  return true;
299 }
300 
301 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
302 
303 
306 {
307  throw ::CORBA::INTERNAL();
308 }
309 
312 {
313  return 0;
314 }
315 
316 /*****************************************************************
317  * Global Functions
318  ****************************************************************/
319 
322 {
323  return false;
324 }
325 
326 /*static*/ void
328 {
329  return;
330 }
331 
334 {
335  return false;
336 }
337 
338 #if defined (GEN_OSTREAM_OPS)
339 
340 std::ostream&
341 operator<<(std::ostream &strm, CORBA::Object_ptr)
342 {
343  return strm;
344 }
345 
346 #endif /* GEN_OSTREAM_OPS */
347 
348 // =========================================================
349 // Traits specializations for CORBA::Object.
350 namespace TAO
351 {
352 
353  void In_Object_Argument_Cloner_T<CORBA::InterfaceDef_ptr>::duplicate
355  {
356  }
357 
358  void In_Object_Argument_Cloner_T<CORBA::InterfaceDef_ptr>::release
360  {
361  }
362 
364  Objref_Traits<CORBA::Object>::duplicate(CORBA::Object_ptr p)
365  {
366  return CORBA::Object::_duplicate(p);
367  }
368 
369  void
370  Objref_Traits<CORBA::Object>::release(CORBA::Object_ptr p)
371  {
372  ::CORBA::release(p);
373  }
374 
376  Objref_Traits<CORBA::Object>::nil()
377  {
378  return CORBA::Object::_nil();
379  }
380 
382  Objref_Traits<CORBA::Object>::marshal(const CORBA::Object_ptr p,
383  TAO_OutputCDR & cdr)
384  {
385  return ::CORBA::Object::marshal(p, cdr);
386  }
387 } // close TAO namespace
388 
389 
390 TAO::Object_Proxy_Broker* (*_TAO_Object_Proxy_Broker_Factory_function_pointer)() = 0;
CORBA::Boolean operator>>(TAO_InputCDR &, CORBA::Object *&)
Definition: Object.cpp:333
virtual InterfaceDef_ptr _get_interface(void)
Definition: Object.cpp:243
CORBA::Boolean is_evaluated_
TAO_ORB_Core * orb_core(void) const
int hash(const std::vector< const DDS::OctetSeq *> &src, DDS::OctetSeq &dst)
Object(TAO_Stub *p, CORBA::Boolean collocated=false, TAO_Abstract_ServantBase *servant=0, TAO_ORB_Core *orb_core=0)
Definition: Object.cpp:21
virtual void _remove_ref(void)
Definition: Object.cpp:51
virtual TAO::ObjectKey * _key(void)
Definition: Object.cpp:180
virtual CORBA::Boolean _is_local(void) const
Definition: Object.cpp:126
static void _tao_any_destructor(void *)
Definition: Object.cpp:70
InterfaceDef * InterfaceDef_ptr
virtual void _proxy_broker(TAO::Object_Proxy_Broker *proxy_broker)
Definition: Object.cpp:186
sequence< PolicyType > PolicyTypeSeq
virtual void _add_ref(void)
Definition: Object.cpp:45
CORBA::Policy_ptr _get_cached_policy(TAO_Cached_Policy_Type type)
static CORBA::Object_ptr _duplicate(CORBA::Object_ptr obj)
virtual CORBA::ORB_ptr _get_orb(void)
Definition: Object.cpp:305
virtual TAO_Stub * _stubobj(void) const
Definition: Object.cpp:132
virtual CORBA::Boolean marshal(TAO_OutputCDR &cdr)
Definition: Object.cpp:75
virtual CORBA::Object_ptr _get_component(void)
Definition: Object.cpp:249
static CORBA::Object_ptr _nil(void)
CORBA::ULong PolicyType
static CORBA::Boolean is_nil_i(CORBA::Object_ptr obj)
Definition: Object.cpp:191
ULong Flags
virtual char * convert_to_ior(bool use_omg_ior_format, const char *ior_prefix) const
Definition: Object.cpp:93
virtual const char * _interface_repository_id(void) const
Definition: Object.cpp:114
IOP::IOR_var ior_
virtual bool can_convert_to_ior(void) const
Definition: Object.cpp:87
ACE_Atomic_Op< TAO_SYNCH_MUTEX, unsigned long > refcount_
ACE_CDR::ULong ULong
TAO::Object_Proxy_Broker * proxy_broker() const
Definition: Object.cpp:311
ACE_CDR::Boolean Boolean
TAO_Cached_Policy_Type
virtual CORBA::Boolean _is_a(const char *logical_type_id)
Definition: Object.cpp:108
sequence< Policy > PolicyList
virtual ~Object(void)
Definition: Object.cpp:17
virtual CORBA::Boolean _is_collocated(void) const
Definition: Object.cpp:120
CORBA::PolicyList * _get_policy_overrides(const CORBA::PolicyTypeSeq &types)
virtual CORBA::Request_ptr _request(const char *operation)
Definition: Object.cpp:228
TYPE value(void) const
CORBA::Boolean is_local_
virtual CORBA::ULong _hash(CORBA::ULong maximum)
Definition: Object.cpp:145
CORBA::Policy_ptr _get_policy(CORBA::PolicyType type)
virtual void _create_request(CORBA::Context_ptr ctx, const char *operation, CORBA::NVList_ptr arg_list, CORBA::NamedValue_ptr result, CORBA::Request_ptr &request, CORBA::Flags req_flags)
Definition: Object.cpp:202
ACE_OSTREAM_TYPE & operator<<(ACE_OSTREAM_TYPE &os, const CORBA::Exception &e)
Definition: Exception.cpp:115
SetOverrideType
TAO_ORB_Core * orb_core_
virtual char * _repository_id(void)
Definition: Object.cpp:256
static void tao_object_initialize(Object *)
Definition: Object.cpp:327
CORBA::Object_ptr _set_policy_overrides(const CORBA::PolicyList &policies, CORBA::SetOverrideType set_add)
CORBA::Boolean _validate_connection(CORBA::PolicyList_out inconsistent_policies)
virtual TAO_Abstract_ServantBase * _servant(void) const
Definition: Object.cpp:99
virtual CORBA::Boolean _non_existent(void)
Definition: Object.cpp:235
TAO_Stub * protocol_proxy_
virtual CORBA::Boolean _is_equivalent(CORBA::Object_ptr other_obj)
Definition: Object.cpp:162
TAO_SYNCH_MUTEX object_init_lock_
virtual CORBA::ULong _refcount_value(void) const
Definition: Object.cpp:60
const IOP::IOR & ior(void) const