diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-31 21:31:31 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-31 21:31:31 +0000 |
commit | 2f2309ee3563885d800fd4a6282963018d91d6dd (patch) | |
tree | ef4faee4068367c4f7b203f702661b6319fb7162 /TAO/tao/CurrentC.cpp | |
parent | 50e750a14cf3494ba6c2fe1c133cb7faab2d0e1a (diff) | |
download | ATCD-2f2309ee3563885d800fd4a6282963018d91d6dd.tar.gz |
Changes corresponding to >>= and >> changes for interfaces in
generated code.
Diffstat (limited to 'TAO/tao/CurrentC.cpp')
-rw-r--r-- | TAO/tao/CurrentC.cpp | 78 |
1 files changed, 53 insertions, 25 deletions
diff --git a/TAO/tao/CurrentC.cpp b/TAO/tao/CurrentC.cpp index 67de2c2d57e..99896d27c38 100644 --- a/TAO/tao/CurrentC.cpp +++ b/TAO/tao/CurrentC.cpp @@ -38,28 +38,56 @@ CORBA_Current_ptr CORBA_Current::_narrow ( { if (CORBA::is_nil (obj)) return CORBA_Current::_nil (); - CORBA::Boolean check = - !obj->_is_a ("IDL:omg.org/CORBA/Current:1.0", ACE_TRY_ENV); - ACE_CHECK_RETURN (CORBA_Current::_nil ()); - if (check) + if (! obj->_is_local ()) + { + CORBA::Boolean is_a = obj->_is_a ("IDL:CORBA_Current:1.0", ACE_TRY_ENV); + ACE_CHECK_RETURN (CORBA_Current::_nil ()); + if (is_a == 0) + return CORBA_Current::_nil (); + } + return CORBA_Current::_unchecked_narrow (obj, ACE_TRY_ENV); +} + +CORBA_Current_ptr CORBA_Current::_unchecked_narrow ( + CORBA::Object_ptr obj, + CORBA::Environment & + ) +{ + if (CORBA::is_nil (obj)) return CORBA_Current::_nil (); - void *servant = 0; - if (!obj->_is_collocated () - || !obj->_servant() - || (servant = obj->_servant()->_downcast ("IDL:omg.org/CORBA/Current:1.0")) == 0 - ) - ACE_THROW_RETURN (CORBA::MARSHAL (), CORBA_Current::_nil ()); - CORBA_Current_ptr retval = CORBA_Current::_nil (); - ACE_NEW_RETURN ( - retval, - POA_CORBA::_tao_collocated_Current ( - ACE_reinterpret_cast (POA_CORBA::Current_ptr, - servant), - 0 - ), - CORBA_Current::_nil () - ); - return retval; + if (! obj->_is_local ()) + { + TAO_Stub* stub = obj->_stubobj (); + if (stub) + stub->_incr_refcnt (); + CORBA_Current_ptr default_proxy = CORBA_Current::_nil (); + + if (obj->_is_collocated () && _TAO_collocation_CORBA_Current_Stub_Factory_function_pointer != 0) + { + default_proxy = _TAO_collocation_CORBA_Current_Stub_Factory_function_pointer (obj); + } + if (CORBA::is_nil (default_proxy)) + ACE_NEW_RETURN (default_proxy, CORBA_Current (stub), CORBA_Current::_nil ()); + #if (TAO_HAS_SMART_PROXIES == 1) + return TAO_CORBA_Current_PROXY_FACTORY_ADAPTER::instance ()->create_proxy (default_proxy); + #else + return default_proxy; + #endif /*TAO_HAS_SMART_PROXIES == 1*/ + } + else + return + ACE_reinterpret_cast + ( + CORBA_Current_ptr, + obj->_tao_QueryInterface + ( + ACE_reinterpret_cast + ( + ptr_arith_t, + &CORBA_Current::_narrow + ) + ) + ); } CORBA_Current_ptr CORBA_Current::_nil (void) @@ -89,6 +117,9 @@ const char* CORBA_Current::_interface_repository_id (void) const return "IDL:omg.org/CORBA/Current:1.0"; } +CORBA_Current_ptr (*_TAO_collocation_CORBA_Current_Stub_Factory_function_pointer) ( + CORBA::Object_ptr obj + ) = 0; void operator<<= (CORBA::Any &_tao_any, CORBA::Current_ptr _tao_elem) { TAO_OutputCDR stream; @@ -117,11 +148,8 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, CORBA::Current_ptr &_tao _tao_any._tao_get_cdr (), _tao_any._tao_byte_order () ); - CORBA::Object_var _tao_obj_var; - if (stream >> _tao_obj_var.out ()) + if (stream >> _tao_elem) { - _tao_elem = CORBA::Current::_narrow (_tao_obj_var.in (), ACE_TRY_ENV); - ACE_TRY_CHECK; ((CORBA::Any *)&_tao_any)->_tao_replace ( CORBA::_tc_Current, 1, |