Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

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.

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=false, TAO_Abstract_ServantBase *servant=0, TAO_ORB_Core *orb_core=0)
 Constructor.
 Object (IOP::IOR *ior, TAO_ORB_Core *orb_core)
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.

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.

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

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

Definition at line 240 of file Object.h.


Constructor & Destructor Documentation

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

Destructor.

Definition at line 38 of file Object.cpp.

{
  if (this->protocol_proxy_)
    (void) this->protocol_proxy_->_decr_refcnt ();

  delete this->object_init_lock_;
}

CORBA::Object::Object ( TAO_Stub p,
CORBA::Boolean  collocated = false,
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.

  : is_local_ (false)
    , is_evaluated_ (true)
    , ior_ (0)
    , orb_core_ (orb_core)
    , protocol_proxy_ (protocol_proxy)
    , object_init_lock_ (0)
{
  /// This constructor should not be called when the protocol proxy is
  /// null ie. when the object is a LocalObject. Assert that
  /// requirement.
  ACE_ASSERT (this->protocol_proxy_ != 0);

  if (this->orb_core_ == 0)
    this->orb_core_ = this->protocol_proxy_->orb_core ();

  this->object_init_lock_ =
    this->orb_core_->resource_factory ()->create_corba_object_lock ();

  this->refcount_ =
    this->orb_core_->resource_factory ()->create_corba_object_refcount ();

  // Set the collocation marker on the stub. This may not be news to it.
  // This may also change the stub's object proxy broker.
  this->protocol_proxy_->is_collocated (collocated);

  // Set the collocated servant pointer (null if not collocated) on the stub.
  this->protocol_proxy_->collocated_servant (servant);
}

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

Definition at line 79 of file Object.cpp.

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

Initializing a local object.

Definition at line 10 of file Object.inl.

  : is_local_ (true),
    is_evaluated_ (true),
    ior_ (),
    orb_core_ (0),
    protocol_proxy_ (0),
    object_init_lock_ (0)
{
}

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.

{
  this->refcount_.increment ();
}

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.

{
  TAO_OBJECT_IOR_EVALUATE;

  // Since we don't really support Context, anything but a null pointer
  // is a no-no.
  // Neither can we create a request object from locality constrained
  // object references.
  if (ctx != 0 || this->protocol_proxy_ == 0)
    {
      throw ::CORBA::NO_IMPLEMENT ();
    }

  TAO_Dynamic_Adapter *dynamic_adapter =
    ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance (
        TAO_ORB_Core::dynamic_adapter_name ()
      );

  dynamic_adapter->create_request (
                       this,
                       this->protocol_proxy_->orb_core ()-> orb (),
                       operation,
                       arg_list,
                       result,
                       0,
                       request,
                       req_flags
                     );
}

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.

{
  TAO_OBJECT_IOR_EVALUATE;

  // Since we don't really support Context, anything but a null pointer
  // is a no-no.
  // Neither can we create a request object from locality constrained
  // object references.
  if (ctx != 0 || this->protocol_proxy_ == 0)
    {
      throw ::CORBA::NO_IMPLEMENT ();
    }

  TAO_Dynamic_Adapter *dynamic_adapter =
    ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance (
        TAO_ORB_Core::dynamic_adapter_name ()
      );

  dynamic_adapter->create_request (
                       this,
                       this->protocol_proxy_->orb_core ()-> orb (),
                       operation,
                       arg_list,
                       result,
                       exceptions,
                       request,
                       req_flags);
}

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

Increment the ref count.

Definition at line 21 of file Object.inl.

{
  if (obj)
    {
      obj->_add_ref ();
    }

  return obj;
}

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.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;

  if (this->protocol_proxy_)
    return this->protocol_proxy_->get_cached_policy (type);
  else
    throw ::CORBA::NO_IMPLEMENT ();
}

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.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;
  return this->proxy_broker ()->_get_component (this);
}

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.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;
  return this->proxy_broker ()->_get_interface (this);
}

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, TAO_ORBInitInfo, TAO::PICurrent, TAO_POA_Manager, and TAO_Root_POA.

Definition at line 644 of file Object.cpp.

