#include <Marshal.h>


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 | |
marshal an object reference
Definition at line 202 of file Marshal.h.
| TAO_Marshal_ObjRef::TAO_Marshal_ObjRef | ( | void | ) |
Definition at line 33 of file Marshal.inl.
{
}
| 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.
{
CORBA::Boolean continue_append = true;
// First, append the type hint. This will be the type_id encoded in an
// object reference.
dest->append_string (*src);
// Read the profiles, discarding all until an IIOP profile comes by.
// Once we see an IIOP profile, ignore any further ones.
//
// XXX this will need to change someday to let different protocol
// code be accessed, not just IIOP. Protocol modules will be
// dynamically loaded from shared libraries via ORB_init (), and we
// just need to be able to access such preloaded libraries here as
// we unmarshal objrefs.
CORBA::ULong profiles = 0;
// get the count of profiles that follow. This will tell us the
// length of the sequence
continue_append = (CORBA::Boolean) (src->read_ulong (profiles)
? dest->write_ulong (profiles)
: 0);
// No profiles means a NIL objref.
while (profiles-- != 0 && continue_append)
{
CORBA::ULong tag = 0;
// get the profile ID tag
if ((continue_append = (CORBA::Boolean) (src->read_ulong (tag)
? dest->write_ulong (tag)
: 0)) == 0)
continue;
CORBA::ULong length = 0;
if ((continue_append = (CORBA::Boolean) (src->read_ulong (length)
? dest->write_ulong (length)
: 0)) == 0)
continue;
// @@ This can be optimized! Pre-allocating on the destination
// and then copying directly into that.
CORBA::Octet* body = 0;
ACE_NEW_RETURN (body,
CORBA::Octet[length],
TAO::TRAVERSE_STOP);
continue_append =
(CORBA::Boolean) (src->read_octet_array (body, length)
? dest->write_octet_array (body, length)
: 0);
delete [] body;
}
if (continue_append == 1)
return TAO::TRAVERSE_CONTINUE;
if (TAO_debug_level > 0)
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT ("TAO_Marshal_ObjRef::append detected error\n")
));
throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
| 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.
{
CORBA::Boolean continue_skipping = true;
// return status
TAO::traverse_status retval = TAO::TRAVERSE_CONTINUE;
// First, skip the type hint. This will be the type_id encoded in an
// object reference.
stream->skip_string ();
// Read the profiles, discarding all until an IIOP profile comes by.
// Once we see an IIOP profile, ignore any further ones.
//
// XXX this will need to change someday to let different protocol
// code be accessed, not just IIOP. Protocol modules will be
// dynamically loaded from shared libraries via ORB_init (), and we
// just need to be able to access such preloaded libraries here as
// we unmarshal objrefs.
CORBA::ULong profiles = 0;
// get the count of profiles that follow
continue_skipping = stream->read_ulong (profiles);
while (profiles-- != 0 && continue_skipping)
{
CORBA::ULong tag;
// get the profile ID tag
if ( (continue_skipping = stream->read_ulong (tag)) == 0)
continue;
CORBA::ULong encap_len;
// ProfileData is encoded as a sequence of octet. So first get
// the length of the sequence.
// Create the decoding stream from the encapsulation in the
// buffer, and skip the encapsulation.
if ( (continue_skipping = stream->read_ulong (encap_len)) == 0)
continue;
continue_skipping = stream->skip_bytes (encap_len);
}
if (retval == TAO::TRAVERSE_CONTINUE && continue_skipping)
return TAO::TRAVERSE_CONTINUE;
else
{
if (TAO_debug_level > 0)
ACE_DEBUG ((
LM_DEBUG,
ACE_TEXT ("TAO_Marshal_ObjRef::skip detected error\n")
));
throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
}
1.7.0