Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / BiDir_GIOP / BiDir_ORBInitializer.cpp
blob66581bacfd74d2ac4f9a25d46c33f7a091b66b18
1 #include "tao/BiDir_GIOP/BiDir_ORBInitializer.h"
2 #include "tao/BiDir_GIOP/BiDir_PolicyFactory.h"
3 #include "tao/BiDir_GIOP/BiDirGIOP.h"
4 #include "tao/BiDir_GIOP/BiDir_Service_Context_Handler.h"
5 #include "tao/PI/ORBInitInfo.h"
7 #include "tao/ORB_Constants.h"
8 #include "tao/ORB_Core.h"
10 #include "ace/CORBA_macros.h"
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 void
15 TAO_BiDir_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr info)
17 // Narrow to a TAO_ORBInitInfo object to get access to the
18 // orb_core() TAO extension.
19 TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info);
21 if (CORBA::is_nil (tao_info.in ()))
23 if (TAO_debug_level > 0)
24 TAOLIB_ERROR ((LM_ERROR,
25 "(%P|%t) TAO_Bidir_ORBInitializer::pre_init:\n"
26 "(%P|%t) Unable to narrow "
27 "\"PortableInterceptor::ORBInitInfo_ptr\" to\n"
28 "(%P|%t) \"TAO_ORBInitInfo *.\"\n"));
30 throw ::CORBA::INTERNAL ();
33 // Bind the service context handler for BiDIR GIOP
34 TAO_BiDIR_Service_Context_Handler* h = nullptr;
35 ACE_NEW (h,
36 TAO_BiDIR_Service_Context_Handler());
37 tao_info->orb_core ()->service_context_registry ().bind (IOP::BI_DIR_IIOP, h);
40 void
41 TAO_BiDir_ORBInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info)
43 this->register_policy_factories (info);
46 void
47 TAO_BiDir_ORBInitializer::register_policy_factories (
48 PortableInterceptor::ORBInitInfo_ptr info)
50 /// Register the BiDir policy factories.
51 PortableInterceptor::PolicyFactory_ptr temp_factory =
52 PortableInterceptor::PolicyFactory_ptr ();
53 /// This policy factory is used for all BiDir related policies.
54 ACE_NEW_THROW_EX (temp_factory,
55 TAO_BiDir_PolicyFactory,
56 CORBA::NO_MEMORY (
57 CORBA::SystemException::_tao_minor_code (
58 TAO::VMCID,
59 ENOMEM),
60 CORBA::COMPLETED_NO));
62 PortableInterceptor::PolicyFactory_var policy_factory = temp_factory;
64 /// Bind the same policy factory to all BiDir related policy
65 /// types since a single policy factory is used to create each of
66 /// the different types of BiDir policies.
67 info->register_policy_factory (BiDirPolicy::BIDIRECTIONAL_POLICY_TYPE,
68 policy_factory.in ());
71 TAO_END_VERSIONED_NAMESPACE_DECL