Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tao / PI / PI.cpp
blob319c44c812a8cf6b77d58393162dac64ff114ac3
1 #include "tao/PI/PI.h"
2 #include "tao/PI/ORBInitializer_Registry_Impl.h"
3 #include "tao/PI/PolicyFactory_Loader.h"
4 #include "tao/PI/ClientRequestInterceptor_Factory_Impl.h"
5 #include "tao/PI/PICurrent_Loader.h"
6 #include "tao/PI/PI_ORBInitializer.h"
7 #include "tao/ORBInitializer_Registry.h"
8 #include "tao/ORB_Constants.h"
9 #include "ace/CORBA_macros.h"
11 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 // This initializer is very similar to the ORBInitializer_Registry::init.
15 // This one is used during static initialization while the other is used
16 // when PI is a shared library.
17 int
18 TAO_PI_Init::Initializer ()
20 #if TAO_HAS_INTERCEPTORS == 1
21 ACE_Service_Config::process_directive (ace_svc_desc_TAO_ClientRequestInterceptor_Adapter_Factory_Impl);
23 ACE_Service_Config::process_directive (ace_svc_desc_TAO_PICurrent_Loader);
24 #endif /* TAO_HAS_INTERCEPTORS == 1 */
26 int const status = ACE_Service_Config::process_directive (
27 ace_svc_desc_ORBInitializer_Registry);
29 #if TAO_HAS_INTERCEPTORS == 1
30 PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
31 PortableInterceptor::ORBInitializer::_nil ();
33 PortableInterceptor::ORBInitializer_var orb_initializer;
35 try
37 /// Register the PI ORBInitializer.
38 ACE_NEW_THROW_EX (temp_orb_initializer,
39 TAO_PI_ORBInitializer,
40 CORBA::NO_MEMORY (
41 CORBA::SystemException::_tao_minor_code (
42 TAO::VMCID,
43 ENOMEM),
44 CORBA::COMPLETED_NO));
46 orb_initializer = temp_orb_initializer;
48 PortableInterceptor::register_orb_initializer (orb_initializer.in ());
50 catch (const ::CORBA::Exception& ex)
52 if (TAO_debug_level > 0)
54 ex._tao_print_exception ("(%P | %t) Caught exception:");
56 return -1;
58 #endif /* TAO_HAS_INTERCEPTORS == 1 */
59 return status;
62 TAO_END_VERSIONED_NAMESPACE_DECL