Object.cpp File Reference

#include "tao/Object.h"
#include "tao/Stub.h"
#include "tao/Profile.h"
#include "tao/ORB_Core.h"
#include "tao/Connector_Registry.h"
#include "tao/LocateRequest_Invocation_Adapter.h"
#include "tao/debug.h"
#include "tao/Dynamic_Adapter.h"
#include "tao/IFR_Client_Adapter.h"
#include "tao/Remote_Object_Proxy_Broker.h"
#include "tao/CDR.h"
#include "tao/SystemException.h"
#include "tao/PolicyC.h"
#include "ace/Dynamic_Service.h"
#include "ace/OS_NS_string.h"
#include "ace/CORBA_macros.h"
#include "tao/Object.inl"

Include dependency graph for Object.cpp:

Go to the source code of this file.

Namespaces

namespace  TAO

Defines

#define TAO_OBJECT_IOR_EVALUATE
#define TAO_OBJECT_IOR_EVALUATE_RETURN

Functions

CORBA::Boolean operator<< (TAO_OutputCDR &cdr, const CORBA::Object *x)
CORBA::Boolean operator>> (TAO_InputCDR &cdr, CORBA::Object *&x)

Variables

TAO::Object_Proxy_Broker *(*) _TAO_Object_Proxy_Broker_Factory_function_pointer (void)=0


Define Documentation

#define TAO_OBJECT_IOR_EVALUATE

Value:

if (!this->is_evaluated_) \
  { \
    ACE_GUARD (ACE_Lock , mon, *this->object_init_lock_); \
      if (!this->is_evaluated_) \
        CORBA::Object::tao_object_initialize (this); \
  }

Definition at line 97 of file Object.cpp.

Referenced by CORBA::Object::_create_request().

#define TAO_OBJECT_IOR_EVALUATE_RETURN

Value:

if (!this->is_evaluated_) \
  { \
    ACE_GUARD_RETURN (ACE_Lock , mon, *this->object_init_lock_, 0); \
    if (!this->is_evaluated_) \
      CORBA::Object::tao_object_initialize (this); \
  }

Definition at line 105 of file Object.cpp.

Referenced by CORBA::Object::_get_cached_policy(), CORBA::Object::_get_component(), CORBA::Object::_get_interface(), CORBA::Object::_get_orb(), CORBA::Object::_get_policy(), CORBA::Object::_get_policy_overrides(), CORBA::Object::_hash(), CORBA::Object::_is_a(), CORBA::Object::_is_equivalent(), CORBA::Object::_key(), CORBA::Object::_non_existent(), CORBA::Object::_repository_id(), CORBA::Object::_request(), CORBA::Object::_set_policy_overrides(), CORBA::Object::_stubobj(), and CORBA::Object::_validate_connection().


Function Documentation

CORBA::Boolean operator<< ( TAO_OutputCDR cdr,
const CORBA::Object x 
)

Definition at line 681 of file Object.cpp.

00682 {
00683   if (x == 0)
00684     {
00685       // NIL objrefs ... marshal as empty type hint, no elements.
00686       cdr.write_ulong (1);
00687       cdr.write_char ('\0');
00688       cdr.write_ulong (0);
00689       return (CORBA::Boolean) cdr.good_bit ();
00690     }
00691 
00692   if (!x->is_evaluated ())
00693     {
00694       // @@ This is too inefficient. Need to speed this up if this is
00695       // a bottle neck.
00696       cdr << const_cast<IOP::IOR &> (x->ior ());
00697       return cdr.good_bit ();
00698     }
00699 
00700    TAO_Stub *stubobj = x->_stubobj ();
00701 
00702    if (stubobj == 0)
00703      return false;
00704 
00705   return (stubobj->marshal (cdr));
00706 }

CORBA::Boolean operator>> ( TAO_InputCDR cdr,
CORBA::Object *&  x 
)

Definition at line 811 of file Object.cpp.

