TAO_Marshal_ObjRef Class Reference

TAO_Marshal_ObjRef. More...

#include <Marshal.h>

Inheritance diagram for TAO_Marshal_ObjRef:

Inheritance graph
[legend]
Collaboration diagram for TAO_Marshal_ObjRef:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_Marshal_ObjRef (void)
virtual TAO::traverse_status skip (CORBA::TypeCode_ptr tc, TAO_InputCDR *context)
 skip operation

virtual TAO::traverse_status append (CORBA::TypeCode_ptr tc, TAO_InputCDR *src, TAO_OutputCDR *dest)
 append operation


Detailed Description

TAO_Marshal_ObjRef.

marshal an object reference

Definition at line 202 of file Marshal.h.


Constructor & Destructor Documentation

ACE_INLINE TAO_Marshal_ObjRef::TAO_Marshal_ObjRef void   ) 
 

Definition at line 33 of file Marshal.inl.

00034 {
00035 }


Member Function Documentation

TAO::traverse_status TAO_Marshal_ObjRef::append CORBA::TypeCode_ptr  tc,
TAO_InputCDR src,
TAO_OutputCDR dest
[virtual]
 

append operation

Implements TAO_Marshal_Object.

Definition at line 254 of file append.cpp.

References ACE_DEBUG, ACE_NEW_RETURN, ACE_TEXT, ACE_OutputCDR::append_string(), LM_DEBUG, ACE_InputCDR::read_octet_array(), ACE_InputCDR::read_ulong(), TAO_debug_level, ACE_OutputCDR::write_octet_array(), and ACE_OutputCDR::write_ulong().

00257 {
00258   CORBA::Boolean continue_append = true;
00259 
00260   // First, append the type hint. This will be the type_id encoded in an
00261   // object reference.
00262   dest->append_string (*src);
00263 
00264   // Read the profiles, discarding all until an IIOP profile comes by.
00265   // Once we see an IIOP profile, ignore any further ones.
00266   //
00267   // XXX this will need to change someday to let different protocol
00268   // code be accessed, not just IIOP.  Protocol modules will be
00269   // dynamically loaded from shared libraries via ORB_init (), and we
00270   // just need to be able to access such preloaded libraries here as
00271   // we unmarshal objrefs.
00272 
00273   CORBA::ULong profiles = 0;
00274 
00275   // get the count of profiles that follow. This will tell us the
00276   // length of the sequence
00277   continue_append = (CORBA::Boolean) (src->read_ulong (profiles)
00278                                       ? dest->write_ulong (profiles)
00279                                       : 0);
00280 
00281   // No profiles means a NIL objref.
00282   while (profiles-- != 0 && continue_append)
00283     {
00284       CORBA::ULong tag = 0;
00285 
00286       // get the profile ID tag
00287       if ((continue_append = (CORBA::Boolean) (src->read_ulong (tag)
00288                                                ? dest->write_ulong (tag)
00289                                                : 0))  == 0)
00290         continue;
00291 
00292       CORBA::ULong length = 0;
00293       if ((continue_append = (CORBA::Boolean) (src->read_ulong (length)
00294                               ? dest->write_ulong (length)
00295                               : 0)) == 0)
00296         continue;
00297 
00298       // @@ This can be optimized! Pre-allocating on the destination
00299       //    and then copying directly into that.
00300       CORBA::Octet* body = 0;
00301       ACE_NEW_RETURN (body,
00302                       CORBA::Octet[length],
00303                       TAO::TRAVERSE_STOP);
00304       continue_append =
00305         (CORBA::Boolean) (src->read_octet_array (body, length)
00306                           ? dest->write_octet_array (body, length)
00307                           : 0);
00308       delete [] body;
00309     }
00310 
00311   if (continue_append == 1)
00312     return TAO::TRAVERSE_CONTINUE;
00313 
00314   if (TAO_debug_level > 0)
00315     ACE_DEBUG ((
00316         LM_DEBUG,
00317         ACE_TEXT ("TAO_Marshal_ObjRef::append detected error\n")
00318       ));
00319 
00320   throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
00321 }

TAO::traverse_status TAO_Marshal_ObjRef::skip CORBA::TypeCode_ptr  tc,
TAO_InputCDR context
[virtual]
 

skip operation

Implements TAO_Marshal_Object.

Definition at line 235 of file skip.cpp.

References ACE_DEBUG, ACE_TEXT, LM_DEBUG, ACE_InputCDR::read_ulong(), ACE_InputCDR::skip_bytes(), ACE_InputCDR::skip_string(), and TAO_debug_level.

00236 {
00237   CORBA::Boolean continue_skipping = true;
00238 
00239   // return status
00240   TAO::traverse_status retval = TAO::TRAVERSE_CONTINUE;
00241 
00242   // First, skip the type hint. This will be the type_id encoded in an
00243   // object reference.
00244   stream->skip_string ();
00245 
00246   // Read the profiles, discarding all until an IIOP profile comes by.
00247   // Once we see an IIOP profile, ignore any further ones.
00248   //
00249   // XXX this will need to change someday to let different protocol
00250   // code be accessed, not just IIOP.  Protocol modules will be
00251   // dynamically loaded from shared libraries via ORB_init (), and we
00252   // just need to be able to access such preloaded libraries here as
00253   // we unmarshal objrefs.
00254   CORBA::ULong profiles = 0;
00255 
00256   // get the count of profiles that follow
00257   continue_skipping = stream->read_ulong (profiles);
00258 
00259   while (profiles-- != 0 && continue_skipping)
00260       {
00261         CORBA::ULong tag;
00262 
00263         // get the profile ID tag
00264         if ( (continue_skipping = stream->read_ulong (tag)) == 0)
00265           continue;
00266 
00267         CORBA::ULong encap_len;
00268         // ProfileData is encoded as a sequence of octet. So first get
00269         // the length of the sequence.
00270         // Create the decoding stream from the encapsulation in the
00271         // buffer, and skip the encapsulation.
00272         if ( (continue_skipping = stream->read_ulong (encap_len)) == 0)
00273           continue;
00274 
00275         continue_skipping = stream->skip_bytes (encap_len);
00276       }
00277 
00278   if (retval == TAO::TRAVERSE_CONTINUE && continue_skipping)
00279     return TAO::TRAVERSE_CONTINUE;
00280   else
00281     {
00282       if (TAO_debug_level > 0)
00283         ACE_DEBUG ((
00284             LM_DEBUG,
00285             ACE_TEXT ("TAO_Marshal_ObjRef::skip detected error\n")
00286           ));
00287       throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
00288     }
00289 }


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 13:21:56 2008 for TAO_AnyTypeCode by doxygen 1.3.6