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

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1