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

CORBA_AbstractBase Class Reference

Abstract base class for Interfaces and Valuetypes. More...

#include <AbstractBase.h>

Collaboration diagram for CORBA_AbstractBase:

Collaboration graph
[legend]
List of all members.

Public Types

typedef CORBA_AbstractBase_ptr _ptr_type
typedef CORBA_AbstractBase_var _var_type

Public Methods

CORBA::Object_ptr _to_object (void)
CORBA::ValueBase_to_value (void)
virtual CORBA::Boolean _is_a (const char *type_id ACE_ENV_ARG_DECL_WITH_DEFAULTS)
virtual void * _tao_QueryInterface (ptr_arith_t type)
virtual const char * _interface_repository_id (void) const
virtual const char * _tao_obv_repository_id (void) const
virtual void * _tao_obv_narrow (ptr_arith_t type_id)
virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &strm)
virtual CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &strm)
virtual void _add_ref (void)
virtual void _remove_ref (void)
CORBA::Boolean _is_objref (void) const
TAO_Stub_stubobj (void) const
CORBA::Boolean _is_collocated (void) const
TAO_Abstract_ServantBase_servant (void) const
CORBA::Boolean _is_local (void) const

Static Public Methods

CORBA::AbstractBase_ptr _narrow (CORBA::AbstractBase_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS)
 Just call _duplicate and let it decide what to do. More...

CORBA::AbstractBase_ptr _unchecked_narrow (CORBA::AbstractBase_ptr obj ACE_ENV_ARG_DECL_WITH_DEFAULTS)
 Same for this one. More...

CORBA::AbstractBase_ptr _duplicate (CORBA::AbstractBase_ptr obj)
CORBA::AbstractBase_ptr _nil (void)

Static Public Attributes

int _tao_class_id = 0

Protected Methods

 CORBA_AbstractBase (void)
 CORBA_AbstractBase (const CORBA_AbstractBase &)
 CORBA_AbstractBase (TAO_Stub *p, CORBA::Boolean collocated, TAO_Abstract_ServantBase *servant)
virtual ~CORBA_AbstractBase (void)

Protected Attributes

CORBA::Boolean is_objref_

Private Methods

CORBA_AbstractBase & operator= (const CORBA_AbstractBase &)
virtual CORBA::ValueBase_tao_to_value (void)

Private Attributes

TAO_Stubconcrete_stubobj_
CORBA::Boolean is_collocated_
TAO_Abstract_ServantBaseservant_
CORBA::Boolean is_local_

Friends

TAO_Export CORBA::Boolean operator<< (TAO_OutputCDR &, const CORBA_AbstractBase_ptr)
 So the extraction operator can call the protectec constructor. More...

TAO_Export CORBA::Boolean operator>> (TAO_InputCDR &, CORBA_AbstractBase_ptr &)

Detailed Description

Abstract base class for Interfaces and Valuetypes.

Allows the determination of whether an object has been passed by reference or by value to be deferred until runtime.

Definition at line 36 of file AbstractBase.h.


Member Typedef Documentation

typedef CORBA_AbstractBase_ptr CORBA_AbstractBase::_ptr_type
 

Definition at line 46 of file AbstractBase.h.

typedef CORBA_AbstractBase_var CORBA_AbstractBase::_var_type
 

Definition at line 47 of file AbstractBase.h.


Constructor & Destructor Documentation

CORBA_AbstractBase::CORBA_AbstractBase void    [protected]
 

Definition at line 34 of file AbstractBase.cpp.

00035   : is_objref_ (0),
00036     concrete_stubobj_ (0),
00037     is_collocated_ (0),
00038     servant_ (0),
00039     is_local_ (0)
00040 {
00041 }

CORBA_AbstractBase::CORBA_AbstractBase const CORBA_AbstractBase &    [protected]
 

Definition at line 43 of file AbstractBase.cpp.

References TAO_Stub::_incr_refcnt, and concrete_stubobj_.

00044   : is_objref_ (rhs.is_objref_),
00045     concrete_stubobj_ (rhs.concrete_stubobj_),
00046     is_collocated_ (rhs.is_collocated_),
00047     servant_ (rhs.servant_),
00048     is_local_ (rhs.is_local_)
00049 {
00050   if (this->concrete_stubobj_ != 0)
00051     {
00052       (void) this->concrete_stubobj_->_incr_refcnt ();
00053     }
00054 }

CORBA_AbstractBase::CORBA_AbstractBase TAO_Stub   p,
CORBA::Boolean    collocated,
TAO_Abstract_ServantBase   servant
[protected]
 

Definition at line 56 of file AbstractBase.cpp.

References TAO_Stub::_incr_refcnt, and concrete_stubobj_.

