Object.cpp

Go to the documentation of this file.
00001 // Copyright 1994-1995 by Sun Microsystems Inc.
00002 // Copyright 1997-2002 by Washington University
00003 // All Rights Reserved
00004 //
00005 // ORB:         CORBA::Object operations
00006 
00007 #define TAOLIB_ERROR ACELIB_ERROR
00008 #define TAOLIB_DEBUG ACELIB_DEBUG
00009 
00010 #include "tao/Object.h"
00011 #include "tao/SystemException.h"
00012 
00013 #if !defined (__ACE_INLINE__)
00014 # include "tao/Object.inl"
00015 #endif /* ! __ACE_INLINE__ */
00016 
00017 CORBA::Object::~Object()
00018 {
00019 }
00020 
00021 CORBA::Object::Object(TAO_Stub* protocol_proxy,
00022                       CORBA::Boolean,
00023                       TAO_Abstract_ServantBase*,
00024                       TAO_ORB_Core*orb_core)
00025   : is_local_(false)
00026   , is_evaluated_(true)
00027   , ior_(0)
00028   , orb_core_(orb_core)
00029   , protocol_proxy_(protocol_proxy)
00030   , object_init_lock_(0)
00031 {
00032 }
00033 
00034 CORBA::Object::Object(IOP::IOR* ior, TAO_ORB_Core* orb_core)
00035   : is_local_(false)
00036   , is_evaluated_(false)
00037   , ior_(ior)
00038   , orb_core_(orb_core)
00039   , protocol_proxy_(0)
00040   , object_init_lock_(0)
00041 {
00042 }
00043 
00044 void
00045 CORBA::Object::_add_ref()
00046 {
00047   ++this->refcount_;
00048 }
00049 
00050 void
00051 CORBA::Object::_remove_ref()
00052 {
00053   if (--this->refcount_ != 0)
00054     return;
00055 
00056   delete this;
00057 }
00058 
00059 CORBA::ULong
00060 CORBA::Object::_refcount_value() const
00061 {
00062   return static_cast<CORBA::ULong>(this->refcount_.value());
00063 }
00064 
00065 void
00066 CORBA::Object::_tao_any_destructor(void*)
00067 {
00068 }
00069 
00070 CORBA::Boolean
00071 CORBA::Object::marshal(TAO_OutputCDR&)
00072 {
00073   return false;
00074 }
00075 
00076 /*static*/ CORBA::Boolean
00077 CORBA::Object::marshal(const CORBA::Object_ptr, TAO_OutputCDR&)
00078 {
00079   return false;
00080 }
00081 
00082 bool
00083 CORBA::Object::can_convert_to_ior() const
00084 {
00085   return false;
00086 }
00087 
00088 char*
00089 CORBA::Object::convert_to_ior(bool, const char*) const
00090 {
00091   return 0;
00092 }
00093 
00094 TAO_Abstract_ServantBase*
00095 CORBA::Object::_servant() const
00096 {
00097   return 0;
00098 }
00099 
00100 // IS_A ... ask the object if it's an instance of the type whose
00101 // logical type ID is passed as a parameter.
00102 
00103 CORBA::Boolean
00104 CORBA::Object::_is_a(const char*)
00105 {
00106   throw ::CORBA::NO_IMPLEMENT();
00107 }
00108 
00109 const char*
00110 CORBA::Object::_interface_repository_id() const
00111 {
00112   return "IDL:omg.org/CORBA/Object:1.0";
00113 }
00114 
00115 CORBA::Boolean
00116 CORBA::Object::_is_collocated() const
00117 {
00118   return false;
00119 }
00120 
00121 CORBA::Boolean
00122 CORBA::Object::_is_local() const
00123 {
00124   return this->is_local_;
00125 }
00126 
00127 TAO_Stub *
00128 CORBA::Object::_stubobj() const
00129 {
00130   return this->protocol_proxy_;
00131 }
00132 
00133 TAO_Stub *
00134 CORBA::Object::_stubobj()
00135 {
00136 
00137   return this->protocol_proxy_;
00138 }
00139 
00140 CORBA::ULong
00141 CORBA::Object::_hash(CORBA::ULong maximum)
00142 {
00143     {
00144       // Locality-constrained object.
00145 
00146       // Note that we reinterpret_cast to an "unsigned long" instead
00147       // of CORBA::ULong since we need to first cast to an integer
00148       // large enough to hold an address to avoid compile-time
00149       // warnings on some 64-bit platforms.
00150       const CORBA::ULong hash =
00151         static_cast<CORBA::ULong>(reinterpret_cast<ptrdiff_t>(this));
00152 
00153       return hash % maximum;
00154     }
00155 }
00156 
00157 CORBA::Boolean
00158 CORBA::Object::_is_equivalent(CORBA::Object_ptr other_obj)
00159 {
00160   if (other_obj == 0)
00161     {
00162       return false;
00163     }
00164 
00165   if (other_obj == this)
00166     {
00167       return true;
00168     }
00169 
00170   return false;
00171 }
00172 
00173 // TAO's extensions
00174 
00175 TAO::ObjectKey *
00176 CORBA::Object::_key()
00177 {
00178   return 0;
00179 }
00180 
00181 void
00182 CORBA::Object::_proxy_broker(TAO::Object_Proxy_Broker*)
00183 {
00184 }
00185 
00186 CORBA::Boolean
00187 CORBA::Object::is_nil_i(CORBA::Object_ptr obj)
00188 {
00189   return !obj;
00190 }
00191 
00192 
00193 
00194 #if (TAO_HAS_MINIMUM_CORBA == 0)
00195 
00196 #if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00197 void
00198 CORBA::Object::_create_request(CORBA::Context_ptr,
00199                                const char*,
00200                                CORBA::NVList_ptr,
00201                                CORBA::NamedValue_ptr,
00202                                CORBA::Request_ptr&,
00203                                CORBA::Flags)
00204 {
00205 }
00206 #endif
00207 
00208 #if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00209 void
00210 CORBA::Object::_create_request(CORBA::Context_ptr,
00211                                const char*,
00212                                CORBA::NVList_ptr,
00213                                CORBA::NamedValue_ptr,
00214                                CORBA::ExceptionList_ptr,
00215                                CORBA::ContextList_ptr,
00216                                CORBA::Request_ptr&,
00217                                CORBA::Flags)
00218 {
00219 }
00220 #endif
00221 
00222 #if !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00223 CORBA::Request_ptr
00224 CORBA::Object::_request(const char*)
00225 {
00226    return 0;
00227 }
00228 #endif
00229 
00230 CORBA::Boolean
00231 CORBA::Object::_non_existent()
00232 {
00233   return false;
00234 }
00235 
00236 
00237 #if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO)
00238 CORBA::InterfaceDef_ptr
00239 CORBA::Object::_get_interface()
00240 {
00241   return 0;
00242 }
00243 
00244 CORBA::Object_ptr
00245 CORBA::Object::_get_component()
00246 {
00247   return 0;
00248 }
00249 #endif
00250 
00251 char*
00252 CORBA::Object::_repository_id()
00253 {
00254   return 0;
00255 }
00256 
00257 #endif /* TAO_HAS_MINIMUM_CORBA */
00258 
00259 // ****************************************************************
00260 
00261 // @@ Does it make sense to support policy stuff for locality constrained
00262 //    objects?  Also, does it make sense to bind policies with stub object?
00263 //    - nw.
00264 
00265 #if (TAO_HAS_CORBA_MESSAGING == 1)
00266 
00267 CORBA::Policy_ptr
00268 CORBA::Object::_get_policy(CORBA::PolicyType)
00269 {
00270   throw ::CORBA::NO_IMPLEMENT();
00271 }
00272 
00273 CORBA::Policy_ptr
00274 CORBA::Object::_get_cached_policy(TAO_Cached_Policy_Type)
00275 {
00276   throw ::CORBA::NO_IMPLEMENT();
00277 }
00278 
00279 CORBA::Object_ptr
00280 CORBA::Object::_set_policy_overrides(const PolicyList&, SetOverrideType)
00281 {
00282   throw ::CORBA::NO_IMPLEMENT();
00283 }
00284 
00285 CORBA::PolicyList *
00286 CORBA::Object::_get_policy_overrides(const PolicyTypeSeq&)
00287 {
00288   throw ::CORBA::NO_IMPLEMENT();
00289 }
00290 
00291 CORBA::Boolean
00292 CORBA::Object::_validate_connection(PolicyList_out)
00293 {
00294   return true;
00295 }
00296 
00297 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
00298 
00299 
00300 CORBA::ORB_ptr
00301 CORBA::Object::_get_orb()
00302 {
00303   throw ::CORBA::INTERNAL();
00304 }
00305 
00306 TAO::Object_Proxy_Broker *
00307 CORBA::Object::proxy_broker() const
00308 {
00309   return 0;
00310 }
00311 
00312 /*****************************************************************
00313  * Global Functions
00314  ****************************************************************/
00315 
00316 CORBA::Boolean
00317 operator<<(TAO_OutputCDR&, const CORBA::Object*)
00318 {
00319   return false;
00320 }
00321 
00322 /*static*/ void
00323 CORBA::Object::tao_object_initialize(CORBA::Object*)
00324 {
00325   return;
00326 }
00327 
00328 CORBA::Boolean
00329 operator>>(TAO_InputCDR&, CORBA::Object*&)
00330 {
00331   return false;
00332 }
00333 
00334 #if defined (GEN_OSTREAM_OPS)
00335 
00336 std::ostream&
00337 operator<<(std::ostream &strm, CORBA::Object_ptr)
00338 {
00339   return strm;
00340 }
00341 
00342 #endif /* GEN_OSTREAM_OPS */
00343 
00344 // =========================================================
00345 // Traits specializations for CORBA::Object.
00346 namespace TAO
00347 {
00348 
00349   void In_Object_Argument_Cloner_T<CORBA::InterfaceDef_ptr>::duplicate
00350                                               (CORBA::InterfaceDef_ptr)
00351   {
00352   }
00353 
00354   void In_Object_Argument_Cloner_T<CORBA::InterfaceDef_ptr>::release
00355                                               (CORBA::InterfaceDef_ptr)
00356   {
00357   }
00358 
00359   CORBA::Object_ptr
00360   Objref_Traits<CORBA::Object>::duplicate(CORBA::Object_ptr p)
00361   {
00362     return CORBA::Object::_duplicate(p);
00363   }
00364 
00365   void
00366   Objref_Traits<CORBA::Object>::release(CORBA::Object_ptr p)
00367   {
00368     ::CORBA::release(p);
00369   }
00370 
00371   CORBA::Object_ptr
00372   Objref_Traits<CORBA::Object>::nil()
00373   {
00374     return CORBA::Object::_nil();
00375   }
00376 
00377   CORBA::Boolean
00378   Objref_Traits<CORBA::Object>::marshal(const CORBA::Object_ptr p,
00379                                         TAO_OutputCDR & cdr)
00380   {
00381     return ::CORBA::Object::marshal(p, cdr);
00382   }
00383 } // close TAO namespace
00384 
00385 
00386 TAO::Object_Proxy_Broker* (*_TAO_Object_Proxy_Broker_Factory_function_pointer)() = 0;

Generated on Fri Feb 12 20:05:24 2016 for OpenDDS by  doxygen 1.4.7