{
  if (this->orb_core_ != 0)
    {
      return CORBA::ORB::_duplicate (this->orb_core_->orb ());
    }
  else
    {
      TAO_OBJECT_IOR_EVALUATE_RETURN;
      if (this->protocol_proxy_)
        return CORBA::ORB::_duplicate (this->protocol_proxy_->orb_core ()->orb ());
      else
        throw ::CORBA::INTERNAL ();
    }
}

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.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;

  if (this->protocol_proxy_)
    return this->protocol_proxy_->get_policy (type);
  else
    throw ::CORBA::NO_IMPLEMENT ();
}

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.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;
  if (this->protocol_proxy_)
    return this->protocol_proxy_->get_policy_overrides (types);
  else
    throw ::CORBA::NO_IMPLEMENT ();
}

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.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;

  if (this->protocol_proxy_ != 0)
    return this->protocol_proxy_->hash (maximum);
  else
    {
      // Locality-constrained object.

      // Note that we reinterpret_cast to an "unsigned long" instead
      // of CORBA::ULong since we need to first cast to an integer
      // large enough to hold an address to avoid compile-time
      // warnings on some 64-bit platforms.
      const CORBA::ULong hash =
        static_cast<CORBA::ULong> (reinterpret_cast<ptrdiff_t> (this));

      return hash % maximum;
    }
}

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 TAO_AMH_DSI_Response_Handler, TAO_ORBInitInfo, PortableInterceptor::PolicyFactory, CORBA::Policy, TAO_Network_Priority_Mapping_Manager, TAO_Priority_Mapping_Manager, RTCORBA::ProtocolProperties, TAO_RTScheduler_Current, and TAO_RTScheduler_Manager.

Definition at line 242 of file Object.cpp.

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

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 PortableInterceptor::PolicyFactory, CORBA::Policy, and RTCORBA::ProtocolProperties.

Definition at line 210 of file Object.cpp.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;

  // NOTE: if _stub->type_id is nonzero and we have local knowledge of
  // it, we can answer this question without a costly remote call.
  //
  // That "local knowledge" could come from stubs or skeletons linked
  // into this process in the best case, or a "near" repository in a
  // slightly worse case.  Or in a trivial case, if the ID being asked
  // about is the ID we have recorded, we don't need to ask about the
  // inheritance relationships at all!
  //
  // In real systems having local knowledge will be common, though as
  // the systems built atop ORBs become richer it'll also become
  // common to have the "real type ID" not be directly understood
  // because it's more deeply derived than any locally known types.
  //
  // XXX if type_id is that of CORBA::Object, "yes, we comply" :-)

  if (this->protocol_proxy_ == 0)
    throw ::CORBA::NO_IMPLEMENT ();

  if (this->_stubobj ()->type_id.in () != 0
      && ACE_OS::strcmp (type_id,
                         this->_stubobj ()->type_id.in ()) == 0)
    return true;

  return this->proxy_broker ()->_is_a (this, type_id);
}

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.

{
  if (this->protocol_proxy_)
    {
      return this->protocol_proxy_->is_collocated ();
    }

  return false;
}

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.

{
  if (other_obj == 0)
    {
      return false;
    }

  if (other_obj == this)
    {
      return true;
    }

  TAO_OBJECT_IOR_EVALUATE_RETURN;

  if (this->protocol_proxy_ != 0)
    return this->protocol_proxy_->is_equivalent (other_obj);

  return false;
}

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

Is this a local object?

Definition at line 266 of file Object.cpp.

{
  return this->is_local_;
}

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.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;

  if (this->_stubobj () && this->_stubobj ()->profile_in_use ())
    return this->_stubobj ()->profile_in_use ()->_key ();

  if (TAO_debug_level > 2)
    {
      ACE_ERROR ((LM_ERROR,
                  ACE_TEXT ("TAO (%P|%t) Null object key return from ")
                  ACE_TEXT ("profile in use\n")));
    }

  throw ::CORBA::INTERNAL (
    CORBA::SystemException::_tao_minor_code (
      0,
      EINVAL),
    CORBA::COMPLETED_NO);
}

CORBA::Object_ptr CORBA::Object::_narrow ( CORBA::Object_ptr  obj  )  [static]
CORBA::Object_ptr CORBA::Object::_nil ( void   )  [static]
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.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;

  CORBA::Boolean retval = false;

  try
    {
      retval = this->proxy_broker ()->_non_existent (this);
    }
  catch (const ::CORBA::OBJECT_NOT_EXIST&)
    {
      retval = true;
    }

  return retval;
}

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

Set the proxy broker.

Definition at line 352 of file Object.cpp.

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

Get the refcount.

Definition at line 129 of file Object.cpp.

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

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

Decrement the reference count.

Reimplemented in TAO_AMH_Response_Handler.

Definition at line 120 of file Object.cpp.

{
  if (this->refcount_.decrement () != 0)
    return;

  delete this;
}

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

Get the repository id.

Reimplemented in CORBA::LocalObject.

