00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CSD_TP_Servant_State_Map.h 00006 * 00007 * $Id: CSD_TP_Servant_State_Map.h 80158 2007-12-02 16:12:30Z sowayaa $ 00008 * 00009 * @author Tim Bradley <bradley_t@ociweb.com> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_CSD_TP_SERVANT_STATE_MAP_H 00014 #define TAO_CSD_TP_SERVANT_STATE_MAP_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/CSD_ThreadPool/CSD_TP_Export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/CSD_ThreadPool/CSD_TP_Servant_State.h" 00025 #include "tao/PortableServer/PortableServer.h" 00026 #include "ace/Hash_Map_Manager.h" 00027 #include "ace/Synch.h" 00028 00029 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00030 00031 namespace TAO 00032 { 00033 namespace CSD 00034 { 00035 00036 /** 00037 * @class TP_Servant_State_Map 00038 * 00039 * @brief Map of Servant_State objects - one per servant. 00040 * 00041 * A TP_Stategy object holds an instance of a TP_Servant_State_Map object 00042 * as a (held-by-value) data member. The strategy uses this map to 00043 * find or create the TP_Servant_State object for a particular servant 00044 * object. 00045 * 00046 */ 00047 class TAO_CSD_TP_Export TP_Servant_State_Map 00048 { 00049 public: 00050 00051 /// Default Constructor. 00052 TP_Servant_State_Map(); 00053 00054 /// Destructor. 00055 ~TP_Servant_State_Map(); 00056 00057 /// Accessor for the servant busy flag. 00058 TP_Servant_State* find(PortableServer::Servant servant 00059 ); 00060 00061 /// Insert the servant to map. 00062 void insert(PortableServer::Servant servant 00063 ); 00064 00065 /// Remove the servant from map. 00066 void remove(PortableServer::Servant servant 00067 ); 00068 00069 00070 private: 00071 00072 /// Underlying Map Type - Hash-Based - 00073 /// Key Type: void*, Value Type: TP_Servant_State::HandleType 00074 typedef ACE_Hash_Map_Manager_Ex<void*, 00075 TP_Servant_State::HandleType, 00076 ACE_Hash<void*>, 00077 ACE_Equal_To<void*>, 00078 TAO_SYNCH_MUTEX> MapType; 00079 00080 /// The underlying map of servant state objects. 00081 MapType map_; 00082 }; 00083 00084 } 00085 } 00086 00087 TAO_END_VERSIONED_NAMESPACE_DECL 00088 00089 #if defined (__ACE_INLINE__) 00090 # include "tao/CSD_ThreadPool/CSD_TP_Servant_State_Map.inl" 00091 #endif /* __ACE_INLINE__ */ 00092 00093 #include /**/ "ace/post.h" 00094 00095 #endif /* TAO_CSD_TP_SERVANT_STATE_MAP_H */