00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file GUIResource_Factory.h 00006 * 00007 * GUIResource_Factory.h,v 1.6 2005/11/24 11:05:45 ossama Exp 00008 * 00009 * @author Balachandran Natarajan <bala@cs.wustl.edu> 00010 * @author Marek Brudka <mbrudka@aster.pl> 00011 */ 00012 //============================================================================= 00013 00014 #ifndef TAO_GUI_RESOURCE_FACTORY_H 00015 #define TAO_GUI_RESOURCE_FACTORY_H 00016 00017 #include /**/ "ace/pre.h" 00018 00019 #include "tao/TAO_Export.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #include "tao/orbconf.h" 00026 00027 #include "ace/Thread_Mutex.h" 00028 00029 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00030 class ACE_Reactor_Impl; 00031 class ACE_Reactor; 00032 ACE_END_VERSIONED_NAMESPACE_DECL 00033 00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00035 00036 namespace TAO 00037 { 00038 /** Abstract base class for the GUI resource factory. 00039 * 00040 * This base class for resource factories which provide 00041 * GUIReactors integrated with specific GUI 00042 * event loop. In general, children of this class reimplement 00043 * reactor_impl method where specific 00044 * GUIReactor is created. GUIResource_Factory are usually 00045 * created by GUIResource_Loader subclasses. 00046 * Children of this class will be held in TSS by the ORB Core. 00047 */ 00048 class TAO_Export GUIResource_Factory 00049 { 00050 public: 00051 00052 GUIResource_Factory (); 00053 00054 virtual ~GUIResource_Factory (); 00055 00056 /** Create ACE_Reactor using allocate_reactor_impl. 00057 * Please note that this call is NOT synchronized. Left to the 00058 * higher level versions to synchronize access. 00059 */ 00060 virtual ACE_Reactor *get_reactor (void) ; 00061 00062 /** Reclaim the reactor if allocated by this factory. 00063 * Please note that this call is NOT synchronized. Left to the 00064 * higher level versions to synchronize access. 00065 */ 00066 virtual void reclaim_reactor (ACE_Reactor *); 00067 00068 protected: 00069 00070 /** Create or return current reactor instance. 00071 * Please note that this call is NOT synchronized. Left to the 00072 * get_reactor to synchronize access. 00073 */ 00074 virtual ACE_Reactor_Impl *reactor_impl (void) = 0; 00075 00076 private: 00077 00078 /** 00079 * Flag that is set to 1 if the reactor obtained from the 00080 * get_reactor() method is dynamically allocated. If this flag is 00081 * set to 1, then the reclaim_reactor() method with call the delete 00082 * operator on the given reactor. This flag is necessary to make 00083 * sure that a reactor not allocated by the default resource factory 00084 * is not reclaimed by the default resource factory. Such a 00085 * situation can occur when a resource factory derived from the 00086 * default one overrides the get_reactor() method but does not 00087 * override the reclaim_reactor() method. 00088 */ 00089 int dynamically_allocated_reactor_; 00090 00091 /// for internal locking. 00092 TAO_SYNCH_MUTEX lock_; 00093 }; 00094 } 00095 00096 TAO_END_VERSIONED_NAMESPACE_DECL 00097 00098 #include /**/ "ace/post.h" 00099 00100 #endif /* TAO_GUI_RESOURCE_FACTORY_H */