00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 #ifndef ACE_ACTIVE_MAP_MANAGER_T_H
00015 #define ACE_ACTIVE_MAP_MANAGER_T_H
00016 #include  "ace/pre.h"
00017 
00018 #include "ace/Map_Manager.h"
00019 #include "ace/Active_Map_Manager.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif 
00024 
00025 #include "ace/Null_Mutex.h"
00026 
00027 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 template <class T>
00039 class ACE_Active_Map_Manager : public ACE_Map_Manager<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
00040 {
00041 public:
00042 
00043   
00044   typedef ACE_Active_Map_Manager_Key key_type;
00045   typedef T mapped_type;
00046 
00047   typedef ACE_Map_Entry<ACE_Active_Map_Manager_Key, T> ENTRY;
00048   typedef ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> ITERATOR;
00049   typedef ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> REVERSE_ITERATOR;
00050 
00051   typedef ENTRY entry;
00052   typedef ITERATOR iterator;
00053   typedef REVERSE_ITERATOR reverse_iterator;
00054 
00055   
00056 
00057   ACE_Active_Map_Manager (ACE_Allocator *alloc = 0);
00058 
00059 
00060   ACE_Active_Map_Manager (size_t size,
00061                           ACE_Allocator *alloc = 0);
00062 
00063 
00064 
00065   ~ACE_Active_Map_Manager (void);
00066 
00067 
00068   int open (size_t length = ACE_DEFAULT_MAP_SIZE,
00069             ACE_Allocator *alloc = 0);
00070 
00071 
00072 
00073   int close (void);
00074 
00075 
00076 
00077   int bind (const T &value,
00078             ACE_Active_Map_Manager_Key &key);
00079 
00080 
00081 
00082   int bind (const T &value);
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093   int bind (ACE_Active_Map_Manager_Key &key,
00094             T *&internal_value);
00095 
00096 
00097 
00098   int rebind (const ACE_Active_Map_Manager_Key &key,
00099               const T &value);
00100 
00101 
00102 
00103 
00104 
00105 
00106   int rebind (const ACE_Active_Map_Manager_Key &key,
00107               const T &value,
00108               T &old_value);
00109 
00110 
00111 
00112 
00113 
00114 
00115   int rebind (const ACE_Active_Map_Manager_Key &key,
00116               const T &value,
00117               ACE_Active_Map_Manager_Key &old_key,
00118               T &old_value);
00119 
00120 
00121   int find (const ACE_Active_Map_Manager_Key &key,
00122             T &value) const;
00123 
00124 
00125   int find (const ACE_Active_Map_Manager_Key &key) const;
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 
00134   int find (const ACE_Active_Map_Manager_Key &key,
00135             T *&internal_value) const;
00136 
00137   
00138   
00139   
00140 
00141 
00142   int unbind (const ACE_Active_Map_Manager_Key &key);
00143 
00144 
00145 
00146   int unbind (const ACE_Active_Map_Manager_Key &key,
00147               T &value);
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156   int unbind (const ACE_Active_Map_Manager_Key &key,
00157               T *&internal_value);
00158 
00159 
00160   size_t current_size (void) const;
00161 
00162 
00163   size_t total_size (void) const;
00164 
00165 
00166   static const ACE_Active_Map_Manager_Key npos (void);
00167 
00168 
00169   void dump (void) const;
00170 
00171   
00172 
00173 
00174   ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> begin (void);
00175   ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> end (void);
00176 
00177 
00178   ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> rbegin (void);
00179   ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> rend (void);
00180 
00181 
00182   ACE_ALLOC_HOOK_DECLARE;
00183 
00184 protected:
00185 
00186 
00187   typedef ACE_Map_Manager<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex> ACE_AMM_BASE;
00188 
00189 private:
00190 
00191   
00192   ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Active_Map_Manager<T> &))
00193   ACE_UNIMPLEMENTED_FUNC (ACE_Active_Map_Manager (const ACE_Active_Map_Manager<T> &))
00194 };
00195 
00196 ACE_END_VERSIONED_NAMESPACE_DECL
00197 
00198 #if defined (__ACE_INLINE__)
00199 #include "ace/Active_Map_Manager_T.inl"
00200 #endif 
00201 
00202 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00203 #include "ace/Active_Map_Manager_T.cpp"
00204 #endif 
00205 
00206 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00207 #pragma implementation ("Active_Map_Manager_T.cpp")
00208 #endif 
00209 
00210 #include  "ace/post.h"
00211 #endif