CORBA::Object Class Reference

Implementation of a CORBA object reference. More...

#include <Object.h>

Inheritance diagram for CORBA::Object:

Inheritance graph
[legend]
Collaboration diagram for CORBA::Object:

Collaboration graph
[legend]
List of all members.

Spec defined methods

These methods are defined here since they are required by the CORBA spec in a form specified by the C++ mapping.

virtual CORBA::Boolean _is_a (const char *logical_type_id)
 Determine if we are of the type specified by the "logical_type_id".
virtual const char * _interface_repository_id (void) const
virtual CORBA::ULong _hash (CORBA::ULong maximum)
virtual CORBA::Boolean _is_equivalent (CORBA::Object_ptr other_obj)
virtual CORBA::Boolean _non_existent (void)
 Determine if we are of the type specified by the "logical_type_id".
virtual InterfaceDef_ptr _get_interface (void)
 Get info about the object from the Interface Repository.
virtual CORBA::Object_ptr _get_component (void)
 Get info about the object from the Interface Repository.
virtual char * _repository_id (void)
 Get the repository id.
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)
 Determine if we are of the type specified by the "logical_type_id".
virtual void _create_request (CORBA::Context_ptr ctx, const 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)
 Determine if we are of the type specified by the "logical_type_id".
virtual CORBA::Request_ptr _request (const char *operation)
 DII operation to create a request.
CORBA::Policy_ptr _get_policy (CORBA::PolicyType type)
 Determine if we are of the type specified by the "logical_type_id".
CORBA::Policy_ptr _get_cached_policy (TAO_Cached_Policy_Type type)
 Determine if we are of the type specified by the "logical_type_id".
CORBA::Object_ptr _set_policy_overrides (const CORBA::PolicyList &policies, CORBA::SetOverrideType set_add)
 Determine if we are of the type specified by the "logical_type_id".
CORBA::PolicyList * _get_policy_overrides (const CORBA::PolicyTypeSeq &types)
 Determine if we are of the type specified by the "logical_type_id".
CORBA::Boolean _validate_connection (CORBA::PolicyList_out inconsistent_policies)
 Determine if we are of the type specified by the "logical_type_id".
virtual CORBA::ORB_ptr _get_orb (void)
 Determine if we are of the type specified by the "logical_type_id".
static CORBA::Object_ptr _duplicate (CORBA::Object_ptr obj)
 Increment the ref count.
static CORBA::Object_ptr _nil (void)
 Return a NULL object.
static CORBA::Object_ptr _narrow (CORBA::Object_ptr obj)
 No-op it is just here to simplify some templates.

Public Types

typedef Object_ptr _ptr_type
typedef Object_var _var_type
typedef Object_out _out_type

Public Member Functions

virtual ~Object (void)
 Destructor.
virtual TAO_Abstract_ServantBase_servant (void) const
virtual CORBA::Boolean _is_collocated (void) const
virtual CORBA::Boolean _is_local (void) const
 Is this a local object?
virtual TAO::ObjectKey * _key (void)
 Object (TAO_Stub *p, CORBA::Boolean collocated=0, TAO_Abstract_ServantBase *servant=0, TAO_ORB_Core *orb_core=0)
 Constructor.
 Object (IOP::IOR *ior, TAO_ORB_Core *orb_core=0)
virtual TAO_Stub_stubobj (void) const
 Get the underlying stub object.
virtual TAO_Stub_stubobj (void)
virtual void _proxy_broker (TAO::Object_Proxy_Broker *proxy_broker)
 Set the proxy broker.
virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr)
 Allows us to forbid marshaling of local interfaces.
CORBA::Boolean is_evaluated (void) const
 Accessor to the flag..
void set_collocated_servant (TAO_Abstract_ServantBase *)
 Mutator for setting the servant in collocated cases.
TAO_ORB_Coreorb_core (void) const
 Accessor for the ORB_Core..
IOP::IOR * steal_ior (void)
 Accessors for the underlying IOP::IOR's.
const IOP::IOR & ior (void) const
virtual bool can_convert_to_ior (void) const
 Can this object be stringified?
virtual char * convert_to_ior (bool use_omg_ior_format, const char *ior_prefix) const
Reference Count Managment
These are the standard CORBA object reference count manipulations methods.

virtual void _add_ref (void)
 Increment the reference count.
virtual void _remove_ref (void)
 Decrement the reference count.
virtual CORBA::ULong _refcount_value (void) const
 Get the refcount.

Static Public Member Functions

static CORBA::Boolean marshal (const Object_ptr x, TAO_OutputCDR &cdr)
static void _tao_any_destructor (void *)
 Used in the implementation of CORBA::Any.
static CORBA::Boolean is_nil_i (CORBA::Object_ptr obj)
 Uninlined part of the now-inlined CORBA::is_nil().
static void tao_object_initialize (Object *)
 Helper function for reading contents of an IOR.

Protected Member Functions

 Object (int dummy=0)
 Initializing a local object.
TAO::Object_Proxy_Broker * proxy_broker () const

Protected Attributes

TAO_Configurable_Refcount refcount_
 Number of outstanding references to this object.

Private Member Functions

 Object (const Object &)
Objectoperator= (const Object &)

Private Attributes

CORBA::Boolean is_local_
 Specify whether this is a local object or not.
CORBA::Boolean is_evaluated_
 Flag to indicate whether the IOP::IOR has been evaluated fully.
IOP::IOR_var ior_
TAO_ORB_Coreorb_core_
 Cached pointer of our ORB_Core.
TAO_Stubprotocol_proxy_
ACE_Lockobject_init_lock_
 Protect reference count manipulation from race conditions.

Detailed Description

Implementation of a CORBA object reference.

All CORBA objects, both unconstrained and locality-constrained, inherit from this class. The interface is defined in the CORBA specification and the C++ mapping.

Definition at line 98 of file Object.h.


Member Typedef Documentation

typedef Object_out CORBA::Object::_out_type

