TAO  Snapshot(2023/04/28-19:34)
Classes | Namespaces | Typedefs | Functions | Variables
Object.h File Reference
#include "tao/IOPC.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 "ace/Atomic_Op.h"
#include "tao/Object.inl"

Go to the source code of this file.

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 >
 

Namespaces

 TAO
 Define symbolic names for the ORB collocation strategies as used at runtime.
 
 CORBA
 FUZZ: disable check_for_include/.
 

Typedefs

typedef ContextList * CORBA::ContextList_ptr
 

Functions

template<>
Boolean CORBA::is_nil (Object_ptr)
 
CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA::Object *)
 
CORBA::Boolean operator>> (TAO_InputCDR &, CORBA::Object *&)
 

Variables

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

Detailed Description

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

◆ operator<<()

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

Definition at line 707 of file Object.cpp.

708 {
709  if (x == 0)
710  {
711  // NIL objrefs ... marshal as empty type hint, no elements.
712  cdr.write_ulong (1);
713  cdr.write_char ('\0');
714  cdr.write_ulong (0);
715  return (CORBA::Boolean) cdr.good_bit ();
716  }
717 
718  if (!x->is_evaluated ())
719  {
720  // @@ This is too inefficient. Need to speed this up if this is
721  // a bottle neck.
722  cdr << const_cast<IOP::IOR &> (x->ior ());
723  return cdr.good_bit ();
724  }
725 
726  TAO_Stub *stubobj = x->_stubobj ();
727 
728  if (stubobj == 0)
729  return false;
730 
731  return (stubobj->marshal (cdr));
732 }
ACE_CDR::Boolean Boolean
Definition: Basic_Types.h:40
TAO_Stub.
Definition: Stub.h:70
CORBA::Boolean marshal(TAO_OutputCDR &)
Needed to avoid copying forward_profiles for thread safety.
Definition: Stub.cpp:511

◆ operator>>()

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

Definition at line 843 of file Object.cpp.

