diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:21 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:21 +0000 |
commit | 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (patch) | |
tree | 197c810e5f5bce17b1233a7cb8d7b50c0bcd25e2 /TAO/tao/GUIResource_Factory.h | |
parent | 6b846cf03c0bcbd8c276cb0af61a181e5f98eaae (diff) | |
download | ATCD-3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c.tar.gz |
Repo restructuring
Diffstat (limited to 'TAO/tao/GUIResource_Factory.h')
-rw-r--r-- | TAO/tao/GUIResource_Factory.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/TAO/tao/GUIResource_Factory.h b/TAO/tao/GUIResource_Factory.h new file mode 100644 index 00000000000..134f8bfa88a --- /dev/null +++ b/TAO/tao/GUIResource_Factory.h @@ -0,0 +1,100 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file GUIResource_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 "tao/TAO_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/orbconf.h" + +#include "ace/Thread_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Reactor_Impl; +class ACE_Reactor; +ACE_END_VERSIONED_NAMESPACE_DECL + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +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_; + }; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* TAO_GUI_RESOURCE_FACTORY_H */ |