00059   : is_objref_ (1),
00060     concrete_stubobj_ (protocol_proxy),
00061     is_collocated_ (collocated),
00062     servant_ (servant),
00063     is_local_ (protocol_proxy == 0 ? 1 : 0)
00064 {
00065   if (this->concrete_stubobj_ != 0)
00066     {
00067       (void) this->concrete_stubobj_->_incr_refcnt ();
00068     }
00069 }

CORBA_AbstractBase::~CORBA_AbstractBase void    [protected, virtual]
 

Definition at line 71 of file AbstractBase.cpp.

References TAO_Stub::_decr_refcnt, and concrete_stubobj_.

00072 {
00073   if (this->concrete_stubobj_ != 0)
00074     {
00075       (void) this->concrete_stubobj_->_decr_refcnt ();
00076     }
00077 }


Member Function Documentation

void CORBA_AbstractBase::_add_ref void    [virtual]
 

Definition at line 104 of file AbstractBase.cpp.

Referenced by _tao_QueryInterface.

00105 {
00106 }

CORBA::AbstractBase_ptr CORBA_AbstractBase::_duplicate CORBA::AbstractBase_ptr    obj [static]
 

Referenced by _narrow, _unchecked_narrow, CORBA_AbstractBase_out::operator=, CORBA_AbstractBase_var::operator=, and CORBA_AbstractBase_var::tao_duplicate.

ACE_INLINE const char * CORBA_AbstractBase::_interface_repository_id void    const [virtual]
 

Definition at line 52 of file AbstractBase.inl.

00053 {
00054   return "IDL:omg.org/CORBA/AbstractBase:1.0";
00055 }

ACE_INLINE CORBA::Boolean CORBA_AbstractBase::_is_a const char *type_id    ACE_ENV_ARG_DECL_WITH_DEFAULTS [virtual]
 

Definition at line 43 of file AbstractBase.inl.

References ACE_ENV_ARG_DECL_NOT_USED, and ACE_OS_String::strcmp.

00045 {
00046   return ! ACE_OS::strcmp (type_id,
00047                            "IDL:omg.org/CORBA/AbstractBase:1.0");
00048 }

ACE_INLINE CORBA::Boolean CORBA_AbstractBase::_is_collocated void    const
 

Definition at line 87 of file AbstractBase.inl.

References is_collocated_.

00088 {
00089   return this->is_collocated_;
00090 }

ACE_INLINE CORBA::Boolean CORBA_AbstractBase::_is_local void    const
 

Definition at line 101 of file AbstractBase.inl.

References is_local_.

00102 {
00103   return this->is_local_;
00104 }

ACE_INLINE CORBA::Boolean CORBA_AbstractBase::_is_objref void    const
 

Definition at line 73 of file AbstractBase.inl.

References is_objref_.

Referenced by operator<<.

00074 {
00075   return this->is_objref_;
00076 }

ACE_INLINE CORBA::AbstractBase_ptr CORBA_AbstractBase::_narrow CORBA::AbstractBase_ptr obj    ACE_ENV_ARG_DECL_WITH_DEFAULTS [static]
 

Just call _duplicate and let it decide what to do.

Definition at line 26 of file AbstractBase.inl.

References _duplicate, and ACE_ENV_ARG_DECL_NOT_USED.

00028 {
00029   return CORBA_AbstractBase::_duplicate (obj);
00030 }

ACE_INLINE CORBA::AbstractBase_ptr CORBA_AbstractBase::_nil void    [static]
 

Definition at line 6 of file AbstractBase.inl.

Referenced by CORBA_AbstractBase_var::_retn, CORBA_AbstractBase_out::CORBA_AbstractBase_out, CORBA_AbstractBase_var::out, and CORBA_AbstractBase_var::tao_nil.

00007 {
00008   return 0;
00009 }

void CORBA_AbstractBase::_remove_ref void    [virtual]
 

Definition at line 109 of file AbstractBase.cpp.

00110 {
00111 }

ACE_INLINE TAO_Abstract_ServantBase * CORBA_AbstractBase::_servant void    const
 

Definition at line 94 of file AbstractBase.inl.

References servant_.

00095 {
00096   return this->servant_;
00097 }

ACE_INLINE TAO_Stub * CORBA_AbstractBase::_stubobj void    const
 

Definition at line 80 of file AbstractBase.inl.

References concrete_stubobj_.

Referenced by operator<<.

00081 {
00082   return this->concrete_stubobj_;
00083 }

CORBA::Boolean CORBA_AbstractBase::_tao_marshal_v TAO_OutputCDR   strm [virtual]
 

Definition at line 332 of file AbstractBase.cpp.

Referenced by operator<<.

00333 {
00334   return 0;
00335 }

ACE_INLINE void * CORBA_AbstractBase::_tao_obv_narrow ptr_arith_t    type_id [virtual]
 

Definition at line 66 of file AbstractBase.inl.

References ptr_arith_t.

00067 {
00068   return this;
00069 }