Reimplemented in CORBA::LocalObject, and CORBA::Policy.

Definition at line 240 of file Object.h.

typedef Object_ptr CORBA::Object::_ptr_type

Reimplemented in CORBA::LocalObject, and CORBA::Policy.

Definition at line 238 of file Object.h.

typedef Object_var CORBA::Object::_var_type

Reimplemented in CORBA::LocalObject, and CORBA::Policy.

Definition at line 239 of file Object.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL CORBA::Object::~Object ( void   )  [virtual]

Destructor.

Definition at line 38 of file Object.cpp.

00039 {
00040   if (this->protocol_proxy_)
00041     (void) this->protocol_proxy_->_decr_refcnt ();
00042 
00043   delete this->object_init_lock_;
00044 }

CORBA::Object::Object ( TAO_Stub p,
CORBA::Boolean  collocated = 0,
TAO_Abstract_ServantBase servant = 0,
TAO_ORB_Core orb_core = 0 
)

Constructor.

This constructor should not be called when the protocol proxy is null ie. when the object is a LocalObject. Assert that requirement.

Definition at line 46 of file Object.cpp.

References ACE_ASSERT, TAO_Stub::collocated_servant(), TAO_Resource_Factory::create_corba_object_lock(), TAO_Resource_Factory::create_corba_object_refcount(), TAO_Stub::is_collocated(), object_init_lock_, TAO_Stub::orb_core(), orb_core_, protocol_proxy_, refcount_, and TAO_ORB_Core::resource_factory().

00050   : is_local_ (false)
00051     , is_evaluated_ (true)
00052     , ior_ (0)
00053     , orb_core_ (orb_core)
00054     , protocol_proxy_ (protocol_proxy)
00055     , object_init_lock_ (0)
00056 {
00057   /// This constructor should not be called when the protocol proxy is
00058   /// null ie. when the object is a LocalObject. Assert that
00059   /// requirement.
00060   ACE_ASSERT (this->protocol_proxy_ != 0);
00061 
00062   if (this->orb_core_ == 0)
00063     this->orb_core_ = this->protocol_proxy_->orb_core ();
00064 
00065   this->object_init_lock_ =
00066     this->orb_core_->resource_factory ()->create_corba_object_lock ();
00067 
00068   this->refcount_ =
00069     this->orb_core_->resource_factory ()->create_corba_object_refcount ();
00070 
00071   // Set the collocation marker on the stub. This may not be news to it.
00072   // This may also change the stub's object proxy broker.
00073   this->protocol_proxy_->is_collocated (collocated);
00074 
00075   // Set the collocated servant pointer (null if not collocated) on the stub.
00076   this->protocol_proxy_->collocated_servant (servant);
00077 }

CORBA::Object::Object ( IOP::IOR *  ior,
TAO_ORB_Core orb_core = 0 
)

Definition at line 79 of file Object.cpp.

References TAO_Resource_Factory::create_corba_object_lock(), TAO_Resource_Factory::create_corba_object_refcount(), object_init_lock_, orb_core_, refcount_, and TAO_ORB_Core::resource_factory().

00081   : is_local_ (false)
00082     , is_evaluated_ (false)
00083     , ior_ (ior)
00084     , orb_core_ (orb_core)
00085     , protocol_proxy_ (0)
00086     , object_init_lock_ (0)
00087 {
00088   this->object_init_lock_ =
00089     this->orb_core_->resource_factory ()->create_corba_object_lock ();
00090 
00091   this->refcount_ =
00092     this->orb_core_->resource_factory ()->create_corba_object_refcount ();
00093 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE CORBA::Object::Object ( int  dummy = 0  )  [protected]

Initializing a local object.

Definition at line 10 of file Object.inl.

00011   : is_local_ (true),
00012     is_evaluated_ (true),
00013     ior_ (),
00014     orb_core_ (0),
00015     protocol_proxy_ (0),
00016     object_init_lock_ (0)
00017 {
00018 }

CORBA::Object::Object ( const Object  )  [private]


Member Function Documentation

void CORBA::Object::_add_ref ( void   )  [virtual]

Increment the reference count.

Definition at line 114 of file Object.cpp.

References TAO_Configurable_Refcount::increment(), and refcount_.

Referenced by CORBA::Policy::_duplicate(), _duplicate(), and CORBA::LocalObject::_duplicate().

00115 {
00116   this->refcount_.increment ();
00117 }

void CORBA::Object::_create_request ( CORBA::Context_ptr  ctx,
const 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 
) [virtual]

Determine if we are of the type specified by the "logical_type_id".

Reimplemented in CORBA::LocalObject.

Definition at line 419 of file Object.cpp.

References TAO_Dynamic_Adapter::create_request(), TAO_ORB_Core::dynamic_adapter_name(), ACE_Dynamic_Service< TYPE >::instance(), and TAO_OBJECT_IOR_EVALUATE.

00427 {
00428   TAO_OBJECT_IOR_EVALUATE;
00429 
00430   // Since we don't really support Context, anything but a null pointer
00431   // is a no-no.
00432   // Neither can we create a request object from locality constrained
00433   // object references.
00434   if (ctx != 0 || this->protocol_proxy_ == 0)
00435     {
00436       throw ::CORBA::NO_IMPLEMENT ();
00437     }
00438 
00439   TAO_Dynamic_Adapter *dynamic_adapter =
00440     ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance (
00441         TAO_ORB_Core::dynamic_adapter_name ()
00442       );
00443 
00444   dynamic_adapter->create_request (
00445                        this,
00446                        this->protocol_proxy_->orb_core ()-> orb (),
00447                        operation,
00448                        arg_list,
00449                        result,
00450                        exceptions,
00451                        request,
00452                        req_flags);
00453 }

void CORBA::Object::_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 
) [virtual]

Determine if we are of the type specified by the "logical_type_id".

Reimplemented in CORBA::LocalObject.

Definition at line 381 of file Object.cpp.

