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

CORBA_ValueBase Class Reference

Abstract baseclass for Valuetypes (see CORBA 2.3 20.17.5). More...

#include <ValueBase.h>

Inheritance diagram for CORBA_ValueBase:

Inheritance graph
[legend]
List of all members.

Public Methods

virtual void _add_ref (void)=0
 %! virtual CORBA::ValueBase* _copy_value (void) = 0;. More...

virtual void _remove_ref (void)=0
virtual CORBA::ULong _refcount_value (void)=0
virtual const char * _tao_obv_repository_id (void) const=0
 TAO extension. More...

CORBA::Boolean _tao_unmarshal_post (TAO_InputCDR &strm)
virtual void * _tao_obv_narrow (ptr_arith_t)=0
virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &)=0
 during marshal jump to the most derived part. More...

virtual CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &)=0
 called after obtaining the fresh object from create_for_unmarshal (). More...


Static Public Methods

CORBA::ValueBase_downcast (CORBA::ValueBase *)
CORBA::Boolean _tao_marshal (TAO_OutputCDR &strm, CORBA_ValueBase *_this, ptr_arith_t formal_type_id=0)
 Marshal a valuetype (see operator<< in tao_idl generated file how it is called). More...

CORBA::Boolean _tao_unmarshal (TAO_InputCDR &strm, CORBA_ValueBase *&new_object)
 Unmarshal a valuetype, if formal type is a pointer to ValueBase. More...

CORBA::Boolean _tao_unmarshal_pre (TAO_InputCDR &strm, CORBA_ValueFactory &, CORBA_ValueBase *&, const char *const repo_id)
 Both used internally and are called from T::_tao_unmarshal (). More...


Protected Methods

 CORBA_ValueBase (void)
 CORBA_ValueBase (const CORBA_ValueBase &)
virtual ~CORBA_ValueBase (void)

Private Methods

CORBA_ValueBase & operator= (const CORBA_ValueBase &)

Detailed Description

Abstract baseclass for Valuetypes (see CORBA 2.3 20.17.5).

Definition at line 35 of file ValueBase.h.


Constructor & Destructor Documentation

ACE_INLINE CORBA_ValueBase::CORBA_ValueBase void    [protected]
 

Definition at line 24 of file ValueBase.i.

00025 {
00026 }

CORBA_ValueBase::CORBA_ValueBase const CORBA_ValueBase &    [protected]
 

CORBA_ValueBase::~CORBA_ValueBase void    [protected, virtual]
 

Definition at line 34 of file ValueBase.cpp.

00035 {
00036 }


Member Function Documentation

virtual void CORBA_ValueBase::_add_ref void    [pure virtual]
 

%! virtual CORBA::ValueBase* _copy_value (void) = 0;.

Implemented in CORBA_DefaultValueRefCountBase.

Referenced by PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::_allocate_buffer, PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq, and PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::operator=.

CORBA::ValueBase* CORBA_ValueBase::_downcast CORBA::ValueBase   [static]
 

Reimplemented in PortableInterceptor::ObjectReferenceFactory.

Referenced by operator<<.

virtual CORBA::ULong CORBA_ValueBase::_refcount_value void    [pure virtual]
 

Implemented in CORBA_DefaultValueRefCountBase.

virtual void CORBA_ValueBase::_remove_ref void    [pure virtual]
 

Implemented in CORBA_DefaultValueRefCountBase.

Referenced by PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::_deallocate_buffer, PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::_shrink_buffer, and PortableInterceptor::_TAO_Unbounded_Valuetype_Sequence_PortableInterceptor_ObjectReferenceTemplateSeq::operator=.

CORBA::Boolean CORBA_ValueBase::_tao_marshal TAO_OutputCDR   strm,
CORBA_ValueBase *    _this,
ptr_arith_t    formal_type_id = 0
[static]
 

Marshal a valuetype (see operator<< in tao_idl generated file how it is called).

Definition at line 61 of file ValueBase.cpp.

References _tao_marshal_v, _tao_obv_repository_id, ptr_arith_t, TAO_OBV_GIOP_Flags::Type_info_single, TAO_OBV_GIOP_Flags::Value_tag_base, ACE_OutputCDR::write_string, and ACE_OutputCDR::write_ulong.

Referenced by operator<<.

