Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

AbstractBase.cpp File Reference

#include "tao_pch.h"
#include "tao/AbstractBase.h"
#include "tao/Any.h"
#include "tao/Stub.h"
#include "tao/Profile.h"
#include "tao/ValueFactory.h"
#include "tao/debug.h"
#include "tao/AbstractBase.inl"

Include dependency graph for AbstractBase.cpp:

Include dependency graph

Go to the source code of this file.

Functions

const char * get_rcsid_tao_AbstractBase (const char *)
CORBA::Boolean operator<< (TAO_OutputCDR &strm, const CORBA_AbstractBase_ptr abs)
CORBA::Boolean operator>> (TAO_InputCDR &strm, CORBA_AbstractBase_ptr &abs)

Variables

const char * rcsid_tao_AbstractBase = get_rcsid_tao_AbstractBase ( rcsid_tao_AbstractBase )


Function Documentation

const char* get_rcsid_tao_AbstractBase const char *    [inline, static]
 

Definition at line 30 of file AbstractBase.cpp.

00030 : AbstractBase.cpp,v 1.1.1.1.2.1 2003/03/14 16:05:11 chad Exp $")

CORBA::Boolean operator<< TAO_OutputCDR   strm,
const CORBA_AbstractBase_ptr    abs
 

Definition at line 147 of file AbstractBase.cpp.

References CORBA_AbstractBase::_is_objref, CORBA_AbstractBase::_stubobj, CORBA_AbstractBase::_tao_marshal_v, CORBA_AbstractBase::_tao_obv_repository_id, TAO_Stub::base_profiles, TAO_Profile::encode, TAO_MProfile::get_profile, ACE_OutputCDR::good_bit, TAO_MProfile::profile_count, TAO_Stub::type_id, TAO_OBV_GIOP_Flags::Type_info_single, TAO_OBV_GIOP_Flags::Value_tag_base, and ACE_OutputCDR::write_ulong.

00148 {
00149   CORBA::Boolean discriminator = 0;
00150 
00151   if (abs->_is_objref ())
00152     {
00153       discriminator = 1;
00154 
00155       if (strm << ACE_OutputCDR::from_boolean (discriminator))
00156         {
00157           TAO_Stub *stubobj = abs->_stubobj ();
00158 
00159           if (stubobj == 0)
00160             {
00161               return 0;
00162             }
00163 
00164           // STRING, a type ID hint
00165           if ((strm << stubobj->type_id.in ()) == 0)
00166             {
00167               return 0;
00168             }
00169 
00170           const TAO_MProfile& mprofile = stubobj->base_profiles ();
00171 
00172           CORBA::ULong profile_count = mprofile.profile_count ();
00173 
00174           if ((strm << profile_count) == 0)
00175             {
00176               return 0;
00177             }
00178 
00179           // @@ The MProfile should be locked during this iteration, is there
00180           // anyway to achieve that?
00181           for (CORBA::ULong i = 0; i < profile_count; ++i)
00182             {
00183               const TAO_Profile *p = mprofile.get_profile (i);
00184 
00185               if (p->encode (strm) == 0)
00186                 {
00187                   return 0;
00188                 }
00189             }
00190 
00191           return (CORBA::Boolean) strm.good_bit ();
00192         }
00193     }
00194   else
00195     {
00196       discriminator = 0;
00197 
00198       if (strm << ACE_OutputCDR::from_boolean (discriminator))
00199         {
00200           CORBA::Boolean retval = 1;
00201 
00202           CORBA::ULong value_tag = TAO_OBV_GIOP_Flags::Value_tag_base
00203                                    | TAO_OBV_GIOP_Flags::Type_info_single;
00204 
00205           retval = strm.write_ulong (value_tag);
00206 
00207           if (retval == 0)
00208             {
00209               return retval;
00210             }
00211 
00212           retval = strm << abs->_tao_obv_repository_id ();
00213 
00214           if (retval == 0)
00215             {
00216               return retval;
00217             }
00218 
00219           return abs->_tao_marshal_v (strm);
00220         }
00221     }
00222 
00223   return 0;
00224 }

CORBA::Boolean operator>> TAO_InputCDR   strm,
CORBA_AbstractBase_ptr   abs
 

Definition at line 227 of file AbstractBase.cpp.

