1 #ifndef TAO_OBJECT_T_CPP
2 #define TAO_OBJECT_T_CPP
4 #include "tao/Object_T.h"
5 #include "tao/Object.h"
7 #include "tao/SystemException.h"
8 #include "ace/CORBA_macros.h"
10 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
16 Narrow_Utils
<T
>::narrow (CORBA::Object_ptr obj
,
19 if (CORBA::is_nil (obj
))
24 if (!obj
->_is_a (repo_id
))
29 return TAO::Narrow_Utils
<T
>::unchecked_narrow (obj
);
32 template<typename T
> T
*
33 Narrow_Utils
<T
>::unchecked_narrow (CORBA::Object_ptr obj
)
35 if (CORBA::is_nil (obj
))
40 if (obj
->_is_local ())
42 return T::_duplicate (dynamic_cast<T
*> (obj
));
45 T_ptr proxy
= T::_nil ();
48 proxy
= Narrow_Utils
<T
>::lazy_evaluation (obj
);
50 if (CORBA::is_nil (proxy
))
52 TAO_Stub
* stub
= obj
->_stubobj ();
56 stub
->_incr_refcnt ();
58 bool const collocated
=
59 !CORBA::is_nil (stub
->servant_orb_var ().in ())
60 && stub
->optimize_collocation_objects ()
61 && obj
->_is_collocated ();
63 ACE_NEW_RETURN (proxy
,
71 catch (const CORBA::Exception
&)
73 // Swallow the exception
82 Narrow_Utils
<T
>::lazy_evaluation (CORBA::Object_ptr obj
)
84 T_ptr default_proxy
= T::_nil ();
86 // Code for lazily evaluated IORs.
87 if (!obj
->is_evaluated ())
89 ACE_NEW_RETURN (default_proxy
,
99 TAO_END_VERSIONED_NAMESPACE_DECL
101 #endif /* TAO_OBJECT_T_CPP */