00001 //$Id: QtResource_Factory.cpp 84443 2009-02-12 20:26:35Z johnnyw $ 00002 00003 #include "tao/QtResource/QtResource_Factory.h" 00004 #include "tao/debug.h" 00005 #include "ace/QtReactor/QtReactor.h" 00006 00007 ACE_RCSID (TAO_QtResource, 00008 QtResource_Factory, 00009 "$Id: QtResource_Factory.cpp 84443 2009-02-12 20:26:35Z johnnyw $"); 00010 00011 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00012 00013 namespace TAO 00014 { 00015 QtResource_Factory::QtResource_Factory (QApplication *qapp) 00016 : reactor_impl_ (0) 00017 , qapp_ (qapp) 00018 { 00019 } 00020 00021 ACE_Reactor_Impl * 00022 QtResource_Factory::reactor_impl (void) 00023 { // synchronized by external locks 00024 if (this->qapp_ == 0) 00025 { 00026 ACE_ERROR ((LM_ERROR, 00027 "TAO (%P|%t) - QApplication is undefined.", 00028 " Cannot create ACE_QtReactor\n")); 00029 return 0; 00030 } 00031 00032 if (!this->reactor_impl_) 00033 { 00034 ACE_NEW_RETURN (this->reactor_impl_, 00035 ACE_QtReactor (qapp_), 00036 0); 00037 00038 if (TAO_debug_level > 0) 00039 ACE_DEBUG ((LM_DEBUG, 00040 "TAO (%P|%t) - ACE_QtReactor created\n")); 00041 } 00042 00043 return this->reactor_impl_; 00044 } 00045 } 00046 00047 TAO_END_VERSIONED_NAMESPACE_DECL