TAO_Marshal_TypeCode Class Reference

TAO_Marshal_TypeCode. More...

#include <Marshal.h>

Inheritance diagram for TAO_Marshal_TypeCode:

Inheritance graph
[legend]
Collaboration diagram for TAO_Marshal_TypeCode:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_Marshal_TypeCode (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_TypeCode.

marshal a typecode

Definition at line 158 of file Marshal.h.


Constructor & Destructor Documentation

ACE_INLINE TAO_Marshal_TypeCode::TAO_Marshal_TypeCode void   ) 
 

Definition at line 28 of file Marshal.inl.

00029 {
00030 }


Member Function Documentation

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

append operation

Implements TAO_Marshal_Object.

Definition at line 137 of file append.cpp.

References ACE_DEBUG, ACE_TEXT, LM_DEBUG, TAO_Marshal_Object::perform_append(), ACE_InputCDR::read_ulong(), TAO_debug_level, and ACE_OutputCDR::write_ulong().

00140 {
00141   CORBA::Boolean continue_append = true;
00142   TAO::traverse_status retval =
00143     TAO::TRAVERSE_CONTINUE;
00144   CORBA::ULong kind;
00145 
00146   // Decode the "kind" field of the typecode from the src for further
00147   // use. However, also write it back into the destination
00148   continue_append = (CORBA::Boolean) (src->read_ulong (kind)
00149                                       ? dest->write_ulong (kind)
00150                                       : false);
00151 
00152   if (continue_append == true)
00153     {
00154       // Typecodes with empty parameter lists all have preallocated
00155       // constants.  We use those to reduce memory consumption and
00156       // heap access ... also, to speed things up!
00157       if ((kind < CORBA::TAO_TC_KIND_COUNT)
00158           || (kind == ~0u))
00159         {
00160           // Either a non-constant typecode or an indirected typecode.
00161           switch (kind)
00162             {
00163               // Need special handling for all kinds of typecodes that
00164               // have nonempty parameter lists ...
00165             default:
00166               // nothing to de done
00167               break;
00168             case CORBA::tk_string:
00169             case CORBA::tk_wstring:
00170               {
00171                 // read and write the bounds
00172                 retval =
00173                   TAO_Marshal_Object::perform_append (CORBA::_tc_long,
00174                                                       src,
00175                                                       dest);
00176               }
00177             break;
00178 
00179             // Indirected typecodes, illegal at "top level"
00180             case ~0u:
00181               {
00182                 // read and write the negative offset
00183                 retval =
00184                   TAO_Marshal_Object::perform_append (CORBA::_tc_long,
00185                                                       src,
00186                                                       dest);
00187               }
00188             break;
00189 
00190             // The rest have "complex" parameter lists that are
00191             // encoded as bulk octets ...
00192             case CORBA::tk_objref:
00193             case CORBA::tk_struct:
00194             case CORBA::tk_union:
00195             case CORBA::tk_enum:
00196             case CORBA::tk_sequence:
00197             case CORBA::tk_array:
00198             case CORBA::tk_alias:
00199             case CORBA::tk_except:
00200             case CORBA::tk_value:
00201             case CORBA::tk_value_box:
00202             case CORBA::tk_native:
00203             case CORBA::tk_abstract_interface:
00204             case CORBA::tk_local_interface:
00205             case CORBA::tk_component:
00206             case CORBA::tk_home:
00207             case CORBA::tk_event:
00208               {
00209                 // write the encapsulation i.e., octet sequence
00210                 retval =
00211                   TAO_Marshal_Object::perform_append (CORBA::_tc_OctetSeq,
00212                                                       src,
00213                                                       dest);
00214               }
00215             } // end of switch
00216         }
00217       else // bad kind_ value to be decoded
00218         {
00219           if (TAO_debug_level > 0)
00220             {
00221               ACE_DEBUG ((LM_DEBUG,
00222                           ACE_TEXT ("TAO_Marshal_TypeCode: ")
00223                           ACE_TEXT ("Bad kind_ value in CDR stream\n")));
00224             }
00225 
00226           throw ::CORBA::BAD_TYPECODE ();
00227         }
00228     }
00229 
00230   if (continue_append == 1 && retval == TAO::TRAVERSE_CONTINUE)
00231     {
00232       return TAO::TRAVERSE_CONTINUE;
00233     }
00234 
00235   if (TAO_debug_level > 0)
00236     {
00237       ACE_DEBUG ((LM_DEBUG,
00238                   ACE_TEXT ("TAO_Marshal_TypeCode::append detected error\n")));
00239     }
00240 
00241   throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
00242 }

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