References TAO_Dynamic_Adapter::create_request(), TAO_ORB_Core::dynamic_adapter_name(), ACE_Dynamic_Service< TYPE >::instance(), and TAO_OBJECT_IOR_EVALUATE.

00387 {
00388   TAO_OBJECT_IOR_EVALUATE;
00389 
00390   // Since we don't really support Context, anything but a null pointer
00391   // is a no-no.
00392   // Neither can we create a request object from locality constrained
00393   // object references.
00394   if (ctx != 0 || this->protocol_proxy_ == 0)
00395     {
00396       throw ::CORBA::NO_IMPLEMENT ();
00397     }
00398 
00399   TAO_Dynamic_Adapter *dynamic_adapter =
00400     ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance (
00401         TAO_ORB_Core::dynamic_adapter_name ()
00402       );
00403 
00404   dynamic_adapter->create_request (
00405                        this,
00406                        this->protocol_proxy_->orb_core ()-> orb (),
00407                        operation,
00408                        arg_list,
00409                        result,
00410                        0,
00411                        request,
00412                        req_flags
00413                      );
00414 }

ACE_INLINE CORBA::Object_ptr CORBA::Object::_duplicate ( CORBA::Object_ptr  obj  )  [static]

Increment the ref count.

Definition at line 21 of file Object.inl.

References _add_ref().

Referenced by _narrow(), TAO_Object_Ref_Table::bind(), TAO::Objref_Traits< CORBA::Object >::duplicate(), TAO_Object_Ref_Table::find(), TAO_ServerRequest::forward_location(), TAO::Invocation_Base::forwarded_reference(), TAO_ORB_Core::implrepo_service(), TAO::LocateRequest_Invocation_Adapter::invoke(), TAO::Invocation_Adapter::invoke_i(), TAO_ORB_Core::resolve_codecfactory(), TAO_ORB_Core::resolve_compression_manager(), TAO_ORB_Core::resolve_dynanyfactory(), TAO_ORB_Core::resolve_ior_manipulation(), TAO_ORB_Core::resolve_ior_table(), TAO_ORB_Core::resolve_monitor(), TAO_ORB_Core::resolve_picurrent(), TAO_ORB_Core::resolve_poa_current(), CORBA::ORB::resolve_policy_current(), CORBA::ORB::resolve_policy_manager(), TAO_ORB_Core::resolve_rt_orb(), TAO_ORB_Core::resolve_typecodefactory(), and TAO_ORB_Core::root_poa().

00022 {
00023   if (obj)
00024     {
00025       obj->_add_ref ();
00026     }
00027 
00028   return obj;
00029 }

CORBA::Policy_ptr CORBA::Object::_get_cached_policy ( TAO_Cached_Policy_Type  type  ) 

Determine if we are of the type specified by the "logical_type_id".

Reimplemented in CORBA::LocalObject.

Definition at line 548 of file Object.cpp.

References TAO_Stub::get_cached_policy(), protocol_proxy_, and TAO_OBJECT_IOR_EVALUATE_RETURN.

00549 {
00550   TAO_OBJECT_IOR_EVALUATE_RETURN;
00551 
00552   if (this->protocol_proxy_)
00553     return this->protocol_proxy_->get_cached_policy (type);
00554   else
00555     throw ::CORBA::NO_IMPLEMENT ();
00556 }

CORBA::Object_ptr CORBA::Object::_get_component ( void   )  [virtual]

Get info about the object from the Interface Repository.

Reimplemented in CORBA::LocalObject.

Definition at line 512 of file Object.cpp.

References proxy_broker(), and TAO_OBJECT_IOR_EVALUATE_RETURN.

00513 {
00514   TAO_OBJECT_IOR_EVALUATE_RETURN;
00515   return this->proxy_broker ()->_get_component (this);
00516 }

CORBA::InterfaceDef_ptr CORBA::Object::_get_interface ( void   )  [virtual]

Get info about the object from the Interface Repository.

Reimplemented in CORBA::LocalObject.

Definition at line 505 of file Object.cpp.

References proxy_broker(), and TAO_OBJECT_IOR_EVALUATE_RETURN.

00506 {
00507   TAO_OBJECT_IOR_EVALUATE_RETURN;
00508   return this->proxy_broker ()->_get_interface (this);
00509 }

CORBA::ORB_ptr CORBA::Object::_get_orb ( void   )  [virtual]

Determine if we are of the type specified by the "logical_type_id".

Reimplemented in CORBA::LocalObject.

Definition at line 644 of file Object.cpp.

References CORBA::ORB::_duplicate(), and TAO_OBJECT_IOR_EVALUATE_RETURN.

00645 {
00646   if (this->orb_core_ != 0)
00647     {
00648       return CORBA::ORB::_duplicate (this->orb_core_->orb ());
00649     }
00650   else
00651     {
00652       TAO_OBJECT_IOR_EVALUATE_RETURN;
00653       if (this->protocol_proxy_)
00654         return CORBA::ORB::_duplicate (this->protocol_proxy_->orb_core ()->orb ());
00655       else
00656         throw ::CORBA::INTERNAL ();
00657     }
00658 }

CORBA::Policy_ptr CORBA::Object::_get_policy ( CORBA::PolicyType  type  ) 

Determine if we are of the type specified by the "logical_type_id".

Reimplemented in CORBA::LocalObject.

Definition at line 537 of file Object.cpp.

References TAO_Stub::get_policy(), protocol_proxy_, and TAO_OBJECT_IOR_EVALUATE_RETURN.

00538 {
00539   TAO_OBJECT_IOR_EVALUATE_RETURN;
00540 
00541   if (this->protocol_proxy_)
00542     return this->protocol_proxy_->get_policy (type);
00543   else
00544     throw ::CORBA::NO_IMPLEMENT ();
00545 }

CORBA::PolicyList * CORBA::Object::_get_policy_overrides ( const CORBA::PolicyTypeSeq &  types  ) 

