00001 // EC_Lifetime_Utils_T.cpp,v 1.5 2006/03/14 06:14:25 jtc Exp 00002 00003 #ifndef TAO_EC_LIFETIME_UTILS_T_CPP 00004 #define TAO_EC_LIFETIME_UTILS_T_CPP 00005 00006 #include "orbsvcs/Event/EC_Lifetime_Utils_T.h" 00007 00008 #if ! defined (__ACE_INLINE__) 00009 #include "orbsvcs/Event/EC_Lifetime_Utils_T.i" 00010 #endif /* __ACE_INLINE__ */ 00011 00012 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00013 00014 template <typename T> 00015 void 00016 activate (T & obj_ref, 00017 PortableServer::POA_ptr poa, 00018 PortableServer::ServantBase * servant, 00019 TAO_EC_Object_Deactivator & suggested_object_deactivator 00020 ACE_ENV_ARG_DECL) 00021 { 00022 // Activate the servant into the POA. 00023 PortableServer::ObjectId_var obj_id = 00024 poa->activate_object (servant 00025 ACE_ENV_ARG_PARAMETER); 00026 ACE_CHECK; 00027 00028 suggested_object_deactivator.set_values (poa, obj_id.in ()); 00029 00030 // Get the object reference of the activated object. 00031 CORBA::Object_var obj = 00032 poa->id_to_reference (obj_id.in () ACE_ENV_ARG_PARAMETER); 00033 ACE_CHECK; 00034 00035 // Don't try to use T::_obj_type::_narrow, some compilers don't like it so 00036 // do this in two steps 00037 typedef typename T::_obj_type my_object_type; 00038 00039 obj_ref = 00040 my_object_type::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); 00041 ACE_CHECK; 00042 00043 if (CORBA::is_nil (obj_ref.in ())) 00044 { 00045 ACE_THROW (CORBA::INTERNAL ()); 00046 } 00047 } 00048 00049 TAO_END_VERSIONED_NAMESPACE_DECL 00050 00051 #endif /* TAO_EC_LIFETIME_UTILS_T_CPP */