summaryrefslogtreecommitdiff
path: root/TAO/tao/GUIResource_Factory.h
diff options
context:
space:
mode:
authormbrudka <mbrudka@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-01-23 01:30:32 +0000
committermbrudka <mbrudka@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-01-23 01:30:32 +0000
commit64a8b101a6c5d47987892a0129c148a38fca17be (patch)
treef1a11a2cbf2feca71b9ff15288a392aa4efae06e /TAO/tao/GUIResource_Factory.h
parent2e0c262596bbc80570d7a9f4f2ec773d71958e2d (diff)
downloadATCD-64a8b101a6c5d47987892a0129c148a38fca17be.tar.gz
ChangeLogTag: Sun Jan 23 01:54:59 2005 Marek Brudka <mbrudka@aster.pl>
Diffstat (limited to 'TAO/tao/GUIResource_Factory.h')
-rw-r--r--TAO/tao/GUIResource_Factory.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/TAO/tao/GUIResource_Factory.h b/TAO/tao/GUIResource_Factory.h
new file mode 100644
index 00000000000..e10a3770497
--- /dev/null
+++ b/TAO/tao/GUIResource_Factory.h
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file GUI_Resource_Factory.h
+ *
+ * $Id$
+ *
+ * @author Balachandran Natarajan <bala@cs.wustl.edu>
+ * @author Marek Brudka <mbrudka@aster.pl>
+ */
+//=============================================================================
+
+#ifndef TAO_GUI_RESOURCE_FACTORY_H
+#define TAO_GUI_RESOURCE_FACTORY_H
+#include /**/ "ace/pre.h"
+#include "ace/Thread_Mutex.h"
+#include "tao/TAO_Export.h"
+#include "tao/orbconf.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+//forwards
+class ACE_Reactor_Impl;
+class ACE_Reactor;
+
+namespace TAO
+{
+ /** Abstract base class for the GUI resource factory.
+ *
+ * This base class for resource factories which provide
+ * GUIReactors integrated with specific GUI
+ * event loop. In general, children of this class reimplement
+ * reactor_impl method where specific
+ * GUIReactor is created. GUIResource_Factory are usually
+ * created by GUIResource_Loader subclasses.
+ * Children of this class will be held in TSS by the ORB Core.
+ */
+ class TAO_Export GUIResource_Factory
+ {
+ public:
+
+ GUIResource_Factory ();
+
+ virtual ~GUIResource_Factory ();
+
+ /** Create ACE_Reactor using allocate_reactor_impl.
+ * Please note that this call is NOT synchronized. Left to the
+ * higher level versions to synchronize access.
+ */
+ virtual ACE_Reactor *get_reactor (void) ;
+
+ /** Reclaim the reactor if allocated by this factory.
+ * Please note that this call is NOT synchronized. Left to the
+ * higher level versions to synchronize access.
+ */
+ virtual void reclaim_reactor (ACE_Reactor *);
+
+ protected:
+
+ /** Create or return current reactor instance.
+ * Please note that this call is NOT synchronized. Left to the
+ * get_reactor to synchronize access.
+ */
+ virtual ACE_Reactor_Impl *reactor_impl (void) = 0;
+
+ private:
+
+ /**
+ * Flag that is set to 1 if the reactor obtained from the
+ * get_reactor() method is dynamically allocated. If this flag is
+ * set to 1, then the reclaim_reactor() method with call the delete
+ * operator on the given reactor. This flag is necessary to make
+ * sure that a reactor not allocated by the default resource factory
+ * is not reclaimed by the default resource factory. Such a
+ * situation can occur when a resource factory derived from the
+ * default one overrides the get_reactor() method but does not
+ * override the reclaim_reactor() method.
+ */
+ int dynamically_allocated_reactor_;
+
+ /// for internal locking.
+ TAO_SYNCH_MUTEX lock_;
+ };
+}
+
+#include /**/ "ace/post.h"
+#endif /*TAO_GUI_RESOURCE_FACTORY_H*/