Determine if we are of the type specified by the "logical_type_id".

Reimplemented in CORBA::LocalObject.

Definition at line 597 of file Object.cpp.

References TAO_Stub::get_policy_overrides(), protocol_proxy_, and TAO_OBJECT_IOR_EVALUATE_RETURN.

00598 {
00599   TAO_OBJECT_IOR_EVALUATE_RETURN;
00600   if (this->protocol_proxy_)
00601     return this->protocol_proxy_->get_policy_overrides (types);
00602   else
00603     throw ::CORBA::NO_IMPLEMENT ();
00604 }

CORBA::ULong CORBA::Object::_hash ( CORBA::ULong  maximum  )  [virtual]

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.

Reimplemented in CORBA::LocalObject.

Definition at line 285 of file Object.cpp.

References TAO_Stub::hash(), protocol_proxy_, and TAO_OBJECT_IOR_EVALUATE_RETURN.

00286 {
00287   TAO_OBJECT_IOR_EVALUATE_RETURN;
00288 
00289   if (this->protocol_proxy_ != 0)
00290     return this->protocol_proxy_->hash (maximum);
00291   else
00292     {
00293       // Locality-constrained object.
00294 
00295       // Note that we reinterpret_cast to an "unsigned long" instead
00296       // of CORBA::ULong since we need to first cast to an integer
00297       // large enough to hold an address to avoid compile-time
00298       // warnings on some 64-bit platforms.
00299       const CORBA::ULong hash =
00300         static_cast<CORBA::ULong> (reinterpret_cast<ptrdiff_t> (this));
00301 
00302       return hash % maximum;
00303     }
00304 }

const char * CORBA::Object::_interface_repository_id ( void   )  const [virtual]

The repository ID for the most derived class, this is an implementation method and does no remote invocations!

Reimplemented in CORBA::Policy.

Definition at line 242 of file Object.cpp.

00243 {
00244   return "IDL:omg.org/CORBA/Object:1.0";
00245 }

CORBA::Boolean CORBA::Object::_is_a ( const char *  logical_type_id  )  [virtual]

Determine if we are of the type specified by the "logical_type_id".

Reimplemented in CORBA::Policy.

Definition at line 210 of file Object.cpp.

References proxy_broker(), ACE_OS::strcmp(), and TAO_OBJECT_IOR_EVALUATE_RETURN.

Referenced by CORBA::Policy::_is_a().

00211 {
00212   TAO_OBJECT_IOR_EVALUATE_RETURN;
00213 
00214   // NOTE: if _stub->type_id is nonzero and we have local knowledge of
00215   // it, we can answer this question without a costly remote call.
00216   //
00217   // That "local knowledge" could come from stubs or skeletons linked
00218   // into this process in the best case, or a "near" repository in a
00219   // slightly worse case.  Or in a trivial case, if the ID being asked
00220   // about is the ID we have recorded, we don't need to ask about the
00221   // inheritance relationships at all!
00222   //
00223   // In real systems having local knowledge will be common, though as
00224   // the systems built atop ORBs become richer it'll also become
00225   // common to have the "real type ID" not be directly understood
00226   // because it's more deeply derived than any locally known types.
00227   //
00228   // XXX if type_id is that of CORBA::Object, "yes, we comply" :-)
00229 
00230   if (this->protocol_proxy_ == 0)
00231     throw ::CORBA::NO_IMPLEMENT ();
00232 
00233   if (this->_stubobj ()->type_id.in () != 0
00234       && ACE_OS::strcmp (type_id,
00235                          this->_stubobj ()->type_id.in ()) == 0)
00236     return true;
00237 
00238   return this->proxy_broker ()->_is_a (this, type_id);
00239 }

CORBA::Boolean CORBA::Object::_is_collocated ( void   )  const [virtual]

Is this object collocated with the servant? Note this does not return this->is_collocated_ but will instead query the underlying stub for its collocation status

Definition at line 248 of file Object.cpp.

References TAO_Stub::is_collocated(), and protocol_proxy_.

Referenced by TAO_Default_Collocation_Resolver::is_collocated().

00249 {
00250   if (this->protocol_proxy_)
00251     {
00252       return this->protocol_proxy_->is_collocated ();
00253     }
00254 
00255   return false;
00256 }

CORBA::Boolean CORBA::Object::_is_equivalent ( CORBA::Object_ptr  other_obj  )  [virtual]

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.

Reimplemented in CORBA::LocalObject.

Definition at line 307 of file Object.cpp.

References TAO_Stub::is_equivalent(), protocol_proxy_, and TAO_OBJECT_IOR_EVALUATE_RETURN.

00308 {
00309   if (other_obj == 0)
00310     {
00311       return false;
00312     }
00313   
00314   if (other_obj == this)
00315     {
00316       return true;
00317     }
00318 
00319   TAO_OBJECT_IOR_EVALUATE_RETURN;
00320 
00321   if (this->protocol_proxy_ != 0)
00322     return this->protocol_proxy_->is_equivalent (other_obj);
00323 
00324   return false;
00325 }

CORBA::Boolean CORBA::Object::_is_local ( void   )  const [virtual]

Is this a local object?

Definition at line 266 of file Object.cpp.

References is_local_.

Referenced by CORBA::LocalObject::_narrow(), and can_convert_to_ior().

00267 {
00268   return this->is_local_;
00269 }

TAO::ObjectKey * CORBA::Object::_key ( void   )  [virtual]

Return the object key as an out parameter. Caller should release return value when finished with it.

Reimplemented in CORBA::LocalObject.

Definition at line 330 of file Object.cpp.

References _stubobj(), CORBA::SystemException::_tao_minor_code(), ACE_ERROR, ACE_TEXT, CORBA::COMPLETED_NO, LM_ERROR, TAO_Stub::profile_in_use(), TAO_debug_level, and TAO_OBJECT_IOR_EVALUATE_RETURN.

