summaryrefslogtreecommitdiff
path: root/TAO/tao/BoundsC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/BoundsC.cpp')
-rw-r--r--TAO/tao/BoundsC.cpp59
1 files changed, 31 insertions, 28 deletions
diff --git a/TAO/tao/BoundsC.cpp b/TAO/tao/BoundsC.cpp
index fa7be70cea4..ac889a9ef50 100644
--- a/TAO/tao/BoundsC.cpp
+++ b/TAO/tao/BoundsC.cpp
@@ -25,6 +25,12 @@ CORBA_Bounds::~CORBA_Bounds (void)
{
}
+void CORBA_Bounds::_tao_any_destructor (void *x)
+{
+ CORBA_Bounds *tmp = ACE_static_cast (CORBA_Bounds*,x);
+ delete tmp;
+}
+
// copy constructor
CORBA_Bounds::CORBA_Bounds (const CORBA::Bounds &_tao_excp)
: CORBA_UserException (_tao_excp._type ())
@@ -86,33 +92,25 @@ CORBA::Exception *CORBA_Bounds::_alloc (void)
-void operator<<= (CORBA::Any &_tao_any, const CORBA::Bounds &_tao_elem) // copying
+void operator<<= (CORBA::Any &_tao_any, const CORBA::Bounds &_tao_elem)
{
- CORBA::Bounds *_tao_any_val = 0;
- ACE_NEW (_tao_any_val,
- CORBA::Bounds (_tao_elem));
- if (!_tao_any_val) return;
- ACE_TRY_NEW_ENV
- {
- _tao_any.replace (CORBA::_tc_Bounds, _tao_any_val, 1, ACE_TRY_ENV);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- delete _tao_any_val;
- }
- ACE_ENDTRY;
+ TAO_OutputCDR stream;
+ stream << _tao_elem;
+ _tao_any._tao_replace (CORBA::_tc_Bounds,
+ TAO_ENCAP_BYTE_ORDER,
+ stream.begin ());
}
void operator<<= (CORBA::Any &_tao_any, CORBA::Bounds *_tao_elem) // non copying
{
- ACE_TRY_NEW_ENV
- {
- _tao_any.replace (CORBA::_tc_Bounds, _tao_elem, 1, ACE_TRY_ENV); // consume it
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY {}
- ACE_ENDTRY;
+ TAO_OutputCDR stream;
+ stream << *_tao_elem;
+ _tao_any._tao_replace (CORBA::_tc_Bounds,
+ TAO_ENCAP_BYTE_ORDER,
+ stream.begin (),
+ 1,
+ _tao_elem,
+ CORBA::Bounds::_tao_any_destructor);
}
CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::Bounds *&_tao_elem)
@@ -130,24 +128,29 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::Bounds *&_tao_ele
else
{
ACE_NEW_RETURN (_tao_elem, CORBA::Bounds, 0);
- TAO_InputCDR stream (_tao_any._tao_get_cdr (),
- _tao_any._tao_byte_order ());
- if (stream.decode (CORBA::_tc_Bounds, _tao_elem, 0, ACE_TRY_ENV)
- == CORBA::TypeCode::TRAVERSE_CONTINUE)
+ TAO_InputCDR stream (
+ _tao_any._tao_get_cdr (),
+ _tao_any._tao_byte_order ());
+ if (stream >> *_tao_elem)
{
- ((CORBA::Any *)&_tao_any)->replace (CORBA::_tc_Bounds, _tao_elem, 1, ACE_TRY_ENV);
- ACE_TRY_CHECK;
+ ((CORBA::Any *)&_tao_any)->_tao_replace (
+ CORBA::_tc_Bounds,
+ 1,
+ ACE_reinterpret_cast (void*, _tao_elem),
+ CORBA::Bounds::_tao_any_destructor);
return 1;
}
else
{
delete _tao_elem;
+ _tao_elem = 0;
}
}
}
ACE_CATCHANY
{
delete _tao_elem;
+ _tao_elem = 0;
return 0;
}
ACE_ENDTRY;