References CORBA_AbstractBase::_tao_unmarshal_v, ACE_DEBUG, ACE_NEW_RETURN, ACE_TEXT, CORBA::is_nil, TAO_OBV_GIOP_Flags::is_null_ref, TAO_OBV_GIOP_Flags::is_value_tag, LM_DEBUG, LM_ERROR, LM_WARNING, TAO_ORB_Core::optimize_collocation_objects, TAO_ORB_Core::orb, TAO_InputCDR::orb_core, ACE_InputCDR::read_string, ACE_InputCDR::read_ulong, TAO_Stub::servant_orb_var, and TAO_ORB_Core_instance.

00228 {
00229   abs = 0;
00230   CORBA::Boolean discriminator = 0;
00231   ACE_InputCDR::to_boolean tb (discriminator);
00232   TAO_ORB_Core *orb_core = 0;
00233 
00234   if (strm >> tb)
00235     {
00236       if (discriminator == 0)
00237         {
00238           CORBA::ULong value_tag;
00239 
00240           if (!strm.read_ulong (value_tag))
00241             {
00242               return 0;
00243             }
00244 
00245           if (TAO_OBV_GIOP_Flags::is_null_ref (value_tag))
00246             {
00247               // Ok, null reference unmarshaled.
00248               return 1;
00249             }
00250 
00251           if (!TAO_OBV_GIOP_Flags::is_value_tag (value_tag))
00252             {
00253               ACE_DEBUG ((LM_DEBUG,
00254                           ACE_TEXT ("operator>> CORBA::AbstractBase ")
00255                           ACE_TEXT ("not value_tag\n")));
00256               return 0;
00257             }
00258 
00259           CORBA::String_var repo_id_stream;
00260 
00261           // It would be more efficient not to copy the string)
00262           if (strm.read_string (repo_id_stream.inout ()) == 0)
00263             {
00264               return 0;
00265             }
00266 
00267           orb_core = strm.orb_core ();
00268 
00269           if (orb_core == 0)
00270             {
00271               orb_core = TAO_ORB_Core_instance ();
00272 
00273               if (TAO_debug_level > 0)
00274                 {
00275                   ACE_DEBUG ((LM_WARNING,
00276                               "TAO (%P|%t) WARNING: extracting valuetype using "
00277                               "default ORB_Core\n"));
00278                 }
00279             }
00280 
00281           CORBA::ValueFactory_var factory =
00282             orb_core->orb ()->lookup_value_factory (repo_id_stream.in ());
00283 
00284           // We should throw an exception, if there were an appropriate one.
00285           if (factory.in() == 0)
00286             {
00287               ACE_DEBUG ((LM_ERROR,
00288                           ACE_TEXT ("(%N:%l) OBV factory is null !!!\n")));
00289               return 0;
00290             }
00291 
00292           abs = factory->create_for_unmarshal_abstract ();
00293 
00294           return abs->_tao_unmarshal_v (strm);
00295         }
00296       else
00297         {
00298           CORBA::Object_var generic_objref;
00299 
00300           if (strm >> generic_objref.inout ())
00301             {
00302               TAO_Stub *concrete_stubobj = generic_objref->_stubobj ();
00303 
00304               CORBA::Boolean stores_orb =
00305                 ! CORBA::is_nil (concrete_stubobj->servant_orb_var ().ptr ());
00306 
00307               if (stores_orb)
00308                 {
00309                   orb_core =
00310                     concrete_stubobj->servant_orb_var ()->orb_core ();
00311                 }
00312 
00313               CORBA::Boolean collocated =
00314                 orb_core != 0
00315                 && orb_core->optimize_collocation_objects ()
00316                 && generic_objref->_is_collocated ();
00317 
00318               ACE_NEW_RETURN (abs,
00319                               CORBA_AbstractBase (concrete_stubobj,
00320                                                   collocated,
00321                                                   generic_objref->_servant ()),
00322                               0);
00323               return 1;
00324             }
00325         }
00326     }
00327 
00328   return 0;
00329 }


Variable Documentation

const char* rcsid_tao_AbstractBase = get_rcsid_tao_AbstractBase ( rcsid_tao_AbstractBase ) [static]
 

Definition at line 30 of file AbstractBase.cpp.


Generated on Mon Jun 16 13:50:28 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002