Object.h File Reference

#include "tao/IOP_IORC.h"
#include "tao/CORBA_methods.h"
#include "tao/Policy_ForwardC.h"
#include "tao/Pseudo_VarOut_T.h"
#include "tao/Object_Argument_T.h"
#include "tao/Arg_Traits_T.h"
#include "tao/Any_Insert_Policy_T.h"
#include "tao/Configurable_Refcount.h"

Include dependency graph for Object.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  TAO
namespace  CORBA

Classes

class  CORBA::Object
 Implementation of a CORBA object reference. More...
class  TAO::Arg_Traits< CORBA::Object >
struct  TAO::Objref_Traits< CORBA::Object >
struct  TAO::In_Object_Argument_Cloner_T< CORBA::InterfaceDef_ptr >

Typedefs

typedef InterfaceDef * CORBA::InterfaceDef_ptr
typedef Context * CORBA::Context_ptr
typedef Request * CORBA::Request_ptr
typedef NVList * CORBA::NVList_ptr
typedef NamedValue * CORBA::NamedValue_ptr
typedef ULong CORBA::Flags
typedef ExceptionList * CORBA::ExceptionList_ptr
typedef ContextList * CORBA::ContextList_ptr
typedef Object * CORBA::Object_ptr
typedef TAO_Pseudo_Var_T<
Object > 
CORBA::Object_var
typedef TAO_Pseudo_Out_T<
Object > 
CORBA::Object_out

Functions

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

Variables

TAO_Export TAO::Object_Proxy_Broker *(*) _TAO_Object_Proxy_Broker_Factory_function_pointer (void)


Detailed Description

Id
Object.h 81430 2008-04-24 19:04:02Z johnnyw

A "Object" is an entity that can be the target of an invocation using an ORB. All CORBA objects provide this functionality. See the CORBA 3.x specification for details.

Author:
Portions Copyright 1994-1995 by Sun Microsystems Inc.

Portions Copyright 1997-2002 by Washington University

Definition in file Object.h.


Function Documentation

TAO_Export CORBA::Boolean operator<< ( TAO_OutputCDR ,
const CORBA::Object  
)

Definition at line 681 of file Object.cpp.

References CORBA::Object::_stubobj(), ACE_OutputCDR::good_bit(), CORBA::Object::ior(), CORBA::Object::is_evaluated(), TAO_Stub::marshal(), ACE_OutputCDR::write_char(), and ACE_OutputCDR::write_ulong().

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 }

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

Definition at line 811 of file Object.cpp.

References CORBA::Object::_nil(), ACE_DEBUG, ACE_ERROR_RETURN, ACE_NEW_RETURN, ACE_TEXT, TAO_ORB_Core::connector_registry(), TAO_ORB_Core::create_object(), TAO_Connector_Registry::create_profile(), TAO_ORB_Core::create_stub(), TAO_Stub_Auto_Ptr::get(), TAO_MProfile::give_profile(), ACE_InputCDR::good_bit(), LM_ERROR, LM_WARNING, TAO_InputCDR::orb_core(), TAO_MProfile::profile_count(), TAO_Stub_Auto_Ptr::release(), TAO_ORB_Core::resource_factory(), TAO_Resource_Factory::resource_usage_strategy(), TAO_debug_level, TAO_Resource_Factory::TAO_LAZY, and TAO_ORB_Core_instance().

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_Export TAO::Object_Proxy_Broker*(*) _TAO_Object_Proxy_Broker_Factory_function_pointer(void)

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