summaryrefslogtreecommitdiff
path: root/TAO/tao/DomainC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/DomainC.cpp')
-rw-r--r--TAO/tao/DomainC.cpp248
1 files changed, 200 insertions, 48 deletions
diff --git a/TAO/tao/DomainC.cpp b/TAO/tao/DomainC.cpp
index a44fef530c2..643350c3bcf 100644
--- a/TAO/tao/DomainC.cpp
+++ b/TAO/tao/DomainC.cpp
@@ -339,15 +339,30 @@ CORBA_DomainManagerList::CORBA_DomainManagerList (const CORBA_DomainManagerList
CORBA_DomainManagerList::~CORBA_DomainManagerList (void) // dtor
{}
-void operator<<= (CORBA::Any &_tao_any, CORBA_DomainManager_ptr _tao_elem)
+void operator<<= (CORBA::Any &_tao_any, CORBA::DomainManager_ptr _tao_elem)
{
CORBA::Object_ptr *_tao_obj_ptr = 0;
ACE_TRY_NEW_ENV
{
ACE_NEW (_tao_obj_ptr, CORBA::Object_ptr);
- *_tao_obj_ptr = CORBA_DomainManager::_duplicate (_tao_elem);
- _tao_any.replace (CORBA::_tc_DomainManager, _tao_obj_ptr, 1, ACE_TRY_ENV);
- ACE_TRY_CHECK;
+ *_tao_obj_ptr = CORBA::DomainManager::_duplicate (_tao_elem);
+ TAO_OutputCDR stream;
+ if (stream << *_tao_obj_ptr)
+ {
+ _tao_any._tao_replace (
+ CORBA::_tc_DomainManager,
+ TAO_ENCAP_BYTE_ORDER,
+ stream.begin (),
+ 1,
+ _tao_obj_ptr,
+ ACE_TRY_ENV
+ );
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ delete _tao_obj_ptr;
+ }
}
ACE_CATCHANY
{
@@ -356,37 +371,52 @@ void operator<<= (CORBA::Any &_tao_any, CORBA_DomainManager_ptr _tao_elem)
ACE_ENDTRY;
}
-CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA_DomainManager_ptr &_tao_elem)
+CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::DomainManager_ptr &_tao_elem)
{
CORBA::Object_ptr *tmp = 0;
+ ACE_NEW_RETURN (tmp, CORBA::Object_ptr, 0);
ACE_TRY_NEW_ENV
{
- _tao_elem = CORBA_DomainManager::_nil ();
+ _tao_elem = CORBA::DomainManager::_nil ();
CORBA::TypeCode_var type = _tao_any.type ();
- if (!type->equal (CORBA::_tc_DomainManager, ACE_TRY_ENV)) return 0; // not equal
+ if (!type->equivalent (CORBA::_tc_DomainManager, ACE_TRY_ENV)) // not equal
+ {
+ delete tmp;
+ return 0;
+ }
ACE_TRY_CHECK;
- TAO_InputCDR stream (_tao_any._tao_get_cdr (),
- _tao_any._tao_byte_order ());
+ TAO_InputCDR stream (
+ _tao_any._tao_get_cdr (),
+ _tao_any._tao_byte_order ()
+ );
CORBA::Object_var _tao_obj_var;
- ACE_NEW_RETURN (tmp, CORBA::Object_ptr, 0);
- if (stream.decode (CORBA::_tc_DomainManager, &_tao_obj_var.out (), 0, ACE_TRY_ENV)
- == CORBA::TypeCode::TRAVERSE_CONTINUE)
+ if (stream >> _tao_obj_var.out ())
{
- _tao_elem = CORBA_DomainManager::_narrow (_tao_obj_var.in (), ACE_TRY_ENV);
+ _tao_elem = CORBA::DomainManager::_narrow (_tao_obj_var.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
*tmp = (CORBA::Object_ptr) _tao_elem; // any owns the object
- ((CORBA::Any *)&_tao_any)->replace (CORBA::_tc_DomainManager, tmp, 1, ACE_TRY_ENV);
+ ((CORBA::Any *)&_tao_any)->_tao_replace (
+ CORBA::_tc_DomainManager,
+ 1,
+ tmp,
+ ACE_TRY_ENV
+ );
ACE_TRY_CHECK;
return 1;
}
- // failure
+ else // failure
+ {
+ delete tmp;
+ }
}
ACE_CATCHANY
{
delete tmp;
+ _tao_elem = CORBA::DomainManager::_nil ();
return 0;
}
ACE_ENDTRY;
+ _tao_elem = CORBA::DomainManager::_nil ();
return 0;
}
@@ -402,15 +432,30 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA_DomainManager_ptr
#if ! defined (TAO_HAS_MINIMUM_CORBA)
-void operator<<= (CORBA::Any &_tao_any, CORBA_ConstructionPolicy_ptr _tao_elem)
+void operator<<= (CORBA::Any &_tao_any, CORBA::ConstructionPolicy_ptr _tao_elem)
{
CORBA::Object_ptr *_tao_obj_ptr = 0;
ACE_TRY_NEW_ENV
{
ACE_NEW (_tao_obj_ptr, CORBA::Object_ptr);
- *_tao_obj_ptr = CORBA_ConstructionPolicy::_duplicate (_tao_elem);
- _tao_any.replace (CORBA::_tc_ConstructionPolicy, _tao_obj_ptr, 1, ACE_TRY_ENV);
- ACE_TRY_CHECK;
+ *_tao_obj_ptr = CORBA::ConstructionPolicy::_duplicate (_tao_elem);
+ TAO_OutputCDR stream;
+ if (stream << *_tao_obj_ptr)
+ {
+ _tao_any._tao_replace (
+ CORBA::_tc_ConstructionPolicy,
+ TAO_ENCAP_BYTE_ORDER,
+ stream.begin (),
+ 1,
+ _tao_obj_ptr,
+ ACE_TRY_ENV
+ );
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ delete _tao_obj_ptr;
+ }
}
ACE_CATCHANY
{
@@ -419,37 +464,52 @@ void operator<<= (CORBA::Any &_tao_any, CORBA_ConstructionPolicy_ptr _tao_elem)
ACE_ENDTRY;
}
-CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA_ConstructionPolicy_ptr &_tao_elem)
+CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::ConstructionPolicy_ptr &_tao_elem)
{
CORBA::Object_ptr *tmp = 0;
+ ACE_NEW_RETURN (tmp, CORBA::Object_ptr, 0);
ACE_TRY_NEW_ENV
{
- _tao_elem = CORBA_ConstructionPolicy::_nil ();
+ _tao_elem = CORBA::ConstructionPolicy::_nil ();
CORBA::TypeCode_var type = _tao_any.type ();
- if (!type->equal (CORBA::_tc_ConstructionPolicy, ACE_TRY_ENV)) return 0; // not equal
+ if (!type->equivalent (CORBA::_tc_ConstructionPolicy, ACE_TRY_ENV)) // not equal
+ {
+ delete tmp;
+ return 0;
+ }
ACE_TRY_CHECK;
- TAO_InputCDR stream (_tao_any._tao_get_cdr (),
- _tao_any._tao_byte_order ());
+ TAO_InputCDR stream (
+ _tao_any._tao_get_cdr (),
+ _tao_any._tao_byte_order ()
+ );
CORBA::Object_var _tao_obj_var;
- ACE_NEW_RETURN (tmp, CORBA::Object_ptr, 0);
- if (stream.decode (CORBA::_tc_ConstructionPolicy, &_tao_obj_var.out (), 0, ACE_TRY_ENV)
- == CORBA::TypeCode::TRAVERSE_CONTINUE)
+ if (stream >> _tao_obj_var.out ())
{
- _tao_elem = CORBA_ConstructionPolicy::_narrow (_tao_obj_var.in (), ACE_TRY_ENV);
+ _tao_elem = CORBA::ConstructionPolicy::_narrow (_tao_obj_var.in (), ACE_TRY_ENV);
ACE_TRY_CHECK;
*tmp = (CORBA::Object_ptr) _tao_elem; // any owns the object
- ((CORBA::Any *)&_tao_any)->replace (CORBA::_tc_ConstructionPolicy, tmp, 1, ACE_TRY_ENV);
+ ((CORBA::Any *)&_tao_any)->_tao_replace (
+ CORBA::_tc_ConstructionPolicy,
+ 1,
+ tmp,
+ ACE_TRY_ENV
+ );
ACE_TRY_CHECK;
return 1;
}
- // failure
+ else // failure
+ {
+ delete tmp;
+ }
}
ACE_CATCHANY
{
delete tmp;
+ _tao_elem = CORBA::ConstructionPolicy::_nil ();
return 0;
}
ACE_ENDTRY;
+ _tao_elem = CORBA::ConstructionPolicy::_nil ();
return 0;
}
@@ -464,16 +524,31 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA_ConstructionPolicy
void operator<<= (
CORBA::Any &_tao_any,
- const CORBA_DomainManagerList &_tao_elem
+ const CORBA::DomainManagerList &_tao_elem
) // copying
{
- CORBA_DomainManagerList *_tao_any_val;
- ACE_NEW (_tao_any_val, CORBA_DomainManagerList (_tao_elem));
+ CORBA::DomainManagerList *_tao_any_val;
+ ACE_NEW (_tao_any_val, CORBA::DomainManagerList (_tao_elem));
if (!_tao_any_val) return;
ACE_TRY_NEW_ENV
{
- _tao_any.replace (CORBA::_tc_DomainManagerList, _tao_any_val, 1, ACE_TRY_ENV); // copy the value
- ACE_TRY_CHECK;
+ TAO_OutputCDR stream;
+ if (stream << *_tao_any_val)
+ {
+ _tao_any._tao_replace (
+ CORBA::_tc_DomainManagerList,
+ TAO_ENCAP_BYTE_ORDER,
+ stream.begin (),
+ 1,
+ _tao_any_val,
+ ACE_TRY_ENV
+ );
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ delete _tao_any_val;
+ }
}
ACE_CATCHANY
{
@@ -482,52 +557,129 @@ void operator<<= (
ACE_ENDTRY;
}
-void operator<<= (CORBA::Any &_tao_any, CORBA_DomainManagerList *_tao_elem) // non copying
+void operator<<= (CORBA::Any &_tao_any, CORBA::DomainManagerList *_tao_elem) // non copying
{
ACE_TRY_NEW_ENV
{
- _tao_any.replace (CORBA::_tc_DomainManagerList, _tao_elem, 0, ACE_TRY_ENV);
+ TAO_OutputCDR stream;
+ stream << *_tao_elem;
+ _tao_any._tao_replace (
+ CORBA::_tc_DomainManagerList,
+ TAO_ENCAP_BYTE_ORDER,
+ stream.begin (),
+ 1,
+ _tao_elem,
+ ACE_TRY_ENV
+ );
ACE_TRY_CHECK;
}
- ACE_CATCHANY {}
+ ACE_CATCHANY
+ {
+ delete _tao_elem;
+ _tao_elem = 0;
+ }
ACE_ENDTRY;
}
-CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA_DomainManagerList *&_tao_elem)
+CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::DomainManagerList *&_tao_elem)
{
ACE_TRY_NEW_ENV
{
CORBA::TypeCode_var type = _tao_any.type ();
- if (!type->equal (CORBA::_tc_DomainManagerList, ACE_TRY_ENV)) return 0; // not equal
+ if (!type->equivalent (CORBA::_tc_DomainManagerList, ACE_TRY_ENV)) // not equal
+ {
+ _tao_elem = 0;
+ return 0;
+ }
ACE_TRY_CHECK;
if (_tao_any.any_owns_data ())
{
- _tao_elem = (CORBA_DomainManagerList *)_tao_any.value ();
+ _tao_elem = (CORBA::DomainManagerList *)_tao_any.value ();
return 1;
}
else
{
- ACE_NEW_RETURN (_tao_elem, CORBA_DomainManagerList, 0);
- TAO_InputCDR stream (_tao_any._tao_get_cdr (),
- _tao_any._tao_byte_order ());
- if (stream.decode (CORBA::_tc_DomainManagerList, _tao_elem, 0, ACE_TRY_ENV)
- == CORBA::TypeCode::TRAVERSE_CONTINUE)
+ ACE_NEW_RETURN (_tao_elem, CORBA::DomainManagerList, 0);
+ TAO_InputCDR stream (
+ _tao_any._tao_get_cdr (),
+ _tao_any._tao_byte_order ()
+ );
+ if (stream >> *_tao_elem)
{
- ((CORBA::Any *)&_tao_any)->replace (CORBA::_tc_DomainManagerList, _tao_elem, 1, ACE_TRY_ENV);
+ ((CORBA::Any *)&_tao_any)->_tao_replace (
+ CORBA::_tc_DomainManagerList,
+ 1,
+ ACE_reinterpret_cast (void *, _tao_elem),
+ ACE_TRY_ENV
+ );
ACE_TRY_CHECK;
return 1;
}
else
{
delete _tao_elem;
+ _tao_elem = 0;
}
}
}
ACE_CATCHANY
{
delete _tao_elem;
- return 0;
+ _tao_elem = 0;
+ return 0;
+ }
+ ACE_ENDTRY;
+ return 0;
+}
+
+CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, const CORBA::DomainManagerList *&_tao_elem)
+{
+ ACE_TRY_NEW_ENV
+ {
+ CORBA::TypeCode_var type = _tao_any.type ();
+ if (!type->equivalent (CORBA::_tc_DomainManagerList, ACE_TRY_ENV)) // not equal
+ {
+ _tao_elem = 0;
+ return 0;
+ }
+ ACE_TRY_CHECK;
+ if (_tao_any.any_owns_data ())
+ {
+ _tao_elem = (CORBA::DomainManagerList *)_tao_any.value ();
+ return 1;
+ }
+ else
+ {
+ ACE_NEW_RETURN (_tao_elem, CORBA::DomainManagerList, 0);
+ TAO_InputCDR stream (
+ _tao_any._tao_get_cdr (),
+ _tao_any._tao_byte_order ()
+ );
+ if (stream >> *(CORBA::DomainManagerList *)_tao_elem)
+ {
+ ((CORBA::Any *)&_tao_any)->_tao_replace (
+ CORBA::_tc_DomainManagerList,
+ 1,
+ ACE_reinterpret_cast (void *, ACE_const_cast (CORBA::DomainManagerList *&, _tao_elem)),
+ ACE_TRY_ENV
+ );
+ ACE_TRY_CHECK;
+ return 1;
+ }
+ else
+ {
+ delete ACE_const_cast (CORBA::DomainManagerList *&, _tao_elem);
+ _tao_elem = 0;
+ }
+ }
+ }
+ ACE_CATCHANY
+ {
+ delete ACE_const_cast (CORBA::DomainManagerList *&, _tao_elem);
+ _tao_elem = 0;
+ return 0;
}
ACE_ENDTRY;
return 0;
}
+