Classes | Namespaces | 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 "tao/Configurable_Refcount.h"
#include "tao/Object.inl"
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.

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

namespace  TAO
 

Define symbolic names for the ORB collocation strategies.


namespace  CORBA
 

FUZZ: disable check_for_include/.


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 90156 2010-05-18 09:55:08Z 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.

{
  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 ();
    }

  if (!x->is_evaluated ())
    {
      // @@ This is too inefficient. Need to speed this up if this is
      // a bottle neck.
      cdr << const_cast<IOP::IOR &> (x->ior ());
      return cdr.good_bit ();
    }

   TAO_Stub *stubobj = x->_stubobj ();

   if (stubobj == 0)
     return false;

  return (stubobj->marshal (cdr));
}

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

Definition at line 811 of file Object.cpp.

{
  bool lazy_strategy = false;
  TAO_ORB_Core *orb_core = cdr.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) WARNING: extracting object from ")
                      ACE_TEXT ("default ORB_Core\n")));
        }
    }
  else
    {
      if (orb_core->resource_factory ()->resource_usage_strategy () ==
          TAO_Resource_Factory::TAO_LAZY)
        {
          lazy_strategy = true;
        }
    }

  if (!lazy_strategy)
    {
      // If the user has set up a eager strategy..
      CORBA::String_var type_hint;

      if (!(cdr >> type_hint.inout ()))
        return false;

      CORBA::ULong profile_count;
      if (!(cdr >> profile_count))
        return false;

      if (profile_count == 0)
        {
          x = CORBA::Object::_nil ();
          return (CORBA::Boolean) cdr.good_bit ();
        }

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

      TAO_ORB_Core *orb_core = cdr.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")));
            }
        }

      // Ownership of type_hint is given to TAO_Stub
      // TAO_Stub will make a copy of mp!

      TAO_Stub *objdata = 0;

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

          for (CORBA::ULong i = 0; i != profile_count && cdr.good_bit (); ++i)
            {
              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_RETURN ((LM_ERROR,
                                 ACE_TEXT ("TAO (%P|%t) - ERROR: Could not create all ")
                                 ACE_TEXT ("profiles while extracting object [%d, %d]\n")
                                 ACE_TEXT ("TAO (%P|%t) - ERROR: reference from the ")
                                 ACE_TEXT ("CDR stream.\n"),
                                 mp.profile_count (), profile_count),
                                false);
            }

          objdata = orb_core->create_stub (type_hint.in (), mp);
        }
      catch (const ::CORBA::Exception& ex)
        {
          if (TAO_debug_level > 0)
            ex._tao_print_exception (
              ACE_TEXT ("TAO (%P|%t) - ERROR creating stub ")
              ACE_TEXT ("object when demarshaling object ")
              ACE_TEXT ("reference.\n"));

          return false;
        }

      TAO_Stub_Auto_Ptr safe_objdata (objdata);

      x = orb_core->create_object (safe_objdata.get ());
      if (!x)
        {
          return false;
        }

      // Transfer ownership to the CORBA::Object
      (void) safe_objdata.release ();
    }
  else
    {
      // Lazy strategy!
      IOP::IOR *ior = 0;

      ACE_NEW_RETURN (ior,
                      IOP::IOR (),
                      false);

      if (!(cdr >> *ior))
        {
          return false;
        }
        
      ACE_NEW_RETURN (x,
                      CORBA::Object (ior, orb_core),
                      false);
    }

  return (CORBA::Boolean) cdr.good_bit ();
}


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

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines