summaryrefslogtreecommitdiff
path: root/TAO/tao/AnyTypeCode/append.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/AnyTypeCode/append.cpp')
-rw-r--r--TAO/tao/AnyTypeCode/append.cpp201
1 files changed, 69 insertions, 132 deletions
diff --git a/TAO/tao/AnyTypeCode/append.cpp b/TAO/tao/AnyTypeCode/append.cpp
index 0bfbd0adb7d..af885729ecb 100644
--- a/TAO/tao/AnyTypeCode/append.cpp
+++ b/TAO/tao/AnyTypeCode/append.cpp
@@ -1,23 +1,19 @@
-// $Id$
-// ============================================================================
-//
-// = LIBRARY
-// TAO
-//
-// = FILENAME
-// append.cpp
-//
-// = DESCRIPTION
-// Appends a CDR stream to another CDR stream. Due to the
-// stringent alignment requirements, it is not possible to simply
-// append or memcpy. Instead we go thru the same CDR encoding rules
-//
-// = AUTHOR
-// Copyright 1994-1995 by Sun Microsystems Inc.
-// and Aniruddha Gokhale
-//
-// ============================================================================
+//=============================================================================
+/**
+ * @file append.cpp
+ *
+ * $Id$
+ *
+ * Appends a CDR stream to another CDR stream. Due to the
+ * stringent alignment requirements, it is not possible to simply
+ * append or memcpy. Instead we go thru the same CDR encoding rules
+ *
+ *
+ * @author Copyright 1994-1995 by Sun Microsystems Inc. and Aniruddha Gokhale
+ */
+//=============================================================================
+
#include "tao/AnyTypeCode/TypeCode.h"
#include "tao/AnyTypeCode/Marshal.h"
@@ -25,7 +21,6 @@
#include "tao/AnyTypeCode/TypeCode_Constants.h"
#include "tao/AnyTypeCode/OctetSeqA.h"
#include "tao/AnyTypeCode/Any.h"
-#include "tao/Environment.h"
#include "tao/debug.h"
#include "tao/Valuetype_Adapter.h"
#include "tao/ORB_Core.h"
@@ -49,10 +44,9 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO::traverse_status
TAO_Marshal_Primitive::append (CORBA::TypeCode_ptr tc,
TAO_InputCDR *src,
- TAO_OutputCDR *dest
- )
+ TAO_OutputCDR *dest)
{
- CORBA::Boolean continue_append = 1;
+ CORBA::Boolean continue_append = true;
TAO::traverse_status retval =
TAO::TRAVERSE_CONTINUE; // status of encode operation
@@ -106,36 +100,26 @@ TAO_Marshal_Primitive::append (CORBA::TypeCode_ptr tc,
ACE_TEXT ("TAO_Marshal_Primitive::append detected error\n")
));
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
TAO::traverse_status
TAO_Marshal_Any::append (CORBA::TypeCode_ptr,
TAO_InputCDR *src,
- TAO_OutputCDR *dest
- )
+ TAO_OutputCDR *dest)
{
// Typecode of the element that makes the Any.
CORBA::TypeCode_var elem_tc;
if (!(*src >> elem_tc.inout ()))
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
if (!(*dest << elem_tc.in ()))
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
// append the data
TAO::traverse_status retval =
- TAO_Marshal_Object::perform_append (elem_tc.in (),
- src,
- dest
- );
+ TAO_Marshal_Object::perform_append (elem_tc.in (), src, dest);
if (retval != TAO::TRAVERSE_CONTINUE)
{
@@ -143,9 +127,7 @@ TAO_Marshal_Any::append (CORBA::TypeCode_ptr,
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_Any::append detected error\n")));
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
return retval;
@@ -154,10 +136,9 @@ TAO_Marshal_Any::append (CORBA::TypeCode_ptr,
TAO::traverse_status
TAO_Marshal_TypeCode::append (CORBA::TypeCode_ptr,
TAO_InputCDR *src,
- TAO_OutputCDR *dest
- )
+ TAO_OutputCDR *dest)
{
- CORBA::Boolean continue_append = 1;
+ CORBA::Boolean continue_append = true;
TAO::traverse_status retval =
TAO::TRAVERSE_CONTINUE;
CORBA::ULong kind;
@@ -166,9 +147,9 @@ TAO_Marshal_TypeCode::append (CORBA::TypeCode_ptr,
// use. However, also write it back into the destination
continue_append = (CORBA::Boolean) (src->read_ulong (kind)
? dest->write_ulong (kind)
- : 0);
+ : false);
- if (continue_append == 1)
+ if (continue_append == true)
{
// Typecodes with empty parameter lists all have preallocated
// constants. We use those to reduce memory consumption and
@@ -191,8 +172,7 @@ TAO_Marshal_TypeCode::append (CORBA::TypeCode_ptr,
retval =
TAO_Marshal_Object::perform_append (CORBA::_tc_long,
src,
- dest
- );
+ dest);
}
break;
@@ -203,8 +183,7 @@ TAO_Marshal_TypeCode::append (CORBA::TypeCode_ptr,
retval =
TAO_Marshal_Object::perform_append (CORBA::_tc_long,
src,
- dest
- );
+ dest);
}
break;
@@ -231,8 +210,7 @@ TAO_Marshal_TypeCode::append (CORBA::TypeCode_ptr,
retval =
TAO_Marshal_Object::perform_append (CORBA::_tc_OctetSeq,
src,
- dest
- );
+ dest);
}
} // end of switch
}
@@ -245,8 +223,7 @@ TAO_Marshal_TypeCode::append (CORBA::TypeCode_ptr,
ACE_TEXT ("Bad kind_ value in CDR stream\n")));
}
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::BAD_TYPECODE ();
}
}
@@ -261,31 +238,24 @@ TAO_Marshal_TypeCode::append (CORBA::TypeCode_ptr,
ACE_TEXT ("TAO_Marshal_TypeCode::append detected error\n")));
}
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
TAO::traverse_status
TAO_Marshal_Principal::append (CORBA::TypeCode_ptr,
TAO_InputCDR *src,
- TAO_OutputCDR *dest
- )
+ TAO_OutputCDR *dest)
{
// write the octet sequence representing the Principal
- return TAO_Marshal_Object::perform_append (CORBA::_tc_OctetSeq,
- src,
- dest
- );
+ return TAO_Marshal_Object::perform_append (CORBA::_tc_OctetSeq, src, dest);
}
TAO::traverse_status
TAO_Marshal_ObjRef::append (CORBA::TypeCode_ptr,
TAO_InputCDR *src,
- TAO_OutputCDR *dest
- )
+ TAO_OutputCDR *dest)
{
- CORBA::Boolean continue_append = 1;
+ CORBA::Boolean continue_append = true;
// First, append the type hint. This will be the type_id encoded in an
// object reference.
@@ -347,16 +317,13 @@ TAO_Marshal_ObjRef::append (CORBA::TypeCode_ptr,
ACE_TEXT ("TAO_Marshal_ObjRef::append detected error\n")
));
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
TAO::traverse_status
TAO_Marshal_Struct::append (CORBA::TypeCode_ptr tc,
TAO_InputCDR *src,
- TAO_OutputCDR *dest
- )
+ TAO_OutputCDR *dest)
{
TAO::traverse_status retval =
TAO::TRAVERSE_CONTINUE;
@@ -373,11 +340,7 @@ TAO_Marshal_Struct::append (CORBA::TypeCode_ptr tc,
// get member type
param = tc->member_type (i);
- retval =
- TAO_Marshal_Object::perform_append (param.in (),
- src,
- dest
- );
+ retval = TAO_Marshal_Object::perform_append (param.in (), src, dest);
}
if (retval == TAO::TRAVERSE_CONTINUE)
@@ -387,22 +350,17 @@ TAO_Marshal_Struct::append (CORBA::TypeCode_ptr tc,
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_Struct::append detected error\n")));
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
TAO::traverse_status
TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc,
TAO_InputCDR *src,
- TAO_OutputCDR *dest
- )
+ TAO_OutputCDR *dest)
{
- CORBA::TypeCode_var discrim_tc =
- tc->discriminator_type ();
+ CORBA::TypeCode_var discrim_tc = tc->discriminator_type ();
- CORBA::ULong kind =
- discrim_tc->kind ();
+ CORBA::ULong kind = discrim_tc->kind ();
// Save the discriminator value in a temporary variable...
CORBA::Short short_v = CORBA::Short();
@@ -496,8 +454,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc,
i < member_count && current_member == null_member;
++i)
{
- CORBA::Any_var any = tc->member_label (i
- );
+ CORBA::Any_var any = tc->member_label (i);
CORBA::Octet o;
@@ -507,8 +464,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc,
tc->default_index ();
if (i != default_index)
- ACE_THROW_RETURN (CORBA::BAD_TYPECODE (),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::BAD_TYPECODE ();
// Found the default branch, save its position and continue
// trying to find the current value...
default_member = i;
@@ -556,9 +512,12 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc,
if (impl->encoded ())
{
- TAO::Unknown_IDL_Type *unk =
+ TAO::Unknown_IDL_Type * const unk =
dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
+ if (!unk)
+ throw ::CORBA::INTERNAL ();
+
// We don't want unk's rd_ptr to move, in case
// we are shared by another Any, so we use this
// to copy the state, not the buffer.
@@ -621,8 +580,7 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc,
tc->member_type (default_member);
return TAO_Marshal_Object::perform_append (member_tc.in (),
src,
- dest
- );
+ dest);
}
// If we're here, we have an implicit default case, and we
@@ -643,10 +601,9 @@ TAO_Marshal_Union::append (CORBA::TypeCode_ptr tc,
TAO::traverse_status
TAO_Marshal_String::append (CORBA::TypeCode_ptr,
TAO_InputCDR *src,
- TAO_OutputCDR *dest
- )
+ TAO_OutputCDR *dest)
{
- CORBA::Boolean continue_append = 1;
+ CORBA::Boolean continue_append = true;
// On decode, omit the check against specified string bounds, and
// cope with illegal "zero length" strings (all lengths on the wire
@@ -664,16 +621,13 @@ TAO_Marshal_String::append (CORBA::TypeCode_ptr,
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_TypeCode::append detected error\n")));
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
TAO::traverse_status
TAO_Marshal_Sequence::append (CORBA::TypeCode_ptr tc,
TAO_InputCDR *src,
- TAO_OutputCDR *dest
- )
+ TAO_OutputCDR *dest)
{
// Size of element.
CORBA::ULong bounds;
@@ -693,8 +647,7 @@ TAO_Marshal_Sequence::append (CORBA::TypeCode_ptr tc,
LM_DEBUG,
ACE_TEXT ("TAO_Marshal_Sequence::append detected error\n")
));
- ACE_THROW_RETURN (CORBA::MARSHAL (),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL ();
}
if (bounds == 0)
@@ -880,15 +833,13 @@ TAO_Marshal_Sequence::append (CORBA::TypeCode_ptr tc,
ACE_TEXT ("marshaling TAO_Marshal_Sequence::append detected error\n")
));
- ACE_THROW_RETURN (CORBA::MARSHAL (),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL ();
}
TAO::traverse_status
TAO_Marshal_Array::append (CORBA::TypeCode_ptr tc,
TAO_InputCDR *src,
- TAO_OutputCDR *dest
- )
+ TAO_OutputCDR *dest)
{
// retrieve the bounds of the array
CORBA::ULong bounds = tc->length ();
@@ -1067,19 +1018,17 @@ TAO_Marshal_Array::append (CORBA::TypeCode_ptr tc,
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_Sequence::append detected error\n")));
- ACE_THROW_RETURN (CORBA::MARSHAL (),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL ();
}
TAO::traverse_status
TAO_Marshal_Alias::append (CORBA::TypeCode_ptr tc,
TAO_InputCDR *src,
- TAO_OutputCDR *dest
- )
+ TAO_OutputCDR *dest)
{
// Typecode of the aliased type.
CORBA::TypeCode_var tc2;
- CORBA::Boolean continue_append = 1;
+ CORBA::Boolean continue_append = true;
// Status of decode operation.
TAO::traverse_status retval =
@@ -1087,21 +1036,16 @@ TAO_Marshal_Alias::append (CORBA::TypeCode_ptr tc,
tc2 = tc->content_type ();
- retval = TAO_Marshal_Object::perform_append (tc2.in (),
- src,
- dest
- );
+ retval = TAO_Marshal_Object::perform_append (tc2.in (), src, dest);
if (retval == TAO::TRAVERSE_CONTINUE
- && continue_append == 1)
+ && continue_append == true)
return TAO::TRAVERSE_CONTINUE;
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_Alias::append detected error\n")));
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
// Decode exception For exceptions, the "hidden" type ID near the
@@ -1119,7 +1063,7 @@ TAO_Marshal_Except::append (CORBA::TypeCode_ptr tc,
{
TAO::traverse_status retval =
TAO::TRAVERSE_CONTINUE;
- CORBA::Boolean continue_append = 1;
+ CORBA::Boolean continue_append = true;
CORBA::TypeCode_var param;
// first append the RepositoryID
@@ -1139,8 +1083,7 @@ TAO_Marshal_Except::append (CORBA::TypeCode_ptr tc,
retval = TAO_Marshal_Object::perform_append (param.in (),
src,
- dest
- );
+ dest);
}
if (retval == TAO::TRAVERSE_CONTINUE
@@ -1151,9 +1094,7 @@ TAO_Marshal_Except::append (CORBA::TypeCode_ptr tc,
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_Except::append detected error\n")));
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
TAO::traverse_status
@@ -1162,7 +1103,7 @@ TAO_Marshal_WString::append (CORBA::TypeCode_ptr,
TAO_OutputCDR *dest
)
{
- CORBA::Boolean continue_append = 1;
+ CORBA::Boolean continue_append = true;
// On decode, omit the check against specified wstring bounds, and
// cope with illegal "zero length" strings (all lengths on the wire
@@ -1181,9 +1122,7 @@ TAO_Marshal_WString::append (CORBA::TypeCode_ptr,
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_WString::append detected error\n")));
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
TAO::traverse_status
@@ -1288,9 +1227,7 @@ TAO_Marshal_Value::append (CORBA::TypeCode_ptr tc,
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Marshal_Value::append detected error\n")));
- ACE_THROW_RETURN (CORBA::MARSHAL (0,
- CORBA::COMPLETED_MAYBE),
- TAO::TRAVERSE_STOP);
+ throw ::CORBA::MARSHAL (0, CORBA::COMPLETED_MAYBE);
}
TAO_END_VERSIONED_NAMESPACE_DECL