Definition at line 520 of file Object.cpp.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;
  return this->proxy_broker ()->_repository_id (this);
}

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.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;
  if (this->protocol_proxy_)
    {
      TAO_Dynamic_Adapter *dynamic_adapter =
        ACE_Dynamic_Service<TAO_Dynamic_Adapter>::instance (
            TAO_ORB_Core::dynamic_adapter_name ());

      return dynamic_adapter->request (
                                  this,
                                  this->protocol_proxy_->orb_core ()->orb (),
                                  operation);
    }
  else
    {
      throw ::CORBA::NO_IMPLEMENT ();
    }
}

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.

{
  if (this->protocol_proxy_ == 0)
    {
      // No stub set. Should not happen.
      return 0;
    }

  return this->protocol_proxy_->collocated_servant ();
}

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.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;

  if (!this->protocol_proxy_)
    throw ::CORBA::NO_IMPLEMENT ();

  TAO_Stub* stub =
    this->protocol_proxy_->set_policy_overrides (policies, set_add);

  TAO_Stub_Auto_Ptr safe_stub (stub);

  CORBA::Object_ptr obj = CORBA::Object::_nil ();

  ACE_NEW_THROW_EX (obj,
                    CORBA::Object (stub,
                                  this->_is_collocated ()),
                    CORBA::NO_MEMORY (
                      CORBA::SystemException::_tao_minor_code (
                        0,
                        ENOMEM),
                      CORBA::COMPLETED_MAYBE));

  // If the stub is collocated and we don't have a collocated server we need
  // to reinitialize it to get it.
  if (stub->is_collocated () && stub->collocated_servant () == 0)
    {
      obj->orb_core ()->reinitialize_object (stub);
    }

  (void) safe_stub.release ();

  return obj;
}

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

Get the underlying stub object.

Definition at line 272 of file Object.cpp.

{
  return this->protocol_proxy_;
}

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

Definition at line 278 of file Object.cpp.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;
  return this->protocol_proxy_;
}

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

Used in the implementation of CORBA::Any.

Reimplemented in CORBA::Policy, and RTCORBA::ProtocolProperties.

Definition at line 135 of file Object.cpp.

{
  CORBA::Object_ptr tmp = static_cast<CORBA::Object_ptr> (x);
  ::CORBA::release (tmp);
}

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.

{
  TAO_OBJECT_IOR_EVALUATE_RETURN;

  inconsistent_policies = 0;
  CORBA::Boolean retval = true;

#if (TAO_HAS_MINIMUM_CORBA == 0)
  // Note that the OBJECT_NOT_EXIST exception should be propagated to
  // the caller rather than return false, which is why we do not use
  // CORBA::Object::_non_existent().  This behavior is consistent
  // with the non-collocated case.
  if (this->_is_collocated ())
      return !(this->proxy_broker ()->_non_existent (this));

  TAO::LocateRequest_Invocation_Adapter tao_call (this);
  try
    {
      tao_call.invoke ();
    }
  catch (const ::CORBA::INV_POLICY&)
    {
      inconsistent_policies = tao_call.get_inconsistent_policies ();
      retval = false;
    }
#else
  retval = false;
#endif /* TAO_HAS_MINIMUM_CORBA */

  return retval;
}

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

Can this object be stringified?

Definition at line 182 of file Object.cpp.

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

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.

{
  return 0;
}

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

Definition at line 93 of file Object.inl.

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

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

Accessor to the flag..

Definition at line 75 of file Object.inl.

{
  return this->is_evaluated_;
}

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.

{

  // If the profile length is zero for a non-evaluted IOR it is a
  // null-object.
  if ((!obj->is_evaluated ()) && obj->ior ().profiles.length () == 0)
    return true;

  // To accomodate new definitions.
  if (obj->orb_core_)
    {
      return obj->orb_core_->object_is_nil (obj);
    }

  return false;
}

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.

{
  if (x == 0)
    {
      // NIL objrefs ... marshal as empty type hint, no elements.
      cdr.write_ulong (1);
      cdr.write_char ('\0');
      cdr.write_ulong (0);
      return (CORBA::Boolean) cdr.good_bit ();
    }

  return x->marshal (cdr);
}

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

Allows us to forbid marshaling of local interfaces.

Reimplemented in PortableInterceptor::PolicyFactory, CORBA::Policy, and RTCORBA::ProtocolProperties.

Definition at line 143 of file Object.cpp.

{
  return (cdr << this);
}

Object& CORBA::Object::operator= ( const Object  )  [private]
TAO_ORB_Core * CORBA::Object::orb_core ( void   )  const

Accessor for the ORB_Core..

Reimplemented in TAO_ORBInitInfo, TAO_Root_POA, and TAO_RT_ORB.

Definition at line 81 of file Object.inl.

{
  return this->orb_core_;
}

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

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

Definition at line 661 of file Object.cpp.

