Go to the documentation of this file.00001
00002
00003
00004 #include "tao/RTScheduling/RTScheduler_Loader.h"
00005 #include "tao/RTScheduling/RTScheduler_Initializer.h"
00006
00007 #include "tao/debug.h"
00008 #include "tao/ORB_Core.h"
00009 #include "tao/ORBInitializer_Registry.h"
00010
00011 ACE_RCSID (TAO, RTScheduler_Loader, "$Id: RTScheduler_Loader.cpp 90353 2010-05-31 08:42:46Z vzykov $")
00012
00013
00014 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00015
00016 TAO_RTScheduler_Loader::TAO_RTScheduler_Loader (void)
00017 : initialized_ (false)
00018 {
00019 }
00020
00021 TAO_RTScheduler_Loader::~TAO_RTScheduler_Loader (void)
00022 {
00023 }
00024
00025 int
00026 TAO_RTScheduler_Loader::init (int, ACE_TCHAR* [])
00027 {
00028 ACE_TRACE ("TAO_RTScheduler_Loader::init");
00029
00030 if (TAO_debug_level > 0)
00031 ACE_DEBUG ((LM_DEBUG,
00032 "In RTScheduler_Loader::init\n"));
00033
00034
00035 if (this->initialized_)
00036 return 0;
00037
00038 this->initialized_ = true;
00039
00040 ACE_Service_Gestalt *gestalt = ACE_Service_Config::current ();
00041
00042 ACE_Service_Object * const rts_loader =
00043 ACE_Dynamic_Service<ACE_Service_Object>::instance (
00044 gestalt,
00045 "RTScheduler_Loader",
00046 true);
00047
00048 if (rts_loader != 0 && rts_loader != this)
00049 {
00050 return rts_loader->init (0, 0);
00051 }
00052
00053
00054 try
00055 {
00056 PortableInterceptor::ORBInitializer_ptr temp_orb_initializer =
00057 PortableInterceptor::ORBInitializer::_nil ();
00058
00059
00060 ACE_NEW_THROW_EX (temp_orb_initializer,
00061 TAO_RTScheduler_ORB_Initializer,
00062 CORBA::NO_MEMORY (
00063 CORBA::SystemException::_tao_minor_code (
00064 TAO::VMCID,
00065 ENOMEM),
00066 CORBA::COMPLETED_NO));
00067
00068 PortableInterceptor::ORBInitializer_var orb_initializer =
00069 temp_orb_initializer;
00070
00071 PortableInterceptor::register_orb_initializer (orb_initializer.in ());
00072 }
00073 catch (const ::CORBA::Exception& ex)
00074 {
00075 ex._tao_print_exception (
00076 "Unexpected exception caught while initializing the RTScheduler:");
00077 return 1;
00078 }
00079
00080 return 0;
00081 }
00082
00083
00084
00085 ACE_FACTORY_DEFINE (TAO_RTScheduler, TAO_RTScheduler_Loader)
00086 ACE_STATIC_SVC_DEFINE (TAO_RTScheduler_Loader,
00087 ACE_TEXT ("RTScheduler_Loader"),
00088 ACE_SVC_OBJ_T,
00089 &ACE_SVC_NAME (TAO_RTScheduler_Loader),
00090 ACE_Service_Type::DELETE_THIS
00091 | ACE_Service_Type::DELETE_OBJ,
00092 0)
00093 TAO_END_VERSIONED_NAMESPACE_DECL