#include <Marshal.h>


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 | |
marshal a typecode
Definition at line 158 of file Marshal.h.
| TAO_Marshal_TypeCode::TAO_Marshal_TypeCode | ( | void | ) |
Definition at line 28 of file Marshal.inl.
{
}
| 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.
{
CORBA::Boolean continue_append = true;
TAO::traverse_status retval =
TAO::TRAVERSE_CONTINUE;
CORBA::ULong kind;
// Decode the "kind" field of the typecode from the src for further
// use. However, also write it back into the destination
continue_append = (CORBA::Boolean) (src->read_ulong (kind)
? dest->write_ulong (kind)
: false);
if (continue_append == true)
{
// Typecodes with empty parameter lists all have preallocated
// constants. We use those to reduce memory consumption and
// heap access ... also, to speed things up!
if ((kind < CORBA::TAO_TC_KIND_COUNT)
|| (kind == ~0u))
{
// Either a non-constant typecode or an indirected typecode.
switch (kind)
{
// Need special handling for all kinds of typecodes that
// have nonempty parameter lists ...
default:
// nothing to de done
break;
case CORBA::tk_string:
case CORBA::tk_wstring:
{
// read and write the bounds
retval =
TAO_Marshal_Object::perform_append (CORBA::_tc_long,
src,
dest);
}
break;
// Indirected typecodes, illegal at "top level"
case ~0u:
{
// read and write the negative offset
retval =
TAO_Marshal_Object::perform_append (CORBA::_tc_long,
src,
dest);
}
break;
// The rest have "complex" parameter lists that are
// encoded as bulk octets ...
case CORBA::tk_objref:
case CORBA::tk_struct:
case CORBA::tk_union:
case CORBA::tk_enum:
case CORBA::tk_sequence:
case CORBA::tk_array:
case CORBA::tk_alias:
case CORBA::tk_except:
case CORBA::tk_value:
case CORBA::tk_value_box:
case CORBA::tk_native:
case CORBA::tk_abstract_interface:
case CORBA::tk_local_interface:
case CORBA::tk_component:
case CORBA::tk_home:
case CORBA::tk_event:
{
// write the encapsulation i.e., octet sequence
retval =
TAO_Marshal_Object::perform_append (CORBA::_tc_OctetSeq,
src,
dest);
}
} // end of switch
}
else // bad kind_ value to be decoded
{
if (TAO_debug_level > 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_TypeCode: ")
ACE_TEXT ("Bad kind_ value in CDR stream\n")));
}
throw ::CORBA::BAD_TYPECODE ();
}
}
if (continue_append == 1 && retval == TAO::TRAVERSE_CONTINUE)
{
return TAO::TRAVERSE_CONTINUE;
}
if (TAO_debug_level > 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_TypeCode::append detected error\n")));
}
throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
| 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.
{
CORBA::Boolean continue_skipping = true;
// Typecode kind.
CORBA::ULong kind;
// Decode the "kind" field of the typecode from the stream.
continue_skipping = stream->read_ulong (kind);
if (continue_skipping)
{
// Typecodes with empty parameter lists all have preallocated
// constants. We use those to reduce memory consumption and
// heap access ... also, to speed things up!
if ((kind < CORBA::TAO_TC_KIND_COUNT) ||
(kind == ~0u))
{
// Either a non-constant typecode or an indirected typecode.
switch (kind)
{
// Need special handling for all kinds of typecodes that
// have nonempty parameter lists ...
default:
// simple typecodes, nothing to do
break;
case CORBA::tk_string:
case CORBA::tk_wstring:
{
// skip the bounds
continue_skipping = stream->skip_ulong ();
}
break;
// Indirected typecodes, illegal at "top level".
case ~0u:
{
// skip the long indicating the encapsulation offset,
continue_skipping = stream->skip_long ();
}
break;
// The rest have "complex" parameter lists that are
// encoded as bulk octets ...
case CORBA::tk_objref:
case CORBA::tk_struct:
case CORBA::tk_union:
case CORBA::tk_enum:
case CORBA::tk_sequence:
case CORBA::tk_array:
case CORBA::tk_alias:
case CORBA::tk_except:
case CORBA::tk_value:
case CORBA::tk_value_box:
case CORBA::tk_native:
case CORBA::tk_abstract_interface:
case CORBA::tk_local_interface:
case CORBA::tk_component:
case CORBA::tk_home:
case CORBA::tk_event:
{
CORBA::ULong length;
// get the encapsulation length
continue_skipping = stream->read_ulong (length);
if (!continue_skipping)
break;
// skip the encapsulation
continue_skipping = stream->skip_bytes (length);
}
} // end of switch
}
else // bad kind_ value to be decoded
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_TypeCode::skip: ")
ACE_TEXT ("Bad kind_ value in CDR stream\n")));
throw ::CORBA::BAD_TYPECODE ();
}
}
if (continue_skipping)
return TAO::TRAVERSE_CONTINUE;
else
{
if (TAO_debug_level > 0)
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT ("TAO_Marshal_TypeCode::skip detected error\n")
));
throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
}
1.7.0