summaryrefslogtreecommitdiff
path: root/TAO/tao/XtResource
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2006-07-14 21:10:15 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2006-07-14 21:10:15 +0000
commit0952ec7160609448a430a29289ae171d6ae2ef71 (patch)
treea36dbf7411c219f14c7bc18292aa5c04baf41927 /TAO/tao/XtResource
parent5788c1d71a4bdfa3653474df6d24d157d8de2ab6 (diff)
downloadATCD-0952ec7160609448a430a29289ae171d6ae2ef71.tar.gz
ChangeLogTag: Fri Jul 14 21:03:30 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/tao/XtResource')
-rw-r--r--TAO/tao/XtResource/TAO_XtResource_Export.h58
-rw-r--r--TAO/tao/XtResource/XtResource_Factory.cpp45
-rw-r--r--TAO/tao/XtResource/XtResource_Factory.h61
-rw-r--r--TAO/tao/XtResource/XtResource_Loader.cpp26
-rw-r--r--TAO/tao/XtResource/XtResource_Loader.h50
5 files changed, 240 insertions, 0 deletions
diff --git a/TAO/tao/XtResource/TAO_XtResource_Export.h b/TAO/tao/XtResource/TAO_XtResource_Export.h
new file mode 100644
index 00000000000..5cc41d8da11
--- /dev/null
+++ b/TAO/tao/XtResource/TAO_XtResource_Export.h
@@ -0,0 +1,58 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl -s TAO_XtResource
+// ------------------------------
+#ifndef TAO_XTRESOURCE_EXPORT_H
+#define TAO_XTRESOURCE_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_XTRESOURCE_HAS_DLL)
+# define TAO_XTRESOURCE_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && TAO_XTRESOURCE_HAS_DLL */
+
+#if !defined (TAO_XTRESOURCE_HAS_DLL)
+# define TAO_XTRESOURCE_HAS_DLL 1
+#endif /* ! TAO_XTRESOURCE_HAS_DLL */
+
+#if defined (TAO_XTRESOURCE_HAS_DLL) && (TAO_XTRESOURCE_HAS_DLL == 1)
+# if defined (TAO_XTRESOURCE_BUILD_DLL)
+# define TAO_XtResource_Export ACE_Proper_Export_Flag
+# define TAO_XTRESOURCE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_XTRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_XTRESOURCE_BUILD_DLL */
+# define TAO_XtResource_Export ACE_Proper_Import_Flag
+# define TAO_XTRESOURCE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_XTRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_XTRESOURCE_BUILD_DLL */
+#else /* TAO_XTRESOURCE_HAS_DLL == 1 */
+# define TAO_XtResource_Export
+# define TAO_XTRESOURCE_SINGLETON_DECLARATION(T)
+# define TAO_XTRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_XTRESOURCE_HAS_DLL == 1 */
+
+// Set TAO_XTRESOURCE_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TAO_XTRESOURCE_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TAO_XTRESOURCE_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TAO_XTRESOURCE_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TAO_XTRESOURCE_NTRACE */
+
+#if (TAO_XTRESOURCE_NTRACE == 1)
+# define TAO_XTRESOURCE_TRACE(X)
+#else /* (TAO_XTRESOURCE_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TAO_XTRESOURCE_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TAO_XTRESOURCE_NTRACE == 1) */
+
+#endif /* TAO_XTRESOURCE_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/XtResource/XtResource_Factory.cpp b/TAO/tao/XtResource/XtResource_Factory.cpp
new file mode 100644
index 00000000000..0bd2f417292
--- /dev/null
+++ b/TAO/tao/XtResource/XtResource_Factory.cpp
@@ -0,0 +1,45 @@
+//$Id$
+
+#include "tao/XtResource/XtResource_Factory.h"
+#include "tao/debug.h"
+#include "ace/XtReactor.h"
+
+ACE_RCSID( TAO_XtResource,
+ XtResource_Factory,
+ "$Id$");
+
+namespace TAO
+{
+
+ XtResource_Factory::XtResource_Factory (XtAppContext p_context):
+ reactor_impl_( 0 ),
+ context_( p_context )
+ {
+ }
+
+ ACE_Reactor_Impl *
+ XtResource_Factory::reactor_impl (void)
+ {
+ // synchronized by external locks
+ if (this->context_ == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT("TAO (%P|%t) - XtAppContext is undefined.")
+ ACE_TEXT(" Cannot create ACE_XtReactor \n")));
+ return 0;
+ }
+
+ if (!this->reactor_impl_)
+ {
+ ACE_NEW_RETURN (this->reactor_impl_,
+ ACE_XtReactor (this->context_),
+ 0);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - ACE_XtReactor created \n"));
+ }
+
+ return this->reactor_impl_;
+ }
+}
diff --git a/TAO/tao/XtResource/XtResource_Factory.h b/TAO/tao/XtResource/XtResource_Factory.h
new file mode 100644
index 00000000000..5099969e25c
--- /dev/null
+++ b/TAO/tao/XtResource/XtResource_Factory.h
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file XtResource_Factory.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ * @author Marek Brudka <mbrudka@aster.pl>
+ */
+//=============================================================================
+#ifndef TAO_XTRESOURCE_FACTORY_H
+#define TAO_XTRESOURCE_FACTORY_H
+#include /**/ "ace/pre.h"
+#include /**/ <X11/Intrinsic.h>
+#include "tao/XtResource/TAO_XtResource_Export.h"
+#include "ace/XtReactor.h"
+#include "tao/GUIResource_Factory.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+namespace TAO
+{
+
+ /**
+ * @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.
+ */
+
+ class TAO_XtResource_Export XtResource_Factory : public GUIResource_Factory
+ {
+ public:
+ XtResource_Factory (XtAppContext context);
+
+ /// Create or obtain current reactor implementation
+ virtual ACE_Reactor_Impl *reactor_impl (void);
+
+ private:
+
+ /// Reactor created by this factory.
+ ACE_XtReactor *reactor_impl_;
+
+ /// Xt context for XtReactor
+ XtAppContext context_;
+
+ /// for internal locking
+ TAO_SYNCH_MUTEX lock_;
+ };
+}
+
+#include /**/ "ace/post.h"
+#endif /* TAO_XTRESOURCE_FACTORY_H */
diff --git a/TAO/tao/XtResource/XtResource_Loader.cpp b/TAO/tao/XtResource/XtResource_Loader.cpp
new file mode 100644
index 00000000000..fb24c916b04
--- /dev/null
+++ b/TAO/tao/XtResource/XtResource_Loader.cpp
@@ -0,0 +1,26 @@
+//$Id$
+#include "tao/XtResource/XtResource_Loader.h"
+#include "tao/ORB_Core.h"
+#include "tao/XtResource/XtResource_Factory.h"
+
+ACE_RCSID( TAO_XtResource,
+ XtResource_Loader,
+ "$Id$");
+
+namespace TAO
+{
+
+ XtResource_Loader::XtResource_Loader (XtAppContext context)
+ {
+ XtResource_Factory *tmp = 0;
+
+ ACE_NEW (tmp,
+ XtResource_Factory (context));
+
+ TAO_ORB_Core::set_gui_resource_factory( tmp );
+ }
+
+ XtResource_Loader::~XtResource_Loader ()
+ {
+ }
+}
diff --git a/TAO/tao/XtResource/XtResource_Loader.h b/TAO/tao/XtResource/XtResource_Loader.h
new file mode 100644
index 00000000000..37fe91406a2
--- /dev/null
+++ b/TAO/tao/XtResource/XtResource_Loader.h
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file XtResource_Loader.h
+ *
+ * $Id$
+ *
+ * @author Marek Brudka <mbrudka@aster.pl>
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_XTRESOURCE_LOADER_H
+#define TAO_XTRESOURCE_LOADER_H
+#include /**/ "ace/pre.h"
+#include /**/ <X11/Intrinsic.h>
+#include "tao/XtResource/TAO_XtResource_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+namespace TAO
+{
+ /**
+ * @class XtResource_Loader
+ *
+ * @brief Loads TAO resources related with Xt.
+ *
+ * This class changes the default reactor implementation into
+ * ACE_XtReactor one by calling TAO_ORB_Core::set_gui_resource_factory.
+ * User should create an instance of this class before ORB_init
+ * when the TAO server has has to be integrated within Xt event loop.
+ *
+ * Please notice, this class has to be created in the main Xt thread,
+ * because set_gui_resource_factory creates a variable in TSS. This way
+ * XtReactor is instantiated only in Xt event loop thread.
+ */
+ class TAO_XtResource_Export XtResource_Loader
+ {
+
+ public:
+ XtResource_Loader (XtAppContext context);
+
+ virtual ~XtResource_Loader ();
+ };
+}
+#include /**/ "ace/post.h"
+#endif /* TAO_XTRESOURCE_LOADER_H */