00812 {
00813   bool lazy_strategy = false;
00814   TAO_ORB_Core *orb_core = cdr.orb_core ();
00815 
00816   if (orb_core == 0)
00817     {
00818       orb_core = TAO_ORB_Core_instance ();
00819       if (TAO_debug_level > 0)
00820         {
00821           ACE_DEBUG ((LM_WARNING,
00822                       ACE_TEXT ("TAO (%P|%t) WARNING: extracting object from ")
00823                       ACE_TEXT ("default ORB_Core\n")));
00824         }
00825     }
00826   else
00827     {
00828       if (orb_core->resource_factory ()->resource_usage_strategy () ==
00829           TAO_Resource_Factory::TAO_LAZY)
00830         lazy_strategy = true;
00831     }
00832 
00833   if (!lazy_strategy)
00834     {
00835       // If the user has set up a eager strategy..
00836       CORBA::String_var type_hint;
00837 
00838       if ((cdr >> type_hint.inout ()) == 0)
00839         return 0;
00840 
00841       CORBA::ULong profile_count;
00842       if ((cdr >> profile_count) == 0)
00843         return 0;
00844 
00845       if (profile_count == 0)
00846         {
00847           x = CORBA::Object::_nil ();
00848           return (CORBA::Boolean) cdr.good_bit ();
00849         }
00850 
00851       // get a profile container to store all profiles in the IOR.
00852       TAO_MProfile mp (profile_count);
00853 
00854       TAO_ORB_Core *orb_core = cdr.orb_core ();
00855       if (orb_core == 0)
00856         {
00857           orb_core = TAO_ORB_Core_instance ();
00858           if (TAO_debug_level > 0)
00859             {
00860               ACE_DEBUG ((LM_WARNING,
00861                           ACE_TEXT ("TAO (%P|%t) - Object::tao_object_initialize ")
00862                           ACE_TEXT ("WARNING: extracting object from ")
00863                           ACE_TEXT ("default ORB_Core\n")));
00864             }
00865         }
00866 
00867       // Ownership of type_hint is given to TAO_Stub
00868       // TAO_Stub will make a copy of mp!
00869 
00870       TAO_Stub *objdata = 0;
00871 
00872       try
00873         {
00874           TAO_Connector_Registry *connector_registry =
00875             orb_core->connector_registry ();
00876 
00877           for (CORBA::ULong i = 0; i != profile_count && cdr.good_bit (); ++i)
00878             {
00879               TAO_Profile *pfile = connector_registry->create_profile (cdr);
00880               if (pfile != 0)
00881                 mp.give_profile (pfile);
00882             }
00883 
00884           // Make sure we got some profiles!
00885           if (mp.profile_count () != profile_count)
00886             {
00887               // @@ This occurs when profile creation fails when decoding the
00888               //    profile from the IOR.
00889               ACE_ERROR_RETURN ((LM_ERROR,
00890                                  ACE_TEXT ("TAO (%P|%t) ERROR: Could not create all ")
00891                                  ACE_TEXT ("profiles while extracting object\n")
00892                                  ACE_TEXT ("TAO (%P|%t) ERROR: reference from the ")
00893                                  ACE_TEXT ("CDR stream.\n")),
00894                                 0);
00895             }
00896 
00897           objdata = orb_core->create_stub (type_hint.in (), mp);
00898         }
00899       catch (const ::CORBA::Exception& ex)
00900         {
00901           if (TAO_debug_level > 0)
00902             ex._tao_print_exception (
00903               ACE_TEXT ("TAO - ERROR creating stub ")
00904               ACE_TEXT ("object when demarshaling object ")
00905               ACE_TEXT ("reference.\n"));
00906 
00907           return 0;
00908         }
00909 
00910       TAO_Stub_Auto_Ptr safe_objdata (objdata);
00911 
00912       x = orb_core->create_object (safe_objdata.get ());
00913       if (x == 0)
00914         return 0;
00915 
00916       // Transfer ownership to the CORBA::Object
00917       (void) safe_objdata.release ();
00918     }
00919   else
00920     {
00921       // Lazy strategy!
00922       IOP::IOR *ior = 0;
00923 
00924       ACE_NEW_RETURN (ior,
00925                       IOP::IOR (),
00926                       0);
00927 
00928       cdr >> *ior;
00929       ACE_NEW_RETURN (x,
00930                       CORBA::Object (ior, orb_core),
00931                       0);
00932     }
00933 
00934   return (CORBA::Boolean) cdr.good_bit ();
00935 }


Variable Documentation

TAO::Object_Proxy_Broker*(*) _TAO_Object_Proxy_Broker_Factory_function_pointer(void)=0

This function pointer is set only when the Portable server library is present.

Definition at line 989 of file Object.cpp.

Referenced by TAO_Stub::is_collocated().


Generated on Tue Feb 2 17:38:31 2010 for TAO by  doxygen 1.4.7