#include <Marshal.h>


Public Member Functions | |
| TAO_Marshal_Value (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 | |
Private Attributes | |
| CORBA::Boolean | nested_processing_ |
marshal a valuetype
Definition at line 400 of file Marshal.h.
| TAO_Marshal_Value::TAO_Marshal_Value | ( | void | ) |
Definition at line 78 of file Marshal.inl.
: nested_processing_ (false) { }
| TAO::traverse_status TAO_Marshal_Value::append | ( | CORBA::TypeCode_ptr | tc, | |
| TAO_InputCDR * | src, | |||
| TAO_OutputCDR * | dest | |||
| ) | [virtual] |
append operation
Implements TAO_Marshal_Object.
Definition at line 1129 of file append.cpp.
{
TAO::traverse_status retval =
TAO::TRAVERSE_CONTINUE;
// Use the same method to append our base valuetype.
// To achive this we'll need to distinguish between
// first-time/nested appends so that we won't attempt to
// append rep_id several times.
//
if (this->nested_processing_ == 0)
{
this->nested_processing_ = 1;
CORBA::ULong value_tag;
if (!src->read_ulong (value_tag) ||
!dest->write_ulong (value_tag))
{
return TAO::TRAVERSE_STOP;
}
TAO_ORB_Core *orb_core = src->orb_core ();
if (orb_core == 0)
{
orb_core = TAO_ORB_Core_instance ();
if (TAO_debug_level > 0)
{
ACE_DEBUG ((LM_WARNING,
"TAO (%P|%t) WARNING: extracting "
"valuetype using default ORB_Core\n"));
}
}
TAO_Valuetype_Adapter *adapter = orb_core->valuetype_adapter();
if (value_tag == 0) // Null value type pointer.
{
//We are done.
return retval;
}
else if (value_tag & adapter->type_info_single ())
{
// Append repository id which is of type string.
dest->append_string (*src);
}
else
{
//@@ boris: VT CDR
return TAO::TRAVERSE_STOP;
}
}
// Handle our base valuetype if any.
CORBA::TypeCode_var param =
tc->concrete_base_type ();
CORBA::TCKind const param_kind = param->kind ();
if (param_kind != CORBA::tk_null)
{
retval = this->append (param.in (),
src,
dest
);
if (retval != TAO::TRAVERSE_CONTINUE)
{
return retval;
}
}
// Number of fields in the struct.
const CORBA::ULong member_count =
tc->member_count ();
for (CORBA::ULong i = 0;
i < member_count && retval == TAO::TRAVERSE_CONTINUE;
++i)
{
// get member type
param = tc->member_type (i);
retval =
TAO_Marshal_Object::perform_append (param.in (),
src,
dest
);
}
if (retval == TAO::TRAVERSE_CONTINUE)
return TAO::TRAVERSE_CONTINUE;
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_Value::append detected error\n")));
throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
| TAO::traverse_status TAO_Marshal_Value::skip | ( | CORBA::TypeCode_ptr | tc, | |
| TAO_InputCDR * | context | |||
| ) | [virtual] |
skip operation
Implements TAO_Marshal_Object.
Definition at line 855 of file skip.cpp.
{
TAO::traverse_status retval = TAO::TRAVERSE_CONTINUE;
CORBA::TypeCode_var param;
// Use the same method to skip over our base valuetype.
// To achive this we'll need to distinguish between
// first-time/nested skips so that we won't attempt to
// skip rep_id several times.
//
if (this->nested_processing_ == false)
{
this->nested_processing_ = true;
CORBA::Long value_tag;
if (!stream->read_long (value_tag))
{
return TAO::TRAVERSE_STOP;
}
TAO_ORB_Core *orb_core = stream->orb_core ();
if (orb_core == 0)
{
orb_core = TAO_ORB_Core_instance ();
if (TAO_debug_level > 0)
{
ACE_DEBUG ((LM_WARNING,
"TAO (%P|%t) WARNING: extracting "
"valuetype using default ORB_Core\n"));
}
}
TAO_Valuetype_Adapter *adapter = orb_core->valuetype_adapter();
if (value_tag == 0) // Null value type pointer.
{
// We are done.
return retval;
}
else if (adapter->is_type_info_single(value_tag))
{
// Skip a single repository id which is of type string.
stream->skip_string ();
}
else if (adapter->is_type_info_list(value_tag))
{
CORBA::Long num_types;
if (!stream->read_long (num_types))
{
return TAO::TRAVERSE_STOP;
}
while (num_types > 0)
{
stream->skip_string();
num_types--;
}
}
else if (!adapter->is_type_info_implied (value_tag))
{
//@@ boris: VT CDR
return TAO::TRAVERSE_STOP;
}
if (adapter->is_value_chunked (value_tag))
{
CORBA::Long chunk_tag = 0;
while (chunk_tag != -1)
{
if (!stream->read_long (chunk_tag))
return TAO::TRAVERSE_STOP;
if (chunk_tag > 0)
{
if (!stream->skip_bytes(chunk_tag))
return TAO::TRAVERSE_STOP;
}
}
return TAO::TRAVERSE_CONTINUE;
}
}
// Handle our base valuetype if any.
param = tc->concrete_base_type ();
CORBA::TCKind const k = param->kind ();
if (k != CORBA::tk_null)
{
retval = this->skip (param.in (), stream);
if (retval != TAO::TRAVERSE_CONTINUE)
{
return retval;
}
}
// Number of fields in the valuetype.
CORBA::ULong const member_count =
tc->member_count ();
for (CORBA::ULong i = 0;
i < member_count && retval == TAO::TRAVERSE_CONTINUE;
++i)
{
param = tc->member_type (i);
retval = TAO_Marshal_Object::perform_skip (param.in (), stream);
}
if (retval == TAO::TRAVERSE_CONTINUE)
return TAO::TRAVERSE_CONTINUE;
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_Value::skip detected error\n")));
throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
1.7.0