{
  // Paranoid check. We *should* never access the proxy_broker
  // when the object has not been initialised so there *should*
  // alway be a stub, but just in case...

  if (this->protocol_proxy_)
    {
      return this->protocol_proxy_->object_proxy_broker ();
    }

  // We have no stub. We cannot be collocated.
  return the_tao_remote_object_proxy_broker ();
}

void CORBA::Object::set_collocated_servant ( TAO_Abstract_ServantBase b  ) 

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.

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.

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

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

Helper function for reading contents of an IOR.

Definition at line 709 of file Object.cpp.

{
  CORBA::ULong const profile_count =
    obj->ior_->profiles.length ();

  // Assumption is that after calling this method, folks should test
  // for protocol_proxy_ or whatever to make sure that things have
  // been initialized!
  if (profile_count == 0)
    return;

  // get a profile container to store all profiles in the IOR.
  TAO_MProfile mp (profile_count);

  TAO_ORB_Core *&orb_core = obj->orb_core_;
  if (orb_core == 0)
    {
      orb_core = TAO_ORB_Core_instance ();
      if (TAO_debug_level > 0)
        {
          ACE_DEBUG ((LM_WARNING,
                      ACE_TEXT ("TAO (%P|%t) - Object::tao_object_initialize ")
                      ACE_TEXT ("WARNING: extracting object from ")
                      ACE_TEXT ("default ORB_Core\n")));
        }
    }

  TAO_Stub *objdata = 0;

  try
    {
      TAO_Connector_Registry *connector_registry =
        orb_core->connector_registry ();

      for (CORBA::ULong i = 0; i != profile_count; ++i)
        {
          IOP::TaggedProfile &tpfile = obj->ior_->profiles[i];

          // NOTE: This is a place for optimizations. Here we have an
          // 2 allocations and 2 copies. Future optimizations should
          // target this place.
          TAO_OutputCDR o_cdr;

          o_cdr << tpfile;

          TAO_InputCDR cdr (o_cdr,
                            orb_core->input_cdr_buffer_allocator (),
                            orb_core->input_cdr_dblock_allocator (),
                            orb_core->input_cdr_msgblock_allocator (),
                            orb_core);

          TAO_Profile *pfile = connector_registry->create_profile (cdr);

          if (pfile != 0)
            mp.give_profile (pfile);
        }

      // Make sure we got some profiles!
      if (mp.profile_count () != profile_count)
        {
          // @@ This occurs when profile creation fails when decoding the
          //    profile from the IOR.
          ACE_ERROR ((LM_ERROR,
                      ACE_TEXT ("TAO (%P|%t) ERROR: XXXXX Could not create all ")
                      ACE_TEXT ("profiles while extracting object\n")
                      ACE_TEXT ("TAO (%P|%t) ERROR: reference from the ")
                      ACE_TEXT ("CDR stream.\n")));
        }


      objdata = orb_core->create_stub (obj->ior_->type_id.in (), mp);
    }
  catch (const ::CORBA::Exception& ex)
    {
      if (TAO_debug_level > 0)
        ex._tao_print_exception (
          ACE_TEXT ("TAO - ERROR creating stub ")
          ACE_TEXT ("object when demarshaling object ")
          ACE_TEXT ("reference."));

      return;
    }

  TAO_Stub_Auto_Ptr safe_objdata (objdata);

  // This call will set the stub proxy broker if necessary
  if (orb_core->initialize_object (safe_objdata.get (), obj) == -1)
    return;

  obj->protocol_proxy_ = objdata;

  obj->is_evaluated_ = true;

  // Release the contents of the ior to keep memory consumption down.
  obj->ior_ = 0;

  // Transfer ownership to the CORBA::Object
  (void) safe_objdata.release ();
  return;
}


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.

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

Definition at line 364 of file Object.h.

Specify whether this is a local object or not.

Definition at line 361 of file Object.h.

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.

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:

  • If CORBA::Object is constructed through one of the constructors with a stub and null ORB_Core, we use the orb_core from the stub to fill this pointer
  • If the other constructor, which uses IOP::IOR is used, a stub needs to be created first (i.e., the IOR needs to be evaluated first), in which case the ORB_Core would be null. The orb_core pointer then needs to be accessed from the stub and passed back as part of _get_orb().

Reimplemented in TAO_CDR_Encaps_Codec, TAO_CodecFactory, TAO_AMH_DSI_Response_Handler, TAO_EndpointPolicy_Factory, TAO_AMH_Response_Handler, TAO_ORBInitInfo, TAO::PICurrent, TAO_Root_POA, TAO_RT_Current, and TAO_RT_ORB.

Definition at line 383 of file Object.h.

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.

Number of outstanding references to this object.

Definition at line 351 of file Object.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines