Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / RTScheduling / RTScheduler_Loader.cpp
blob32e15c526860727eba6126ecb7f5753700154146
1 #include "tao/RTScheduling/RTScheduler_Loader.h"
2 #include "tao/RTScheduling/RTScheduler_Initializer.h"
4 #include "tao/debug.h"
5 #include "tao/ORB_Core.h"
6 #include "tao/ORBInitializer_Registry.h"
8 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
10 TAO_RTScheduler_Loader::TAO_RTScheduler_Loader ()
11 : initialized_ (false)
15 TAO_RTScheduler_Loader::~TAO_RTScheduler_Loader ()
19 int
20 TAO_RTScheduler_Loader::init (int, ACE_TCHAR* [])
22 ACE_TRACE ("TAO_RTScheduler_Loader::init");
24 if (TAO_debug_level > 0)
25 TAOLIB_DEBUG ((LM_DEBUG,
26 "In RTScheduler_Loader::init\n"));
28 // Only allow initialization once.
29 if (this->initialized_)
30 return 0;
32 this->initialized_ = true;
34 ACE_Service_Gestalt *gestalt = ACE_Service_Config::current ();
36 ACE_Service_Object * const rts_loader =
37 ACE_Dynamic_Service<ACE_Service_Object>::instance (
38 gestalt,
39 "RTScheduler_Loader",
40 true);
42 if (rts_loader != 0 && rts_loader != this)
44 return rts_loader->init (0, 0);
47 // Register the ORB initializer.
48 try
50 PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
51 PortableInterceptor::ORBInitializer::_nil ();
53 /// Register the RTCORBA ORBInitializer.
54 ACE_NEW_THROW_EX (temp_orb_initializer,
55 TAO_RTScheduler_ORB_Initializer,
56 CORBA::NO_MEMORY (
57 CORBA::SystemException::_tao_minor_code (
58 TAO::VMCID,
59 ENOMEM),
60 CORBA::COMPLETED_NO));
62 PortableInterceptor::ORBInitializer_var orb_initializer =
63 temp_orb_initializer;
65 PortableInterceptor::register_orb_initializer (orb_initializer.in ());
67 catch (const ::CORBA::Exception& ex)
69 ex._tao_print_exception (
70 "Unexpected exception caught while initializing the RTScheduler:");
71 return 1;
74 return 0;
77 /////////////////////////////////////////////////////////////////////
79 ACE_FACTORY_DEFINE (TAO_RTScheduler, TAO_RTScheduler_Loader)
80 ACE_STATIC_SVC_DEFINE (TAO_RTScheduler_Loader,
81 ACE_TEXT ("RTScheduler_Loader"),
82 ACE_SVC_OBJ_T,
83 &ACE_SVC_NAME (TAO_RTScheduler_Loader),
84 ACE_Service_Type::DELETE_THIS
85 | ACE_Service_Type::DELETE_OBJ,
87 TAO_END_VERSIONED_NAMESPACE_DECL