summaryrefslogtreecommitdiff
path: root/TAO/tao/TkResource
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:21 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2006-07-24 15:50:21 +0000
commit3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (patch)
tree197c810e5f5bce17b1233a7cb8d7b50c0bcd25e2 /TAO/tao/TkResource
parent6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (diff)
downloadATCD-3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c.tar.gz
Repo restructuring
Diffstat (limited to 'TAO/tao/TkResource')
-rw-r--r--TAO/tao/TkResource/TAO_TkResource_Export.h58
-rw-r--r--TAO/tao/TkResource/TkResource_Factory.cpp41
-rw-r--r--TAO/tao/TkResource/TkResource_Factory.h64
-rw-r--r--TAO/tao/TkResource/TkResource_Loader.cpp31
-rw-r--r--TAO/tao/TkResource/TkResource_Loader.h60
5 files changed, 254 insertions, 0 deletions
diff --git a/TAO/tao/TkResource/TAO_TkResource_Export.h b/TAO/tao/TkResource/TAO_TkResource_Export.h
new file mode 100644
index 00000000000..34904a6d9af
--- /dev/null
+++ b/TAO/tao/TkResource/TAO_TkResource_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_TkResource
+// ------------------------------
+#ifndef TAO_TKRESOURCE_EXPORT_H
+#define TAO_TKRESOURCE_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if defined (ACE_AS_STATIC_LIBS) && !defined (TAO_TKRESOURCE_HAS_DLL)
+# define TAO_TKRESOURCE_HAS_DLL 0
+#endif /* ACE_AS_STATIC_LIBS && TAO_TKRESOURCE_HAS_DLL */
+
+#if !defined (TAO_TKRESOURCE_HAS_DLL)
+# define TAO_TKRESOURCE_HAS_DLL 1
+#endif /* ! TAO_TKRESOURCE_HAS_DLL */
+
+#if defined (TAO_TKRESOURCE_HAS_DLL) && (TAO_TKRESOURCE_HAS_DLL == 1)
+# if defined (TAO_TKRESOURCE_BUILD_DLL)
+# define TAO_TkResource_Export ACE_Proper_Export_Flag
+# define TAO_TKRESOURCE_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TAO_TKRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TAO_TKRESOURCE_BUILD_DLL */
+# define TAO_TkResource_Export ACE_Proper_Import_Flag
+# define TAO_TKRESOURCE_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TAO_TKRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TAO_TKRESOURCE_BUILD_DLL */
+#else /* TAO_TKRESOURCE_HAS_DLL == 1 */
+# define TAO_TkResource_Export
+# define TAO_TKRESOURCE_SINGLETON_DECLARATION(T)
+# define TAO_TKRESOURCE_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TAO_TKRESOURCE_HAS_DLL == 1 */
+
+// Set TAO_TKRESOURCE_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TAO_TKRESOURCE_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TAO_TKRESOURCE_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TAO_TKRESOURCE_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TAO_TKRESOURCE_NTRACE */
+
+#if (TAO_TKRESOURCE_NTRACE == 1)
+# define TAO_TKRESOURCE_TRACE(X)
+#else /* (TAO_TKRESOURCE_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TAO_TKRESOURCE_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TAO_TKRESOURCE_NTRACE == 1) */
+
+#endif /* TAO_TKRESOURCE_EXPORT_H */
+
+// End of auto generated file.
diff --git a/TAO/tao/TkResource/TkResource_Factory.cpp b/TAO/tao/TkResource/TkResource_Factory.cpp
new file mode 100644
index 00000000000..622a0fb45cf
--- /dev/null
+++ b/TAO/tao/TkResource/TkResource_Factory.cpp
@@ -0,0 +1,41 @@
+//$Id$
+
+#include "tao/TkResource/TkResource_Factory.h"
+#include "tao/debug.h"
+#include "ace/TkReactor.h"
+
+ACE_RCSID( TAO_TkResource,
+ TkResource_Factory,
+ "$Id$");
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ TkResource_Factory::TkResource_Factory (void)
+ : reactor_impl_ (0)
+ {
+ }
+
+ ACE_Reactor_Impl *
+ TkResource_Factory::reactor_impl (void)
+ {
+ // synchronized by external locks
+ if (!this->reactor_impl_)
+ {
+ ACE_NEW_RETURN (this->reactor_impl_,
+ ACE_TkReactor (),
+ 0);
+
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - ACE_TkReactor created \n"));
+ }
+
+ return this->reactor_impl_;
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TkResource/TkResource_Factory.h b/TAO/tao/TkResource/TkResource_Factory.h
new file mode 100644
index 00000000000..f4aab08db60
--- /dev/null
+++ b/TAO/tao/TkResource/TkResource_Factory.h
@@ -0,0 +1,64 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TkResource_Factory.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ * @author Marek Brudka <mbrudka@aster.pl>
+ */
+//=============================================================================
+#ifndef TAO_TKRESOURCE_FACTORY_H
+#define TAO_TKRESOURCE_FACTORY_H
+#include /**/ "ace/pre.h"
+#include "ace/TkReactor.h"
+#include "tao/TkResource/TAO_TkResource_Export.h"
+#include "tao/GUIResource_Factory.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ /**
+ * @class TkResource_Factory
+ *
+ * @brief TAO_GUI_Resource_Factory for creating TkReactor.
+ *
+ * This factory is intended for creating TkReactor for ORB. This
+ * factory can be feed into ORB using
+ * TAO_ORB_Core::set_gui_resource_factory method which is usually
+ * done by TAO_TkResource_Loader.
+ */
+
+ class TAO_TkResource_Export TkResource_Factory : public GUIResource_Factory
+ {
+ public:
+
+ TkResource_Factory ();
+
+ protected:
+
+ /// Create or obtain current reactor implementation
+ virtual ACE_Reactor_Impl *reactor_impl (void);
+
+ private:
+
+ /// Reactor created by this factory.
+ ACE_TkReactor *reactor_impl_;
+
+ /// for internal locking.
+ TAO_SYNCH_MUTEX lock_;
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+#endif /* TAO_TKRESOURCE_FACTORY_H */
diff --git a/TAO/tao/TkResource/TkResource_Loader.cpp b/TAO/tao/TkResource/TkResource_Loader.cpp
new file mode 100644
index 00000000000..cbe8fb79681
--- /dev/null
+++ b/TAO/tao/TkResource/TkResource_Loader.cpp
@@ -0,0 +1,31 @@
+//$Id$
+#include "tao/TkResource/TkResource_Loader.h"
+#include "tao/ORB_Core.h"
+#include "tao/TkResource/TkResource_Factory.h"
+
+ACE_RCSID( TAO_TkResource,
+ TkResource_Loader,
+ "$Id$");
+
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ TkResource_Loader::TkResource_Loader (void)
+ {
+ TkResource_Factory *tmp = 0;
+
+ ACE_NEW (tmp,
+ TkResource_Factory ());
+
+ TAO_ORB_Core::set_gui_resource_factory( tmp );
+ }
+
+ TkResource_Loader::~TkResource_Loader (void)
+ {
+ }
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/TkResource/TkResource_Loader.h b/TAO/tao/TkResource/TkResource_Loader.h
new file mode 100644
index 00000000000..bdd3daeb0d2
--- /dev/null
+++ b/TAO/tao/TkResource/TkResource_Loader.h
@@ -0,0 +1,60 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file TkResource_Loader.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ * @author Marek Brudka <mbrudka@aster.pl>
+ */
+//=============================================================================
+
+#ifndef TAO_TKRESOURCE_LOADER_H
+#define TAO_TKRESOURCE_LOADER_H
+
+#include /**/ "ace/pre.h"
+
+#include "tao/TkResource/TAO_TkResource_Export.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "tao/Versioned_Namespace.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ /**
+ * @class TkResource_Loader
+ *
+ * @brief Loads TAO resources related with Tk.
+ *
+ * This class changes the default reactor implementation into
+ * ACE_TkReactor 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 Tk event loop.
+ *
+ * Please notice, this class has to be created in the main Tk thread,
+ * because set_gui_resource_factory creates a variable in TSS. This way
+ * TkReactor is instantiated only in Tk event loop thread.
+ */
+ class TAO_TkResource_Export TkResource_Loader
+ {
+ public:
+
+ TkResource_Loader (void);
+
+ virtual ~TkResource_Loader (void);
+
+ };
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#include /**/ "ace/post.h"
+
+#endif /* TAO_TKRESOURCE_LOADER_H */