00331 {
00332   TAO_OBJECT_IOR_EVALUATE_RETURN;
00333 
00334   if (this->_stubobj () && this->_stubobj ()->profile_in_use ())
00335     return this->_stubobj ()->profile_in_use ()->_key ();
00336 
00337   if (TAO_debug_level > 2)
00338     {
00339       ACE_ERROR ((LM_ERROR,
00340                   ACE_TEXT ("TAO (%P|%t) Null object key return from ")
00341                   ACE_TEXT ("profile in use\n")));
00342     }
00343 
00344   throw ::CORBA::INTERNAL (
00345     CORBA::SystemException::_tao_minor_code (
00346       0,
00347       EINVAL),
00348     CORBA::COMPLETED_NO);
00349 }

ACE_INLINE CORBA::Object_ptr CORBA::Object::_narrow ( CORBA::Object_ptr  obj  )  [static]

No-op it is just here to simplify some templates.

Reimplemented in CORBA::LocalObject, and CORBA::Policy.

Definition at line 69 of file Object.inl.

References _duplicate().

00070 {
00071   return CORBA::Object::_duplicate (obj);
00072 }

ACE_INLINE CORBA::Object_ptr CORBA::Object::_nil ( void   )  [static]

Return a NULL object.

Reimplemented in CORBA::LocalObject, and CORBA::Policy.

Definition at line 62 of file Object.inl.

Referenced by _set_policy_overrides(), TAO_ORB_Core::create_object(), TAO_Object_Ref_Table::find(), TAO_ORB_Core::implrepo_service(), CORBA::ORB::ior_string_to_object(), TAO_CORBALOC_Parser::make_stub_from_mprofile(), TAO::Objref_Traits< CORBA::Object >::nil(), operator>>(), TAO_FILE_Parser::parse_string(), TAO_CORBANAME_Parser::parse_string(), TAO_ORB_Core::resolve_codecfactory(), TAO_ORB_Core::resolve_compression_manager(), TAO_ORB_Core::resolve_dynanyfactory(), TAO_ORB_Core::resolve_ior_manipulation(), TAO_ORB_Core::resolve_ior_table(), TAO_ORB_Core::resolve_monitor(), TAO_ORB_Core::resolve_picurrent(), TAO_ORB_Core::resolve_poa_current(), CORBA::ORB::resolve_policy_current(), CORBA::ORB::resolve_policy_manager(), TAO_ORB_Core::resolve_rir(), TAO_ORB_Core::resolve_rt_orb(), TAO_ORB_Core::resolve_typecodefactory(), TAO_ORB_Core::root_poa(), TAO_ORB_Core::shutdown(), and CORBA::ORB::url_ior_string_to_object().

00063 {
00064   return 0;
00065 }

CORBA::Boolean CORBA::Object::_non_existent ( void   )  [virtual]

Determine if we are of the type specified by the "logical_type_id".

Reimplemented in CORBA::LocalObject.

Definition at line 484 of file Object.cpp.

References proxy_broker(), and TAO_OBJECT_IOR_EVALUATE_RETURN.

00485 {
00486   TAO_OBJECT_IOR_EVALUATE_RETURN;
00487 
00488   CORBA::Boolean retval = false;
00489 
00490   try
00491     {
00492       retval = this->proxy_broker ()->_non_existent (this);
00493     }
00494   catch (const ::CORBA::OBJECT_NOT_EXIST&)
00495     {
00496       retval = true;
00497     }
00498 
00499   return retval;
00500 }

void CORBA::Object::_proxy_broker ( TAO::Object_Proxy_Broker *  proxy_broker  )  [virtual]

Set the proxy broker.

Definition at line 352 of file Object.cpp.

References TAO_Stub::object_proxy_broker(), and protocol_proxy_.

00353 {
00354   this->protocol_proxy_->object_proxy_broker (proxy_broker);
00355 }

CORBA::ULong CORBA::Object::_refcount_value ( void   )  const [virtual]

Get the refcount.

Definition at line 129 of file Object.cpp.

References refcount_, and TAO_Configurable_Refcount::value().

00130 {
00131   return static_cast<CORBA::ULong> (this->refcount_.value ());
00132 }

void CORBA::Object::_remove_ref ( void   )  [virtual]

Decrement the reference count.

Definition at line 120 of file Object.cpp.

Referenced by CORBA::release().

00121 {
00122   if (this->refcount_.decrement () != 0)
00123     return;
00124 
00125   delete this;
00126 }

char * CORBA::Object::_repository_id ( void   )  [virtual]

Get the repository id.

Reimplemented in CORBA::LocalObject.

Definition at line 520 of file Object.cpp.

References proxy_broker(), and TAO_OBJECT_IOR_EVALUATE_RETURN.

00521 {
00522   TAO_OBJECT_IOR_EVALUATE_RETURN;
00523   return this->proxy_broker ()->_repository_id (this);
00524 }

CORBA::Request_ptr CORBA::Object::_request ( const char *  operation  )  [virtual]

DII operation to create a request.

Reimplemented in CORBA::LocalObject.

Definition at line 458 of file Object.cpp.

References TAO_ORB_Core::dynamic_adapter_name(), ACE_Dynamic_Service< TYPE >::instance(), TAO_Dynamic_Adapter::request(), and TAO_OBJECT_IOR_EVALUATE_RETURN.

00459 {
00460   TAO_OBJECT_IOR_EVALUATE_RETURN;
00461   if (this->protocol_proxy_)
00462     {
00463       TAO_Dynamic_Adapter *dynamic_adapter =
00464         ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance (
00465             TAO_ORB_Core::dynamic_adapter_name ());
00466 
00467       return dynamic_adapter->request (
00468                                   this,
00469                                   this->protocol_proxy_->orb_core ()->orb (),
00470                                   operation);
00471     }
00472   else
00473     {
00474       throw ::CORBA::NO_IMPLEMENT ();
00475     }
00476 }

TAO_Abstract_ServantBase * CORBA::Object::_servant ( void   )  const [virtual]

