From 77ee6b9e340ca3f46e3c214eb98d14961cb4f906 Mon Sep 17 00:00:00 2001 From: bala Date: Fri, 21 Jan 2005 19:14:26 +0000 Subject: *** empty log message *** --- TAO/tao/ORB_Core.cpp | 15 ++++++++------ TAO/tao/QtResource.mpc | 4 ++++ TAO/tao/QtResource_Factory.cpp | 47 ++++++++++++++++++++++-------------------- TAO/tao/QtResource_Factory.h | 25 ++++++++++++---------- TAO/tao/QtResource_Loader.cpp | 13 ++++++++---- TAO/tao/QtResource_Loader.h | 32 ++++++++++++++++++---------- TAO/tao/XtResource_Factory.h | 21 ++++++++++++------- 7 files changed, 96 insertions(+), 61 deletions(-) diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 4948f0b8f1d..52400658b08 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -1225,15 +1225,18 @@ TAO_ORB_Core::set_resource_factory (const char *resource_factory_name) void TAO_ORB_Core::set_gui_resource_factory (TAO::GUIResource_Factory *gui_resource_factory) { + // @@Marek, I would as well like this to be stored in per-orb TSS + // instead of globasl TSS. Please see TAO_ORB_Core_TSS_Resources in + // ORB_Core.h for details. if (TAO_TSS_RESOURCES::instance ()->gui_resource_factory_ != 0) - { - ACE_DEBUG ((LM_WARNING, - "TAO (%P|%t) - Deleting old gui_resource_factory.\n")); - delete TAO_TSS_RESOURCES::instance ()->gui_resource_factory_; - } + { - TAO_TSS_RESOURCES::instance ()->gui_resource_factory_ = gui_resource_factory; + ACE_DEBUG ((LM_WARNING, + "TAO (%P|%t) - Deleting old gui_resource_factory.\n")); + delete TAO_TSS_RESOURCES::instance ()->gui_resource_factory_; + } + TAO_TSS_RESOURCES::instance ()->gui_resource_factory_ = gui_resource_factory; } void diff --git a/TAO/tao/QtResource.mpc b/TAO/tao/QtResource.mpc index 4f3a42a61eb..801422a9219 100644 --- a/TAO/tao/QtResource.mpc +++ b/TAO/tao/QtResource.mpc @@ -1,11 +1,15 @@ project(TAO_QtResource) : acelib, taolib, taoversion, core, tao_output, taodefaults, ace_qtreactor { + sharedname = TAO_QtResource + dynamicflags += TAO_QTRESOURCE_BUILD_DLL + Header_Files { QtResource_Factory.h QtResource_Loader.h TAO_QtResource_Export.h } + Source_Files(TAO_COMPONENTS) { Default_Resources { QtResource_Factory.cpp diff --git a/TAO/tao/QtResource_Factory.cpp b/TAO/tao/QtResource_Factory.cpp index dd42ac5517b..dd61a937acf 100644 --- a/TAO/tao/QtResource_Factory.cpp +++ b/TAO/tao/QtResource_Factory.cpp @@ -1,18 +1,19 @@ //$Id$ -#include /**/ "QtResource_Factory.h" -#include /**/ "debug.h" -#include /**/ "ace/QtReactor.h" -#include /**/ +#include "QtResource_Factory.h" +#include "debug.h" +#include "ace/QtReactor.h" -ACE_RCSID(tao, QtResource_Factory, "$Id$"); +ACE_RCSID(TAO_QtResource, + QtResource_Factory, + "$Id$"); namespace TAO { - QtResource_Factory::QtResource_Factory ( QApplication *qapp ): - reactor_impl_( 0 ), - qapp_( qapp ) + QtResource_Factory::QtResource_Factory (QApplication *qapp) + : reactor_impl_ (0) + , qapp_ (qapp) { } @@ -20,23 +21,25 @@ namespace TAO QtResource_Factory::reactor_impl (void) { if (this->qapp_ == 0) - { - ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) - QApplication is undefined. Cannot create ACE_XtReactor \n")); - return 0; - } - + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - QApplication is undefined.", + " Cannot create ACE_XtReactor \n")); + return 0; + } + + // @@Marek, do we need a lock here?? if (!this->reactor_impl_) - { + { - ACE_NEW_RETURN (this->reactor_impl_, - ACE_QtReactor (qapp_), - 0); + ACE_NEW_RETURN (this->reactor_impl_, + ACE_QtReactor (qapp_), + 0); - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - ACE_QtReactor created \n")); - } + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - ACE_QtReactor created\n")); + } return this->reactor_impl_; } diff --git a/TAO/tao/QtResource_Factory.h b/TAO/tao/QtResource_Factory.h index 7b8b6379f66..7fe55dd87ab 100644 --- a/TAO/tao/QtResource_Factory.h +++ b/TAO/tao/QtResource_Factory.h @@ -6,30 +6,32 @@ * * $Id$ * - * @author Balachandran Natarajan + * @author Balachandran Natarajan * @author Marek Brudka */ //============================================================================= -#ifndef _TAO_QTRESOURCE_FACTORY_H -#define _TAO_QTRESOURCE_FACTORY_H +#ifndef TAO_QTRESOURCE_FACTORY_H +#define TAO_QTRESOURCE_FACTORY_H #include /**/ "ace/pre.h" -#include /**/ -#include /**/ "ace/QtReactor.h" -#include /**/ "TAO_QtResource_Export.h" -#include /**/ "GUIResource_Factory.h" + +#include "tao/TAO_QtResource_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include +#include "tao/GUIResource_Factory.h" + namespace TAO { /** TAO_GUI_Resource_Factory for creating QtReactor. * - * This factory is intended for creating QtReactor for ORB. This factory can be - * feed into ORB using TAO_ORB_Core::set_gui_resource_factory method which is - * usually done by TAO_QtResource_Loader. + * This factory is intended for creating QtReactor for ORB. This + * factory can be feed into ORB using + * TAO_ORB_Core::set_gui_resource_factory method which is usually + * done by TAO_QtResource_Loader. */ class TAO_QtResource_Export QtResource_Factory : public GUIResource_Factory { @@ -43,10 +45,11 @@ namespace TAO /// Reactor created by this factory. ACE_QtReactor *reactor_impl_; + /// QApplication running reactor QApplication *qapp_; }; } #include /**/ "ace/post.h" -#endif /* _TAO_QTRESOURCE_FACTORY_H */ +#endif /* TAO_QTRESOURCE_FACTORY_H */ diff --git a/TAO/tao/QtResource_Loader.cpp b/TAO/tao/QtResource_Loader.cpp index 54ea6f6283f..92ca04f29a2 100644 --- a/TAO/tao/QtResource_Loader.cpp +++ b/TAO/tao/QtResource_Loader.cpp @@ -5,14 +5,19 @@ ACE_RCSID(tao, QtResource_Loader, "$Id$"); -namespace TAO { - +namespace TAO +{ QtResource_Loader::QtResource_Loader (QApplication *qapp) { - TAO_ORB_Core::set_gui_resource_factory( new QtResource_Factory (qapp) ); + QtResource_Factory *tmp = 0; + + ACE_NEW (tmp, + QtResource_Factory (qapp)); + + TAO_ORB_Core::set_gui_resource_factory (tmp); } - QtResource_Loader::~QtResource_Loader () + QtResource_Loader::~QtResource_Loader (void) { } } diff --git a/TAO/tao/QtResource_Loader.h b/TAO/tao/QtResource_Loader.h index ab10e354c5f..6d461084645 100644 --- a/TAO/tao/QtResource_Loader.h +++ b/TAO/tao/QtResource_Loader.h @@ -11,32 +11,42 @@ */ //============================================================================= -#ifndef _TAO_QTRESOURCE_LOADER_H -#define _TAO_QTRESOURCE_LOADER_H +#ifndef TAO_QTRESOURCE_LOADER_H +#define TAO_QTRESOURCE_LOADER_H #include /**/ "ace/pre.h" -#include /**/ -#include /**/ "TAO_QtResource_Export.h" + +#include "TAO_QtResource_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include + namespace TAO { - /** Loads TAO resources related with Qt. + /** + * @class QtResource_Loader + * + * @brief Loads TAO resources related with Qt. * - * This class changes the default reactor implementation into ACE_QtReactor by - * calling TAO_ORB_Core::set_gui_resource_factory. Please notice, this class has - * to be created in the main Qt thread, because set_gui_resource_factory creates - * a variable in TSS. This way QtReactor is instantiated only in Qt event loop thread. + * This class changes the default reactor implementation into + * ACE_QtReactor by calling + * TAO_ORB_Core::set_gui_resource_factory. Please notice, this class + * has to be created in the main Qt thread, because + * set_gui_resource_factory creates a variable in TSS. This way + * QtReactor is instantiated only in Qt event loop thread. * + * @@Marek, could you please point out that this class is the + * interface to the user to load things */ + class TAO_QtResource_Export QtResource_Loader { - public: QtResource_Loader (QApplication *qapp); - virtual ~QtResource_Loader (); + + virtual ~QtResource_Loader (void); }; } #include /**/ "ace/post.h" diff --git a/TAO/tao/XtResource_Factory.h b/TAO/tao/XtResource_Factory.h index 20e2223c805..051429485b9 100644 --- a/TAO/tao/XtResource_Factory.h +++ b/TAO/tao/XtResource_Factory.h @@ -13,22 +13,29 @@ #ifndef TAO_XTRESOURCE_FACTORY_H #define TAO_XTRESOURCE_FACTORY_H #include /**/ "ace/pre.h" -#include /**/ "ace/XtReactor.h" -#include /**/ "TAO_XtResource_Export.h" -#include /**/ "GUIResource_Factory.h" + +#include "TAO_XtResource_Export.h" + #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/XtReactor.h" +#include "tao/GUIResource_Factory.h" + namespace TAO { - /** TAO_GUI_Resource_Factory for creating XtReactor. + /** + * @class XtResource_Factory + * + * @brief TAO_GUI_Resource_Factory for creating XtReactor. * - * This factory is intended for creating XtReactor for ORB. This factory can be - * feed into ORB using TAO_ORB_Core::set_gui_resource_factory method which is - * usually done by TAO_XtResource_Loader. + * This factory is intended for creating XtReactor for ORB. This + * factory can be feed into ORB using + * TAO_ORB_Core::set_gui_resource_factory method which is usually + * done by TAO_XtResource_Loader. */ class TAO_XtResource_Export XtResource_Factory : public GUIResource_Factory { -- cgit v1.2.1