00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file POAManager.h 00006 * 00007 * $Id: POAManager.h 81429 2008-04-24 18:49:54Z johnnyw $ 00008 * 00009 * POAManager 00010 * 00011 * @author Irfan Pyarali 00012 */ 00013 //============================================================================= 00014 00015 #ifndef TAO_POAMANAGER_H 00016 #define TAO_POAMANAGER_H 00017 #include /**/ "ace/pre.h" 00018 00019 #include "tao/PortableServer/portableserver_export.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #include "tao/PortableServer/poa_macros.h" 00026 #include "tao/PortableServer/POAManagerC.h" 00027 00028 // Local Object 00029 #include "tao/LocalObject.h" 00030 #include "tao/PI_ForwardC.h" 00031 #include "ace/Unbounded_Set.h" 00032 00033 // This is to remove "inherits via dominance" warnings from MSVC. 00034 // MSVC is being a little too paranoid. 00035 #if defined(_MSC_VER) 00036 #pragma warning(push) 00037 #pragma warning(disable:4250) 00038 #endif /* _MSC_VER */ 00039 00040 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00041 00042 // Forward decl. 00043 class TAO_Root_POA; 00044 class TAO_Object_Adapter; 00045 00046 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) 00047 class TAO_POAManager_Factory; 00048 00049 namespace PortableServer 00050 { 00051 class POAManagerFactory; 00052 typedef POAManagerFactory *POAManagerFactory_ptr; 00053 } 00054 #endif 00055 00056 class TAO_PortableServer_Export TAO_POA_Manager : 00057 public PortableServer::POAManager, 00058 public ::CORBA::LocalObject 00059 { 00060 friend class TAO_Root_POA; 00061 friend class TAO_Object_Adapter; 00062 00063 public: 00064 00065 void activate (void); 00066 00067 #if (TAO_HAS_MINIMUM_POA == 0) 00068 00069 void hold_requests (CORBA::Boolean wait_for_completion); 00070 00071 void discard_requests (CORBA::Boolean wait_for_completion); 00072 00073 void deactivate (CORBA::Boolean etherealize_objects, 00074 CORBA::Boolean wait_for_completion); 00075 00076 #endif /* TAO_HAS_MINIMUM_POA == 0 */ 00077 00078 PortableServer::POAManager::State get_state (void); 00079 00080 char *get_id (void); 00081 00082 TAO_POA_Manager (TAO_Object_Adapter &object_adapter, 00083 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) 00084 const char * id, 00085 const ::CORBA::PolicyList & policies, 00086 PortableServer::POAManagerFactory_ptr poa_manager_factory); 00087 #else 00088 const char * id); 00089 #endif 00090 00091 ~TAO_POA_Manager (void); 00092 00093 /// Check the state of this POA manager 00094 void check_state (void); 00095 00096 PortableServer::POAManager::State get_state_i (); 00097 00098 virtual CORBA::ORB_ptr _get_orb (void); 00099 00100 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) 00101 CORBA::PolicyList& get_policies (void); 00102 #endif 00103 00104 protected: 00105 00106 void activate_i (void); 00107 00108 void deactivate_i (CORBA::Boolean etherealize_objects, 00109 CORBA::Boolean wait_for_completion); 00110 00111 /// Method needed for notifying the IORInterceptors that the state 00112 /// of POAManager changed. 00113 void adapter_manager_state_changed (PortableServer::POAManager::State state); 00114 00115 #if (TAO_HAS_MINIMUM_POA == 0) 00116 00117 void hold_requests_i (CORBA::Boolean wait_for_completion); 00118 00119 void discard_requests_i (CORBA::Boolean wait_for_completion); 00120 00121 #endif /* TAO_HAS_MINIMUM_POA == 0 */ 00122 00123 ACE_Lock &lock (void); 00124 00125 int remove_poa (TAO_Root_POA *poa); 00126 00127 int register_poa (TAO_Root_POA *poa); 00128 00129 protected: 00130 00131 PortableServer::POAManager::State state_; 00132 00133 ACE_Lock &lock_; 00134 00135 typedef ACE_Unbounded_Set<TAO_Root_POA *> POA_COLLECTION; 00136 00137 POA_COLLECTION poa_collection_; 00138 00139 TAO_Object_Adapter &object_adapter_; 00140 00141 CORBA::String_var id_; 00142 00143 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) 00144 00145 TAO_POAManager_Factory& poa_manager_factory_; 00146 CORBA::PolicyList policies_; 00147 00148 #endif 00149 00150 00151 private : 00152 00153 /** 00154 * Generate an id for this POAManager. 00155 * @return A value that uniquely identifies the POAManager within a 00156 * given process. 00157 * @note: The id_ has the ownership of the memory allocated in this method. 00158 */ 00159 char* generate_manager_id (void) const; 00160 }; 00161 00162 TAO_END_VERSIONED_NAMESPACE_DECL 00163 00164 #if defined(_MSC_VER) 00165 #pragma warning(pop) 00166 #endif /* _MSC_VER */ 00167 00168 #if defined (__ACE_INLINE__) 00169 # include "tao/PortableServer/POAManager.inl" 00170 #endif /* __ACE_INLINE__ */ 00171 00172 #include /**/ "ace/post.h" 00173 #endif /* TAO_POAMANAGER_H */