844 {
845  bool lazy_strategy = false;
846  TAO_ORB_Core *orb_core = cdr.orb_core ();
847 
848  if (orb_core == 0)
849  {
850  orb_core = TAO_ORB_Core_instance ();
851  if (TAO_debug_level > 0)
852  {
853  TAOLIB_DEBUG ((LM_WARNING,
854  ACE_TEXT ("TAO (%P|%t) WARNING: extracting object from ")
855  ACE_TEXT ("default ORB_Core\n")));
856  }
857  }
858  else
859  {
860  if (orb_core->resource_factory ()->resource_usage_strategy () ==
862  {
863  lazy_strategy = true;
864  }
865  }
866 
867  if (!lazy_strategy)
868  {
869  // If the user has set up a eager strategy..
870  CORBA::String_var type_hint;
871  if (!(cdr >> type_hint.inout ()))
872  return false;
873 
874  CORBA::ULong profile_count;
875  if (!(cdr >> profile_count))
876  return false;
877 
878  if (profile_count == 0)
879  {
880  x = CORBA::Object::_nil ();
881  return (CORBA::Boolean) cdr.good_bit ();
882  }
883 
884  // get a profile container to store all profiles in the IOR.
885  TAO_MProfile mp (profile_count);
886 
887  TAO_ORB_Core *orb_core = cdr.orb_core ();
888  if (orb_core == 0)
889  {
890  orb_core = TAO_ORB_Core_instance ();
891  if (TAO_debug_level > 0)
892  {
893  TAOLIB_DEBUG ((LM_WARNING,
894  ACE_TEXT ("TAO (%P|%t) - Object::tao_object_initialize ")
895  ACE_TEXT ("WARNING: extracting object from ")
896  ACE_TEXT ("default ORB_Core\n")));
897  }
898  }
899 
900  // Ownership of type_hint is given to TAO_Stub
901  // TAO_Stub will make a copy of mp!
902  TAO_Stub *objdata = 0;
903 
904  try
905  {
906  TAO_Connector_Registry *connector_registry =
907  orb_core->connector_registry ();
908 
909  for (CORBA::ULong i = 0; i != profile_count && cdr.good_bit (); ++i)
910  {
911  TAO_Profile *pfile = connector_registry->create_profile (cdr);
912  if (pfile != 0)
913  {
914  if (mp.give_profile (pfile) == -1)
915  {
916  TAOLIB_ERROR ((LM_ERROR,
917  ACE_TEXT ("TAO (%P|%t) ERROR: give_profile\n")
918  ACE_TEXT (" returned -1\n")));
919  }
920  }
921  }
922 
923  // Make sure we got some profiles!
924  if (mp.profile_count () != profile_count)
925  {
926  // @@ This occurs when profile creation fails when decoding the
927  // profile from the IOR.
928  TAOLIB_ERROR_RETURN ((LM_ERROR,
929  ACE_TEXT ("TAO (%P|%t) - ERROR: Could not create all ")
930  ACE_TEXT ("profiles while extracting object [%d, %d] ")
931  ACE_TEXT ("reference from the CDR stream.\n"),
932  mp.profile_count (), profile_count),
933  false);
934  }
935 
936  objdata = orb_core->create_stub (type_hint.in (), mp);
937  }
938  catch (const ::CORBA::Exception& ex)
939  {
940  if (TAO_debug_level > 0)
941  ex._tao_print_exception (
942  ACE_TEXT ("TAO (%P|%t) - ERROR creating stub ")
943  ACE_TEXT ("object when demarshaling object ")
944  ACE_TEXT ("reference.\n"));
945 
946  return false;
947  }
948 
949  TAO_Stub_Auto_Ptr safe_objdata (objdata);
950 
951  x = orb_core->create_object (safe_objdata.get ());
952  if (!x)
953  {
954  return false;
955  }
956 
957  // Transfer ownership to the CORBA::Object
958  (void) safe_objdata.release ();
959  }
960  else
961  {
962  // Lazy strategy!
963  IOP::IOR *ior = 0;
964 
965  ACE_NEW_RETURN (ior,
966  IOP::IOR (),
967  false);
968 
969  if (!(cdr >> *ior))
970  {
971  // Can't extract the IOR, so delete the already allocated
972  // ior to not have a memory leak
973  delete ior;
974  return false;
975  }
976 
977  ACE_NEW_NORETURN (x,
978  CORBA::Object (ior, orb_core));
979 
980  if (x == 0)
981  {
982  // Can't allocate a CORBA Object so delete first the
983  // memory we already allocated before we return
984  delete ior;
985  return false;
986  }
987  }
988 
989  return (CORBA::Boolean) cdr.good_bit ();
990 }
Defines the Profile interface.
Definition: Profile.h:56
Encapsulates the state of an ORB.
Definition: ORB_Core.h:162
#define TAOLIB_DEBUG(X)
Definition: debug.h:90
TAO_Resource_Factory * resource_factory(void)
Returns pointer to the resource factory.
Definition: ORB_Core.cpp:1663
#define TAOLIB_ERROR(X)
Definition: debug.h:80
Implementation of a CORBA object reference.
Definition: Object.h:101
TAO::String_var< CORBA::Char > String_var
Definition: Basic_Types.h:98
static CORBA::Object_ptr _nil(void)
Return a NULL object.
Definition: Object.inl:47
Use resources in a lazy manner.
TAO_Stub * create_stub(const char *repository_id, const TAO_MProfile &profiles)
Definition: ORB_Core.cpp:2004
ACE_CDR::ULong ULong
Definition: Basic_Types.h:55
#define TAOLIB_ERROR_RETURN(X, Y)
Definition: debug.h:69
ACE_CDR::Boolean Boolean
Definition: Basic_Types.h:40
#define ACE_NEW_NORETURN(POINTER, CONSTRUCTOR)
CORBA::Object_ptr create_object(TAO_Stub *the_stub)
Definition: ORB_Core.cpp:2079
TAO_Stub.
Definition: Stub.h:70
Per-ORB TAO Connector Registry.
TAO_Connector_Registry * connector_registry(void)
Get the connector registry.
Definition: ORB_Core.cpp:3073
TAO_Profile * create_profile(TAO_InputCDR &cdr)
Create a profile based on the contents of cdr.
TAO_ORB_Core * TAO_ORB_Core_instance(void)
Definition: ORB_Core.cpp:3709
#define ACE_NEW_RETURN(POINTER, CONSTRUCTOR, RET_VAL)
unsigned int TAO_debug_level
Definition: debug.cpp:12
This class implements the basic interface for supporting multiple profiles.
Definition: MProfile.h:53
virtual TAO_Resource_Factory::Resource_Usage resource_usage_strategy(void) const =0
Return the resource usage strategy.
Implements the draft C++ standard auto_ptr abstraction. This class allows one to work Stub Objects On...
Definition: Stub.h:431

Variable Documentation

◆ _TAO_Object_Proxy_Broker_Factory_function_pointer

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