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

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 Methods

 TAO_Marshal_TypeCode (void)
virtual CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, TAO_InputCDR *context ACE_ENV_ARG_DECL)
 skip operation. More...

virtual CORBA::TypeCode::traverse_status append (CORBA::TypeCode_ptr tc, TAO_InputCDR *src, TAO_OutputCDR *dest ACE_ENV_ARG_DECL)
 append operation. More...


Detailed Description

TAO_Marshal_TypeCode.

marshal a typecode

Definition at line 155 of file Marshal.h.


Constructor & Destructor Documentation

ACE_INLINE TAO_Marshal_TypeCode::TAO_Marshal_TypeCode void   
 

Definition at line 24 of file Marshal.i.

00025 {
00026 }


Member Function Documentation

CORBA::TypeCode::traverse_status TAO_Marshal_TypeCode::append CORBA::TypeCode_ptr    tc,
TAO_InputCDR   src,
TAO_OutputCDR *dest    ACE_ENV_ARG_DECL
[virtual]
 

append operation.

Implements TAO_Marshal_Object.

Definition at line 143 of file append.cpp.

References ACE_CHECK_RETURN, ACE_DEBUG, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_TEXT, ACE_THROW_RETURN, LM_DEBUG, TAO_Marshal_Object::perform_append, ACE_InputCDR::read_ulong, and TAO_DEFAULT_MINOR_CODE.

Referenced by TAO_Marshal_Object::perform_append.

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

virtual CORBA::TypeCode::traverse_status TAO_Marshal_TypeCode::skip CORBA::TypeCode_ptr    tc,
TAO_InputCDR *context    ACE_ENV_ARG_DECL
[virtual]
 

skip operation.

Implements TAO_Marshal_Object.


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