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 dependency graph for Object.cpp:

Include dependency graph

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 677 of file Object.cpp.

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

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

Definition at line 807 of file Object.cpp.

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


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 985 of file Object.cpp.

Referenced by TAO_Stub::is_collocated().


Generated on Sun Jan 27 13:11:45 2008 for TAO by doxygen 1.3.6