Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / GUIResource_Factory.h
blob2add83bc66067fd224fe5e1ff13bdc373667398e
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file GUIResource_Factory.h
7 * @author Balachandran Natarajan <bala@cs.wustl.edu>
8 * @author Marek Brudka <mbrudka@aster.pl>
9 */
10 //=============================================================================
12 #ifndef TAO_GUI_RESOURCE_FACTORY_H
13 #define TAO_GUI_RESOURCE_FACTORY_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "tao/TAO_Export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "tao/orbconf.h"
25 #include "ace/Thread_Mutex.h"
27 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
28 class ACE_Reactor_Impl;
29 class ACE_Reactor;
30 ACE_END_VERSIONED_NAMESPACE_DECL
32 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
34 namespace TAO
36 /** Abstract base class for the GUI resource factory.
38 * This base class for resource factories which provide
39 * GUIReactors integrated with specific GUI
40 * event loop. In general, children of this class reimplement
41 * reactor_impl method where specific
42 * GUIReactor is created. GUIResource_Factory are usually
43 * created by GUIResource_Loader subclasses.
44 * Children of this class will be held in TSS by the ORB Core.
46 class TAO_Export GUIResource_Factory
48 public:
49 GUIResource_Factory ();
51 virtual ~GUIResource_Factory ();
53 /** Create ACE_Reactor using allocate_reactor_impl.
54 * Please note that this call is NOT synchronized. Left to the
55 * higher level versions to synchronize access.
57 virtual ACE_Reactor *get_reactor () ;
59 /**
60 * Reclaim the reactor if allocated by this factory.
61 * Please note that this call is NOT synchronized. Left to the
62 * higher level versions to synchronize access.
64 virtual void reclaim_reactor (ACE_Reactor *);
66 protected:
67 /**
68 * Create or return current reactor instance.
69 * Please note that this call is NOT synchronized. Left to the
70 * get_reactor() to synchronize access.
72 virtual ACE_Reactor_Impl *reactor_impl () = 0;
74 private:
75 /**
76 * Flag that is set to true if the reactor obtained from the
77 * get_reactor() method is dynamically allocated. If this flag is
78 * set to true, then the reclaim_reactor() method with call the delete
79 * operator on the given reactor. This flag is necessary to make
80 * sure that a reactor not allocated by the default resource factory
81 * is not reclaimed by the default resource factory. Such a
82 * situation can occur when a resource factory derived from the
83 * default one overrides the get_reactor() method but does not
84 * override the reclaim_reactor() method.
86 bool dynamically_allocated_reactor_;
88 /// for internal locking.
89 TAO_SYNCH_MUTEX lock_;
93 TAO_END_VERSIONED_NAMESPACE_DECL
95 #include /**/ "ace/post.h"
97 #endif /* TAO_GUI_RESOURCE_FACTORY_H */