Accessor for the cached servant reference held on the stub if this object is collocated

Definition at line 195 of file Object.cpp.

References TAO_Stub::collocated_servant(), and protocol_proxy_.

Referenced by TAO_ORB_Core::collocation_strategy().

00196 {
00197   if (this->protocol_proxy_ == 0)
00198     {
00199       // No stub set. Should not happen.
00200       return 0;
00201     }
00202 
00203   return this->protocol_proxy_->collocated_servant ();
00204 }

CORBA::Object_ptr CORBA::Object::_set_policy_overrides ( const CORBA::PolicyList &  policies,
CORBA::SetOverrideType  set_add 
)

Determine if we are of the type specified by the "logical_type_id".

Reimplemented in CORBA::LocalObject.

Definition at line 559 of file Object.cpp.

References _nil(), CORBA::SystemException::_tao_minor_code(), ACE_NEW_THROW_EX, CORBA::COMPLETED_MAYBE, orb_core(), protocol_proxy_, TAO_ORB_Core::reinitialize_object(), TAO_Stub_Auto_Ptr::release(), TAO_Stub::set_policy_overrides(), and TAO_OBJECT_IOR_EVALUATE_RETURN.

00562 {
00563   TAO_OBJECT_IOR_EVALUATE_RETURN;
00564 
00565   if (!this->protocol_proxy_)
00566     throw ::CORBA::NO_IMPLEMENT ();
00567 
00568   TAO_Stub* stub =
00569     this->protocol_proxy_->set_policy_overrides (policies, set_add);
00570 
00571   TAO_Stub_Auto_Ptr safe_stub (stub);
00572 
00573   CORBA::Object_ptr obj = CORBA::Object::_nil ();
00574 
00575   ACE_NEW_THROW_EX (obj,
00576                     CORBA::Object (stub,
00577                                   this->_is_collocated ()),
00578                     CORBA::NO_MEMORY (
00579                       CORBA::SystemException::_tao_minor_code (
00580                         0,
00581                         ENOMEM),
00582                       CORBA::COMPLETED_MAYBE));
00583 
00584   // If the stub is collocated and we don't have a collocated server we need
00585   // to reinitialize it to get it.
00586   if (stub->is_collocated () && stub->collocated_servant () == 0)
00587     {
00588       obj->orb_core ()->reinitialize_object (stub);
00589     }
00590 
00591   (void) safe_stub.release ();
00592 
00593   return obj;
00594 }

TAO_Stub * CORBA::Object::_stubobj ( void   )  [virtual]

Definition at line 278 of file Object.cpp.

References protocol_proxy_, and TAO_OBJECT_IOR_EVALUATE_RETURN.

00279 {
00280   TAO_OBJECT_IOR_EVALUATE_RETURN;
00281   return this->protocol_proxy_;
00282 }

TAO_Stub * CORBA::Object::_stubobj ( void   )  const [virtual]

Get the underlying stub object.

Definition at line 272 of file Object.cpp.

References protocol_proxy_.

Referenced by _key(), TAO_ORB_Core::collocation_strategy(), TAO::Invocation_Adapter::get_stub(), TAO::LocateRequest_Invocation_Adapter::invoke(), TAO::Collocated_Invocation::invoke(), operator<<(), and TAO_ServerRequest::TAO_ServerRequest().

00273 {
00274   return this->protocol_proxy_;
00275 }

void CORBA::Object::_tao_any_destructor ( void *   )  [static]

Used in the implementation of CORBA::Any.

Reimplemented in CORBA::Policy.

Definition at line 135 of file Object.cpp.

References CORBA::release().

00136 {
00137   CORBA::Object_ptr tmp = static_cast<CORBA::Object_ptr> (x);
00138   ::CORBA::release (tmp);
00139 }

CORBA::Boolean CORBA::Object::_validate_connection ( CORBA::PolicyList_out  inconsistent_policies  ) 

Determine if we are of the type specified by the "logical_type_id".

Reimplemented in CORBA::LocalObject.

Definition at line 607 of file Object.cpp.

References TAO_OBJECT_IOR_EVALUATE_RETURN.

00609 {
00610   TAO_OBJECT_IOR_EVALUATE_RETURN;
00611 
00612   inconsistent_policies = 0;
00613   CORBA::Boolean retval = true;
00614 
00615 #if (TAO_HAS_MINIMUM_CORBA == 0)
00616   // Note that the OBJECT_NOT_EXIST exception should be propagated to
00617   // the caller rather than return false, which is why we do not use
00618   // CORBA::Object::_non_existent().  This behavior is consistent
00619   // with the non-collocated case.
00620   if (this->_is_collocated ())
00621       return !(this->proxy_broker ()->_non_existent (this));
00622 
00623   TAO::LocateRequest_Invocation_Adapter tao_call (this);
00624   try
00625     {
00626       tao_call.invoke ();
00627     }
00628   catch (const ::CORBA::INV_POLICY&)
00629     {
00630       inconsistent_policies = tao_call.get_inconsistent_policies ();
00631       retval = false;
00632     }
00633 #else
00634   retval = false;
00635 #endif /* TAO_HAS_MINIMUM_CORBA */
00636 
00637   return retval;
00638 }

bool CORBA::Object::can_convert_to_ior ( void   )  const [virtual]

Can this object be stringified?

Definition at line 182 of file Object.cpp.

References _is_local().

00183 {
00184   // By default, objects can not be stringified if they are local
00185   return !this->_is_local ();
00186 }

char * CORBA::Object::convert_to_ior ( bool  use_omg_ior_format,
const char *  ior_prefix 
) const [virtual]

A hook to allow users to provide custom object stringification.

Note:
This method is intended to be used by classes that implement Smart Proxies and no others.

Definition at line 189 of file Object.cpp.

00190 {
00191   return 0;
00192 }

ACE_INLINE const IOP::IOR & CORBA::Object::ior ( void   )  const

Definition at line 93 of file Object.inl.