00064 {
00065   CORBA::Boolean retval = 1;
00066   // %! yet much to do ... look for +++ !
00067 
00068   // 1. Is 'this' yet marshalled ? (->1a)
00069   //    If not then mark 'this' as marshalled. (->2) +++
00070   //    Or is it null ? (write null_ref and return ok)
00071   // 1a. Put indirection and return successfull.
00072 
00073   if (this_ == 0)
00074     {
00075       retval = strm.write_ulong (0);
00076       // write TAO_OBV_GIOP_Flags::Null_ref
00077       return retval;
00078     }
00079 
00080   // 2. if (chunking) and we are in a chunk (look in strm),
00081   //    end the chunk by writing its length at its start.
00082   //    This is the responsibility of the CDR stream. +++
00083   //    But if nothing is writtern in this chunk yet,
00084   //    we want to overwrite the place of the dummy blocksize-tag
00085   //    with our <value-tag>.
00086   //    Increase the nesting level of valuetypes.
00087 
00088   // 3. Build <value-tag>, which states if chunking is used
00089   //    and if type information ((list of) repository id(s))
00090   //    is provided. The latter is necessary if the formal_type_id
00091   //    is unequal the 'true derived' type of this object. +++
00092 
00093   CORBA::ULong value_tag = TAO_OBV_GIOP_Flags::Value_tag_base
00094                            | TAO_OBV_GIOP_Flags::Type_info_single;
00095 
00096   retval = strm.write_ulong (value_tag);
00097 
00098   if (! retval)
00099     {
00100       return retval;
00101     }
00102 
00103   // 4. Marshal type information.
00104 
00105   retval = strm.write_string (this_->_tao_obv_repository_id ());
00106 
00107   if (! retval)
00108     {
00109       return retval;
00110     }
00111 
00112   // 5. if (chunking) let room for a blocksize-tag. (i.e. write ULong)
00113 
00114   // 6. Now marshal state members. (%! Problem when state is empty
00115   //    and chunked encoding is used.)
00116 
00117   retval = this_->_tao_marshal_v (strm);
00118 
00119   // 7. if (chunking) let strm overwrite the last blocksize tag
00120   //    with its concrete value.                                 +++
00121   // 8. if (chunking) write an end tag, or (optimization) let the CDR
00122   //    care for collecting all end tags of nested values (e.g. linked
00123   //    list), so that only one end tag at all must be written.  +++
00124 
00125   return retval;
00126 }

virtual CORBA::Boolean CORBA_ValueBase::_tao_marshal_v TAO_OutputCDR   [pure virtual]
 

during marshal jump to the most derived part.

Implemented in PortableInterceptor::ObjectReferenceFactory.

Referenced by _tao_marshal.

virtual void* CORBA_ValueBase::_tao_obv_narrow ptr_arith_t    [pure virtual]
 

Implemented in PortableInterceptor::ObjectReferenceFactory.

virtual const char* CORBA_ValueBase::_tao_obv_repository_id void    const [pure virtual]
 

TAO extension.

Implemented in PortableInterceptor::ObjectReferenceFactory.

Referenced by _tao_marshal.

CORBA::Boolean CORBA_ValueBase::_tao_unmarshal TAO_InputCDR   strm,
CORBA_ValueBase *&    new_object
[static]
 

Unmarshal a valuetype, if formal type is a pointer to ValueBase.

Definition at line 130 of file ValueBase.cpp.

References _tao_unmarshal_v.

Referenced by operator>>.

00132 {
00133   // This is for the special case only that one unmarshals in order
00134   // to assign the newly created object directly to a ValueBase pointer.
00135   // Implementation is like a specialized one (in TC.cpp, if T.idl is source).
00136   // basically do:
00137   //  ValueBase::_tao_unmarshal_pre ()
00138   //    (Gets factory or possible a null or an existing object.
00139   //     Then the job is done. On an existing (backreferenced) object
00140   //     do a cast and a type check)
00141   //  new_object = factory->create_for_unmarshal ()
00142   //     (with apropriate cast)
00143   //  new_object->_tao_unmarshal_v ()
00144   //  new_object->_tao_unmarshal_post ()
00145 
00146 //  CORBA::ValueBase *base = 0;
00147   CORBA::ValueFactory_var factory;
00148   CORBA::Boolean retval =
00149     CORBA::ValueBase::_tao_unmarshal_pre (strm,
00150                                           factory.out (),
00151                                           new_object,
00152                                           0);
00153 
00154   if (retval == 0)
00155     {
00156       return 0;
00157     }
00158 
00159   if (factory.in () != 0)
00160     {
00161       new_object = factory->create_for_unmarshal ();
00162 
00163       if (new_object == 0)
00164         {
00165           return 0;  // %! except.?
00166         }
00167 
00168       retval = new_object->_tao_unmarshal_v (strm);
00169 
00170       if (retval == 0)
00171         {
00172           return 0;
00173         }
00174     }
00175 
00176   // Now base must be null or point to the unmarshaled object.
00177   // Align the pointer to the right subobject.
00178 //  new_object = CORBA_ValueBase::_downcast (base);
00179   return retval;
00180 }

CORBA::Boolean CORBA_ValueBase::_tao_unmarshal_post TAO_InputCDR   strm
 

Definition at line 270 of file ValueBase.cpp.