skip operation

Implements TAO_Marshal_Object.

Definition at line 112 of file skip.cpp.

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

00113 {
00114   CORBA::Boolean continue_skipping = true;
00115 
00116   // Typecode kind.
00117   CORBA::ULong kind;
00118 
00119   // Decode the "kind" field of the typecode from the stream.
00120   continue_skipping = stream->read_ulong (kind);
00121 
00122   if (continue_skipping)
00123     {
00124       // Typecodes with empty parameter lists all have preallocated
00125       // constants.  We use those to reduce memory consumption and
00126       // heap access ... also, to speed things up!
00127       if ((kind < CORBA::TAO_TC_KIND_COUNT) ||
00128           (kind == ~0u))
00129         {
00130           // Either a non-constant typecode or an indirected typecode.
00131           switch (kind)
00132             {
00133               // Need special handling for all kinds of typecodes that
00134               // have nonempty parameter lists ...
00135             default:
00136               // simple typecodes, nothing to do
00137               break;
00138             case CORBA::tk_string:
00139             case CORBA::tk_wstring:
00140               {
00141                 // skip the bounds
00142                 continue_skipping = stream->skip_ulong ();
00143               }
00144             break;
00145 
00146             // Indirected typecodes, illegal at "top level".
00147             case ~0u:
00148               {
00149                 // skip the long indicating the encapsulation offset,
00150                 continue_skipping = stream->skip_long ();
00151               }
00152             break;
00153 
00154             // The rest have "complex" parameter lists that are
00155             // encoded as bulk octets ...
00156             case CORBA::tk_objref:
00157             case CORBA::tk_struct:
00158             case CORBA::tk_union:
00159             case CORBA::tk_enum:
00160             case CORBA::tk_sequence:
00161             case CORBA::tk_array:
00162             case CORBA::tk_alias:
00163             case CORBA::tk_except:
00164             case CORBA::tk_value:
00165             case CORBA::tk_value_box:
00166             case CORBA::tk_native:
00167             case CORBA::tk_abstract_interface:
00168             case CORBA::tk_local_interface:
00169             case CORBA::tk_component:
00170             case CORBA::tk_home:
00171             case CORBA::tk_event:
00172               {
00173                 CORBA::ULong length;
00174 
00175                 // get the encapsulation length
00176                 continue_skipping = stream->read_ulong (length);
00177                 if (!continue_skipping)
00178                   break;
00179                 // skip the encapsulation
00180                 continue_skipping = stream->skip_bytes (length);
00181               }
00182             } // end of switch
00183         }
00184       else // bad kind_ value to be decoded
00185         {
00186           if (TAO_debug_level > 0)
00187             ACE_DEBUG ((LM_DEBUG,
00188                         ACE_TEXT ("TAO_Marshal_TypeCode::skip: ")
00189                         ACE_TEXT ("Bad kind_ value in CDR stream\n")));
00190           throw ::CORBA::BAD_TYPECODE ();
00191         }
00192     }
00193 
00194   if (continue_skipping)
00195     return TAO::TRAVERSE_CONTINUE;
00196   else
00197     {
00198       if (TAO_debug_level > 0)
00199         ACE_DEBUG ((
00200             LM_DEBUG,
00201             ACE_TEXT ("TAO_Marshal_TypeCode::skip detected error\n")
00202           ));
00203       throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
00204     }
00205 }


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