References ior_.

Referenced by is_nil_i(), and operator<<().

00094 {
00095   return this->ior_.in ();
00096 }

ACE_INLINE CORBA::Boolean CORBA::Object::is_evaluated ( void   )  const

Accessor to the flag..

Definition at line 75 of file Object.inl.

References is_evaluated_.

Referenced by is_nil_i(), TAO::Narrow_Utils< T >::lazy_evaluation(), and operator<<().

00076 {
00077   return this->is_evaluated_;
00078 }

CORBA::Boolean CORBA::Object::is_nil_i ( CORBA::Object_ptr  obj  )  [static]

Uninlined part of the now-inlined CORBA::is_nil().

Definition at line 358 of file Object.cpp.

References ior(), is_evaluated(), TAO_ORB_Core::object_is_nil(), and orb_core_.

Referenced by CORBA::is_nil().

00359 {
00360 
00361   // If the profile length is zero for a non-evaluted IOR it is a
00362   // null-object.
00363   if ((!obj->is_evaluated ()) && obj->ior ().profiles.length () == 0)
00364     return true;
00365 
00366   // To accomodate new definitions.
00367   if (obj->orb_core_)
00368     {
00369       return obj->orb_core_->object_is_nil (obj);
00370     }
00371 
00372   return false;
00373 }

CORBA::Boolean CORBA::Object::marshal ( TAO_OutputCDR cdr  )  [virtual]

Allows us to forbid marshaling of local interfaces.

Reimplemented in CORBA::Policy.

Definition at line 143 of file Object.cpp.

00144 {
00145   return (cdr << this);
00146 }

CORBA::Boolean CORBA::Object::marshal ( const Object_ptr  x,
TAO_OutputCDR cdr 
) [static]

Marshalling operator used by the stub code. A long story why the stub code uses this, let us keep it short here.

Definition at line 149 of file Object.cpp.

References ACE_OutputCDR::good_bit(), marshal(), ACE_OutputCDR::write_char(), and ACE_OutputCDR::write_ulong().

Referenced by TAO::Objref_Traits< CORBA::Object >::marshal(), and marshal().

00151 {
00152   if (x == 0)
00153     {
00154       // NIL objrefs ... marshal as empty type hint, no elements.
00155       cdr.write_ulong (1);
00156       cdr.write_char ('\0');
00157       cdr.write_ulong (0);
00158       return (CORBA::Boolean) cdr.good_bit ();
00159     }
00160 
00161   return x->marshal (cdr);
00162 }

Object& CORBA::Object::operator= ( const Object  )  [private]

ACE_INLINE TAO_ORB_Core * CORBA::Object::orb_core ( void   )  const

Accessor for the ORB_Core..

Definition at line 81 of file Object.inl.

References orb_core_.

Referenced by _set_policy_overrides(), TAO::LocateRequest_Invocation_Adapter::get_timeout(), TAO::Invocation_Adapter::get_timeout(), TAO::Narrow_Utils< T >::lazy_evaluation(), and tao_object_initialize().

00082 {
00083   return this->orb_core_;
00084 }

TAO::Object_Proxy_Broker * CORBA::Object::proxy_broker (  )  const [protected]

Convenience accessor for the object proxy broker of the underlying stub.

Definition at line 661 of file Object.cpp.

References TAO_Stub::object_proxy_broker(), protocol_proxy_, and the_tao_remote_object_proxy_broker().

Referenced by _get_component(), _get_interface(), _is_a(), _non_existent(), and _repository_id().

00662 {
00663   // Paranoid check. We *should* never access the proxy_broker
00664   // when the object has not been initialised so there *should*
00665   // alway be a stub, but just in case...
00666 
00667   if (this->protocol_proxy_)
00668     {
00669       return this->protocol_proxy_->object_proxy_broker ();
00670     }
00671 
00672   // We have no stub. We cannot be collocated.
00673   return the_tao_remote_object_proxy_broker ();
00674 }

void CORBA::Object::set_collocated_servant ( TAO_Abstract_ServantBase  ) 

Mutator for setting the servant in collocated cases.

This is used by the Object_Adapter to set the servant for collocated cases and only when the object is initialized. The object initialization takes place when IOR's are lazily evaluated.

Definition at line 259 of file Object.cpp.

References TAO_Stub::collocated_servant(), TAO_Stub::is_collocated(), and protocol_proxy_.

00260 {
00261   this->protocol_proxy_->collocated_servant (b);
00262   this->protocol_proxy_->is_collocated (true);
00263 }

ACE_INLINE IOP::IOR * CORBA::Object::steal_ior ( void   ) 

Accessors for the underlying IOP::IOR's.

The steal_ior () call basically relinquishes the ownership of the IOR. This is useful for cases when one wants to initialize a new CORBA Object

Definition at line 87 of file Object.inl.

References ior_.

Referenced by TAO::Narrow_Utils< T >::lazy_evaluation().

00088 {
00089   return this->ior_._retn ();
00090 }

void CORBA::Object::tao_object_initialize ( Object  )  [static]

Helper function for reading contents of an IOR.

Definition at line 709 of file Object.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT, TAO_ORB_Core::connector_registry(), TAO_Connector_Registry::create_profile(), TAO_ORB_Core::create_stub(), TAO_Stub_Auto_Ptr::get(), TAO_MProfile::give_profile(), TAO_ORB_Core::initialize_object(), TAO_ORB_Core::input_cdr_buffer_allocator(), TAO_ORB_Core::input_cdr_dblock_allocator(), TAO_ORB_Core::input_cdr_msgblock_allocator(), ior_, is_evaluated_, LM_ERROR, LM_WARNING, orb_core(), orb_core_, TAO_MProfile::profile_count(), protocol_proxy_, TAO_Stub_Auto_Ptr::release(), TAO_debug_level, and TAO_ORB_Core_instance().

Referenced by CORBA::Policy::copy(), CORBA::Policy::destroy(), and CORBA::Policy::policy_type().

