GUIResource_Factory.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   GUIResource_Factory.h
00006  *
00007  *  $Id: GUIResource_Factory.h 75462 2006-11-22 10:55:01Z johnnyw $
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     /**
00063      * Reclaim the reactor if allocated by this factory.
00064      * Please note that this call is NOT synchronized. Left to the
00065      * higher level versions to synchronize access.
00066      */
00067     virtual void reclaim_reactor (ACE_Reactor *);
00068 
00069   protected:
00070 
00071     /**
00072      * Create or return current reactor instance.
00073      * Please note that this call is NOT synchronized. Left to the
00074      * get_reactor to synchronize access.
00075      */
00076     virtual ACE_Reactor_Impl *reactor_impl (void) = 0;
00077 
00078   private:
00079 
00080     /**
00081      * Flag that is set to true if the reactor obtained from the
00082      * get_reactor() method is dynamically allocated.  If this flag is
00083      * set to true, then the reclaim_reactor() method with call the delete
00084      * operator on the given reactor.  This flag is necessary to make
00085      * sure that a reactor not allocated by the default resource factory
00086      * is not reclaimed by the default resource factory.  Such a
00087      * situation can occur when a resource factory derived from the
00088      * default one overrides the get_reactor() method but does not
00089      * override the reclaim_reactor() method.
00090      */
00091     bool dynamically_allocated_reactor_;
00092 
00093     /// for internal locking.
00094     TAO_SYNCH_MUTEX lock_;
00095   };
00096 }
00097 
00098 TAO_END_VERSIONED_NAMESPACE_DECL
00099 
00100 #include /**/ "ace/post.h"
00101 
00102 #endif  /* TAO_GUI_RESOURCE_FACTORY_H */

Generated on Tue Feb 2 17:37:52 2010 for TAO by  doxygen 1.4.7