diff options
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/Object_T.cpp | 49 | ||||
-rw-r--r-- | TAO/tao/Object_T.h | 12 | ||||
-rw-r--r-- | TAO/tao/Valuetype/AbstractBase_T.cpp | 50 | ||||
-rw-r--r-- | TAO/tao/Valuetype/AbstractBase_T.h | 5 |
4 files changed, 96 insertions, 20 deletions
diff --git a/TAO/tao/Object_T.cpp b/TAO/tao/Object_T.cpp index c44bdc66fea..a5f43a350b6 100644 --- a/TAO/tao/Object_T.cpp +++ b/TAO/tao/Object_T.cpp @@ -32,15 +32,45 @@ namespace TAO return T::_nil (); } - return TAO::Narrow_Utils<T>::unchecked_narrow (obj, pbf); + return TAO::Narrow_Utils<T>::unchecked_narrow (obj, + repo_id, + pbf + ACE_ENV_ARG_PARAMETER); } - - template<typename T> - T * + template<typename T> T * Narrow_Utils<T>::unchecked_narrow (CORBA::Object_ptr obj, Proxy_Broker_Factory pbf) { + ACE_DECLARE_NEW_CORBA_ENV; + + T *proxy = 0; + ACE_TRY + { + proxy = + TAO::Narrow_Utils<T>::unchecked_narrow (obj, + 0, + pbf + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + // Swallow the exception + return 0; + } + ACE_ENDTRY; + ACE_CHECK; + + return proxy; + } + + template<typename T> T * + Narrow_Utils<T>::unchecked_narrow (CORBA::Object_ptr obj, + const char *, + Proxy_Broker_Factory pbf + ACE_ENV_ARG_DECL) + { if (CORBA::is_nil (obj)) { return T::_nil (); @@ -66,12 +96,11 @@ namespace TAO && obj->_is_collocated () && pbf != 0; - ACE_NEW_RETURN (proxy, - T (stub, - collocated ? 1 : 0, - obj->_servant ()), - T::_nil ()); - + ACE_NEW_THROW_EX (proxy, + T (stub, + collocated ? 1 : 0, + obj->_servant ()), + CORBA::NO_MEMORY ()); return proxy; } diff --git a/TAO/tao/Object_T.h b/TAO/tao/Object_T.h index fac970d3fe1..7a8eb17414b 100644 --- a/TAO/tao/Object_T.h +++ b/TAO/tao/Object_T.h @@ -32,7 +32,7 @@ namespace TAO { class Collocation_Proxy_Broker; - typedef + typedef Collocation_Proxy_Broker * (* Proxy_Broker_Factory)(CORBA::Object_ptr); template<typename T> @@ -51,11 +51,17 @@ namespace TAO Proxy_Broker_Factory ACE_ENV_ARG_DECL); + // Version used the operators. static T_ptr unchecked_narrow (CORBA::Object_ptr, Proxy_Broker_Factory); - static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr, - Proxy_Broker_Factory); + static T_ptr unchecked_narrow (CORBA::Object_ptr, + const char *repo_id, + Proxy_Broker_Factory + ACE_ENV_ARG_DECL); + + // static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr, + // Proxy_Broker_Factory); private: // Code for lazily evaluated IORs. static T_ptr lazy_evaluation (CORBA::Object_ptr); diff --git a/TAO/tao/Valuetype/AbstractBase_T.cpp b/TAO/tao/Valuetype/AbstractBase_T.cpp index 10ed1cbde41..4c48bbb13a8 100644 --- a/TAO/tao/Valuetype/AbstractBase_T.cpp +++ b/TAO/tao/Valuetype/AbstractBase_T.cpp @@ -35,8 +35,11 @@ namespace TAO return T::_nil (); } - return AbstractBase_Narrow_Utils<T>::unchecked_narrow (obj, - pbf); + return + AbstractBase_Narrow_Utils<T>::unchecked_narrow (obj, + repo_id, + pbf + ACE_ENV_ARG_PARAMETER); } template<typename T> T * @@ -44,6 +47,39 @@ namespace TAO CORBA::AbstractBase_ptr obj, Proxy_Broker_Factory pbf) { + T *proxy = 0; + + ACE_DECLARE_NEW_CORBA_ENV; + + ACE_TRY + { + proxy = + AbstractBase_Narrow_Utils<T>::unchecked_narrow ( + obj, + 0, + pbf + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + } + ACE_CATCHANY + { + // Consume and return proxy + return proxy; + } + ACE_ENDTRY; + ACE_CHECK; + + return proxy; + } + + template<typename T> T * + AbstractBase_Narrow_Utils<T>::unchecked_narrow ( + CORBA::AbstractBase_ptr obj, + const char *, + Proxy_Broker_Factory pbf + ACE_ENV_ARG_DECL) + { if (CORBA::is_nil (obj)) { return T::_nil (); @@ -61,11 +97,11 @@ namespace TAO && obj->_is_collocated () && pbf != 0; - ACE_NEW_RETURN (proxy, - T (obj->_stubobj (), - collocated ? 1 : 0, - obj->_servant ()), - T::_nil ()); + ACE_NEW_THROW_EX (proxy, + T (obj->_stubobj (), + collocated ? 1 : 0, + obj->_servant ()), + CORBA::NO_MEMORY ()); } else { diff --git a/TAO/tao/Valuetype/AbstractBase_T.h b/TAO/tao/Valuetype/AbstractBase_T.h index d592a8a32f5..e7ec925f828 100644 --- a/TAO/tao/Valuetype/AbstractBase_T.h +++ b/TAO/tao/Valuetype/AbstractBase_T.h @@ -41,6 +41,11 @@ namespace TAO static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr, Proxy_Broker_Factory); + + static T_ptr unchecked_narrow (CORBA::AbstractBase_ptr, + const char *repo_id, + Proxy_Broker_Factory + ACE_ENV_ARG_DECL); }; } |