00271 {
00272   CORBA::Boolean retval = 1;
00273 
00274   // (... called from T::_tao_unmarshal)
00275   // 7. if (chunking) check the last blocksize tag for correct value.  +++
00276   //    And if we're gonna to truncate, skip all the state of the more
00277   //    derived classes. (But it might need to be accessed again,
00278   //    if there are embedded objects which are referenced later
00279   //    in this CDR encoding stream.)
00280 
00281   // 8. if (chunking) there must be some end tag. Let the CDR stream deal
00282   //    with this (and decrease the nesting level of valuetypes).
00283   //    Also the CDR stream must check for eventually outstanding end tags
00284   //    at the end of the stream which have to cause a marshal
00285   //    exception there.
00286 
00287   return retval;
00288 }

CORBA::Boolean CORBA_ValueBase::_tao_unmarshal_pre TAO_InputCDR   strm,
CORBA_ValueFactory  ,
CORBA_ValueBase *&   ,
const char *const    repo_id
[static]
 

Both used internally and are called from T::_tao_unmarshal ().

Definition at line 184 of file ValueBase.cpp.

References ACE_DEBUG, ACE_TEXT, TAO_OBV_GIOP_Flags::is_null_ref, TAO_OBV_GIOP_Flags::is_value_tag, LM_DEBUG, LM_ERROR, LM_WARNING, TAO_ORB_Core::orb, TAO_InputCDR::orb_core, ACE_InputCDR::read_string, ACE_InputCDR::read_ulong, and TAO_ORB_Core_instance.

00188 { // %! dont leak on error case !
00189   // %! postconditions
00190   CORBA::Boolean retval = 1;
00191   factory = 0;
00192   // %! yet much to do ... look for +++ !
00193 
00194   // 1. Get the <value-tag> (else it may be <indirection-tag> or <null-ref>).
00195   //    Is object yet unmarshalled (<indirection-tag> is set) ? (->1a)
00196   //    Is <null-ref> given ? Set 0 and return ok.
00197   // 1a. Lookup the real address in memory, which should be aligned +++
00198   //     to CORBA::ValueBase. Its possible at this point that worse
00199   //     type mismatch gets by undetected, if the CDR stream fakes.
00200   //     So the type should be checked ... +++
00201 
00202   CORBA::ULong value_tag;
00203 
00204   if (!strm.read_ulong (value_tag))
00205     {
00206       return 0;
00207     }
00208 
00209   if (TAO_OBV_GIOP_Flags::is_null_ref (value_tag))
00210     {
00211       valuetype = 0;
00212       return 1;
00213       // ok, null reference unmarshaled
00214     }
00215   // 2. Now at this point it must be a <value-tag> (error else).
00216   //    if (chunking) check that any last chunk ends with matching
00217   //    size. If not raise marshal exception.
00218   //    Increase the nesting level of valuetypes.
00219 
00220   if (!TAO_OBV_GIOP_Flags::is_value_tag (value_tag))
00221     {
00222       ACE_DEBUG ((LM_DEBUG,
00223                   ACE_TEXT ("!CORBA::ValueBase::_tao_unmarshal_pre ")
00224                   ACE_TEXT ("not value_tag\n")));
00225       return 0;
00226     }
00227 
00228   // 3. if (chunking) read and record the blocksize-tag.
00229 
00230   // 4. Unmarshal type information and lookup factory.
00231   //    If no type information is given in the CDR encoding, as told
00232   //    from the <value-tag>, then use the repository id parameter
00233   //    (it _must_ be right).
00234 
00235   CORBA::String_var repo_id_stream;
00236 
00237   // It would be more efficient not to copy the string %!)
00238   if (strm.read_string (repo_id_stream.inout ()) == 0)
00239     {
00240       return 0;
00241     }
00242 
00243   TAO_ORB_Core *orb_core = strm.orb_core ();
00244 
00245   if (orb_core == 0)
00246     {
00247       orb_core = TAO_ORB_Core_instance ();
00248 
00249       if (TAO_debug_level > 0)
00250         {
00251           ACE_DEBUG ((LM_WARNING,
00252                       "TAO (%P|%t) WARNING: extracting valuetype using "
00253                       "default ORB_Core\n"));
00254         }
00255     }
00256 
00257   factory = orb_core->orb ()->lookup_value_factory (repo_id_stream.in ());
00258 
00259   if (factory == 0) // %! except.!
00260     {
00261       ACE_DEBUG ((LM_ERROR,
00262                   ACE_TEXT ("(%N:%l) OBV factory is null !!!\n")));
00263       return 0;
00264     }
00265 
00266   return retval;
00267 }

virtual CORBA::Boolean CORBA_ValueBase::_tao_unmarshal_v TAO_InputCDR   [pure virtual]
 

called after obtaining the fresh object from create_for_unmarshal ().

Implemented in PortableInterceptor::ObjectReferenceFactory.

Referenced by _tao_unmarshal.

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


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