diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-04 22:06:28 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-04 22:06:28 +0000 |
commit | 39f0fcf7adfdb5ff13fd3eafb3b50f9ec1acdf20 (patch) | |
tree | 0c4ca75ac23941e33b44b7452639bff045e60083 /TAO/tao/PolicyC.cpp | |
parent | 4e82ac5196541812ddac587b95546cf5d339ca7e (diff) | |
download | ATCD-39f0fcf7adfdb5ff13fd3eafb3b50f9ec1acdf20.tar.gz |
Replaced all Any operators and added missing Any and CDR operators.
Diffstat (limited to 'TAO/tao/PolicyC.cpp')
-rw-r--r-- | TAO/tao/PolicyC.cpp | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/TAO/tao/PolicyC.cpp b/TAO/tao/PolicyC.cpp index 6b5e328854e..8454e32b9ef 100644 --- a/TAO/tao/PolicyC.cpp +++ b/TAO/tao/PolicyC.cpp @@ -1414,6 +1414,168 @@ operator>> ( return 0; } +void operator<<= (CORBA::Any &_tao_any, CORBA::PolicyManager_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::PolicyManager::_duplicate (_tao_elem); + TAO_OutputCDR stream; + if (stream << *_tao_obj_ptr) + { + _tao_any._tao_replace ( + CORBA::_tc_PolicyManager, + TAO_ENCAP_BYTE_ORDER, + stream.begin (), + 1, + _tao_obj_ptr, + ACE_TRY_ENV + ); + ACE_TRY_CHECK; + } + else + { + delete _tao_obj_ptr; + } + } + ACE_CATCHANY + { + delete _tao_obj_ptr; + } + ACE_ENDTRY; +} + +CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::PolicyManager_ptr &_tao_elem) +{ + CORBA::Object_ptr *tmp = 0; + ACE_NEW_RETURN (tmp, CORBA::Object_ptr, 0); + ACE_TRY_NEW_ENV + { + _tao_elem = CORBA::PolicyManager::_nil (); + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equivalent (CORBA::_tc_PolicyManager, 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 () + ); + CORBA::Object_var _tao_obj_var; + if (stream >> _tao_obj_var.out ()) + { + _tao_elem = CORBA::PolicyManager::_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)->_tao_replace ( + CORBA::_tc_PolicyManager, + 1, + tmp, + ACE_TRY_ENV + ); + ACE_TRY_CHECK; + return 1; + } + else // failure + { + delete tmp; + } + } + ACE_CATCHANY + { + delete tmp; + _tao_elem = CORBA::PolicyManager::_nil (); + return 0; + } + ACE_ENDTRY; + _tao_elem = CORBA::PolicyManager::_nil (); + return 0; +} + +void operator<<= (CORBA::Any &_tao_any, CORBA::PolicyCurrent_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::PolicyCurrent::_duplicate (_tao_elem); + TAO_OutputCDR stream; + if (stream << *_tao_obj_ptr) + { + _tao_any._tao_replace ( + CORBA::_tc_PolicyCurrent, + TAO_ENCAP_BYTE_ORDER, + stream.begin (), + 1, + _tao_obj_ptr, + ACE_TRY_ENV + ); + ACE_TRY_CHECK; + } + else + { + delete _tao_obj_ptr; + } + } + ACE_CATCHANY + { + delete _tao_obj_ptr; + } + ACE_ENDTRY; +} + +CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::PolicyCurrent_ptr &_tao_elem) +{ + CORBA::Object_ptr *tmp = 0; + ACE_NEW_RETURN (tmp, CORBA::Object_ptr, 0); + ACE_TRY_NEW_ENV + { + _tao_elem = CORBA::PolicyCurrent::_nil (); + CORBA::TypeCode_var type = _tao_any.type (); + if (!type->equivalent (CORBA::_tc_PolicyCurrent, 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 () + ); + CORBA::Object_var _tao_obj_var; + if (stream >> _tao_obj_var.out ()) + { + _tao_elem = CORBA::PolicyCurrent::_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)->_tao_replace ( + CORBA::_tc_PolicyCurrent, + 1, + tmp, + ACE_TRY_ENV + ); + ACE_TRY_CHECK; + return 1; + } + else // failure + { + delete tmp; + } + } + ACE_CATCHANY + { + delete tmp; + _tao_elem = CORBA::PolicyCurrent::_nil (); + return 0; + } + ACE_ENDTRY; + _tao_elem = CORBA::PolicyCurrent::_nil (); + return 0; +} + // **************************************************************** #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) |