00710 {
00711   CORBA::ULong const profile_count =
00712     obj->ior_->profiles.length ();
00713 
00714   // Assumption is that after calling this method, folks should test
00715   // for protocol_proxy_ or whatever to make sure that things have
00716   // been initialized!
00717   if (profile_count == 0)
00718     return;
00719 
00720   // get a profile container to store all profiles in the IOR.
00721   TAO_MProfile mp (profile_count);
00722 
00723   TAO_ORB_Core *&orb_core = obj->orb_core_;
00724   if (orb_core == 0)
00725     {
00726       orb_core = TAO_ORB_Core_instance ();
00727       if (TAO_debug_level > 0)
00728         {
00729           ACE_DEBUG ((LM_WARNING,
00730                       ACE_TEXT ("TAO (%P|%t) - Object::tao_object_initialize ")
00731                       ACE_TEXT ("WARNING: extracting object from ")
00732                       ACE_TEXT ("default ORB_Core\n")));
00733         }
00734     }
00735 
00736   TAO_Stub *objdata = 0;
00737 
00738   try
00739     {
00740       TAO_Connector_Registry *connector_registry =
00741         orb_core->connector_registry ();
00742 
00743       for (CORBA::ULong i = 0; i != profile_count; ++i)
00744         {
00745           IOP::TaggedProfile &tpfile = obj->ior_->profiles[i];
00746 
00747           // NOTE: This is a place for optimizations. Here we have an
00748           // 2 allocations and 2 copies. Future optimizations should
00749           // target this place.
00750           TAO_OutputCDR o_cdr;
00751 
00752           o_cdr << tpfile;
00753 
00754           TAO_InputCDR cdr (o_cdr,
00755                             orb_core->input_cdr_buffer_allocator (),
00756                             orb_core->input_cdr_dblock_allocator (),
00757                             orb_core->input_cdr_msgblock_allocator (),
00758                             orb_core);
00759 
00760           TAO_Profile *pfile = connector_registry->create_profile (cdr);
00761 
00762           if (pfile != 0)
00763             mp.give_profile (pfile);
00764         }
00765 
00766       // Make sure we got some profiles!
00767       if (mp.profile_count () != profile_count)
00768         {
00769           // @@ This occurs when profile creation fails when decoding the
00770           //    profile from the IOR.
00771           ACE_ERROR ((LM_ERROR,
00772                       ACE_TEXT ("TAO (%P|%t) ERROR: XXXXX Could not create all ")
00773                       ACE_TEXT ("profiles while extracting object\n")
00774                       ACE_TEXT ("TAO (%P|%t) ERROR: reference from the ")
00775                       ACE_TEXT ("CDR stream.\n")));
00776         }
00777 
00778 
00779       objdata = orb_core->create_stub (obj->ior_->type_id.in (), mp);
00780     }
00781   catch (const ::CORBA::Exception& ex)
00782     {
00783       if (TAO_debug_level > 0)
00784         ex._tao_print_exception (
00785           ACE_TEXT ("TAO - ERROR creating stub ")
00786           ACE_TEXT ("object when demarshaling object ")
00787           ACE_TEXT ("reference."));
00788 
00789       return;
00790     }
00791 
00792   TAO_Stub_Auto_Ptr safe_objdata (objdata);
00793 
00794   // This call will set the stub proxy broker if necessary
00795   if (orb_core->initialize_object (safe_objdata.get (), obj) == -1)
00796     return;
00797 
00798   obj->protocol_proxy_ = objdata;
00799 
00800   obj->is_evaluated_ = true;
00801 
00802   // Release the contents of the ior to keep memory consumption down.
00803   obj->ior_ = 0;
00804 
00805   // Transfer ownership to the CORBA::Object
00806   (void) safe_objdata.release ();
00807   return;
00808 }


Member Data Documentation

IOP::IOR_var CORBA::Object::ior_ [private]

If the IOR hasnt been evaluated fully, then the contents of the IOR that we received should be in here!

Definition at line 368 of file Object.h.

Referenced by ior(), steal_ior(), and tao_object_initialize().

CORBA::Boolean CORBA::Object::is_evaluated_ [private]

Flag to indicate whether the IOP::IOR has been evaluated fully.

Definition at line 364 of file Object.h.

Referenced by is_evaluated(), and tao_object_initialize().

CORBA::Boolean CORBA::Object::is_local_ [private]

Specify whether this is a local object or not.

Definition at line 361 of file Object.h.

Referenced by _is_local().

ACE_Lock* CORBA::Object::object_init_lock_ [private]

Protect reference count manipulation from race conditions.

This lock is only instantiated for unconstrained objects. The reason for this is that locality-constrained objects that do not require reference counting (the default) may be instantiated in the critical path.

Definition at line 400 of file Object.h.

Referenced by Object().

TAO_ORB_Core* CORBA::Object::orb_core_ [private]

Cached pointer of our ORB_Core.

Be aware that this pointer can be zero or not. In fact there are two ways to get this pointer filled:

Definition at line 383 of file Object.h.

Referenced by is_nil_i(), Object(), orb_core(), and tao_object_initialize().

TAO_Stub* CORBA::Object::protocol_proxy_ [private]

Pointer to the protocol-specific "object" containing important profiling information regarding this proxy. The protocol proxy is (potentially) shared among several Objects

Definition at line 391 of file Object.h.

Referenced by _get_cached_policy(), _get_policy(), _get_policy_overrides(), _hash(), _is_collocated(), _is_equivalent(), _proxy_broker(), _servant(), _set_policy_overrides(), _stubobj(), Object(), proxy_broker(), set_collocated_servant(), and tao_object_initialize().

TAO_Configurable_Refcount CORBA::Object::refcount_ [protected]

Number of outstanding references to this object.

Definition at line 351 of file Object.h.

Referenced by _add_ref(), _refcount_value(), and Object().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:39:57 2010 for TAO by  doxygen 1.4.7