ACE_INLINE const char * CORBA_AbstractBase::_tao_obv_repository_id void    const [virtual]
 

Definition at line 59 of file AbstractBase.inl.

Referenced by operator<<.

00060 {
00061   return "IDL:omg.org/CORBA/AbstractBase:1.0";
00062 }

void * CORBA_AbstractBase::_tao_QueryInterface ptr_arith_t    type [virtual]
 

Definition at line 80 of file AbstractBase.cpp.

References _add_ref, _tao_class_id, and ptr_arith_t.

00081 {
00082   void *retv = 0;
00083 
00084   if (type == ACE_reinterpret_cast (
00085               ptr_arith_t,
00086               &CORBA_AbstractBase::_tao_class_id)
00087             )
00088     {
00089       retv = ACE_reinterpret_cast (void*, this);
00090     }
00091 
00092   if (retv != 0)
00093     {
00094       this->_add_ref ();
00095     }
00096 
00097   return retv;
00098 }

CORBA::ValueBase * CORBA_AbstractBase::_tao_to_value void    [private, virtual]
 

Definition at line 344 of file AbstractBase.cpp.

Referenced by _to_value.

00345 {
00346   return 0;
00347 }

CORBA::Boolean CORBA_AbstractBase::_tao_unmarshal_v TAO_InputCDR   strm [virtual]
 

Definition at line 338 of file AbstractBase.cpp.

Referenced by operator>>.

00339 {
00340   return 0;
00341 }

CORBA::Object_ptr CORBA_AbstractBase::_to_object void   
 

Definition at line 114 of file AbstractBase.cpp.

References TAO_Stub::_incr_refcnt, concrete_stubobj_, TAO_ORB_Core::create_object, and TAO_Stub::orb_core.

00115 {
00116   if (this->concrete_stubobj_ == 0)
00117     {
00118       return CORBA::Object::_nil ();
00119     }
00120 
00121   TAO_ORB_Core *orb_core = this->concrete_stubobj_->orb_core ();
00122   this->concrete_stubobj_->_incr_refcnt ();
00123 
00124   return orb_core->create_object (this->concrete_stubobj_);
00125 }

CORBA::ValueBase * CORBA_AbstractBase::_to_value void   
 

Definition at line 128 of file AbstractBase.cpp.

References _tao_to_value, and is_objref_.

00129 {
00130   if (this->is_objref_)
00131     {
00132       return 0;
00133     }
00134 
00135   CORBA::ValueBase *retval = this->_tao_to_value ();
00136 
00137   if (retval == 0)
00138     {
00139       return retval;
00140     }
00141 
00142   retval->_add_ref ();
00143   return retval;
00144 }

ACE_INLINE CORBA::AbstractBase_ptr CORBA_AbstractBase::_unchecked_narrow CORBA::AbstractBase_ptr obj    ACE_ENV_ARG_DECL_WITH_DEFAULTS [static]
 

Same for this one.

Definition at line 35 of file AbstractBase.inl.

References _duplicate, and ACE_ENV_ARG_DECL_NOT_USED.

00037 {
00038   return CORBA_AbstractBase::_duplicate (obj);
00039 }

CORBA_AbstractBase& CORBA_AbstractBase::operator= const CORBA_AbstractBase &    [private]
 


Friends And Related Function Documentation

TAO_Export CORBA::Boolean operator<< TAO_OutputCDR  ,
const    CORBA_AbstractBase_ptr
[friend]
 

So the extraction operator can call the protectec constructor.

Definition at line 147 of file AbstractBase.cpp.

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 }

TAO_Export CORBA::Boolean operator>> TAO_InputCDR  ,
CORBA_AbstractBase_ptr  
[friend]
 

Definition at line 227 of file AbstractBase.cpp.

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 }


Member Data Documentation

int CORBA_AbstractBase::_tao_class_id = 0 [static]
 

Definition at line 32 of file AbstractBase.cpp.

Referenced by _tao_QueryInterface.

TAO_Stub* CORBA_AbstractBase::concrete_stubobj_ [private]
 

Definition at line 100 of file AbstractBase.h.

Referenced by _stubobj, _to_object, CORBA_AbstractBase, and ~CORBA_AbstractBase.

CORBA::Boolean CORBA_AbstractBase::is_collocated_ [private]
 

Definition at line 101 of file AbstractBase.h.

Referenced by _is_collocated.

CORBA::Boolean CORBA_AbstractBase::is_local_ [private]
 

Definition at line 103 of file AbstractBase.h.

Referenced by _is_local.

CORBA::Boolean CORBA_AbstractBase::is_objref_ [protected]
 

Definition at line 92 of file AbstractBase.h.

Referenced by _is_objref, and _to_value.

TAO_Abstract_ServantBase* CORBA_AbstractBase::servant_ [private]
 

Definition at line 102 of file AbstractBase.h.

Referenced by _servant.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 14:56:08 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002