#include <Active_Map_Manager_T.h>
Inheritance diagram for ACE_Active_Map_Manager:


Public Types | |
| typedef ACE_Active_Map_Manager_Key | key_type |
| typedef T | mapped_type |
| typedef ACE_Map_Entry< ACE_Active_Map_Manager_Key, T > | ENTRY |
| typedef ACE_Map_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex > | ITERATOR |
| typedef ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex > | REVERSE_ITERATOR |
| typedef ENTRY | entry |
| typedef ITERATOR | iterator |
| typedef REVERSE_ITERATOR | reverse_iterator |
Public Methods | |
| ACE_Active_Map_Manager (ACE_Allocator *alloc=0) | |
| Initialize a <Active_Map_Manager> with the <ACE_DEFAULT_MAP_SIZE>. More... | |
| ACE_Active_Map_Manager (size_t size, ACE_Allocator *alloc=0) | |
| Initialize a <Active_Map_Manager> with <size> entries. More... | |
| ~ACE_Active_Map_Manager (void) | |
| Close down a <Active_Map_Manager> and release dynamically allocated resources. More... | |
| int | open (size_t length=ACE_DEFAULT_MAP_SIZE, ACE_Allocator *alloc=0) |
| Initialize a <Active_Map_Manager> with size <length>. More... | |
| int | close (void) |
| Close down a <Active_Map_Manager> and release dynamically allocated resources. More... | |
| int | bind (const T &value, ACE_Active_Map_Manager_Key &key) |
| Add <value> to the map, and the corresponding key produced by the Active_Map_Manager is returned through <key>. More... | |
| int | bind (const T &value) |
| Add <value> to the map. The user does not care about the corresponding key produced by the Active_Map_Manager. More... | |
| int | bind (ACE_Active_Map_Manager_Key &key, T *&internal_value) |
| int | rebind (const ACE_Active_Map_Manager_Key &key, const T &value) |
| Reassociate <key> with <value>. The function fails if <key> is not in the map. More... | |
| int | rebind (const ACE_Active_Map_Manager_Key &key, const T &value, T &old_value) |
| int | rebind (const ACE_Active_Map_Manager_Key &key, const T &value, ACE_Active_Map_Manager_Key &old_key, T &old_value) |
| int | find (const ACE_Active_Map_Manager_Key &key, T &value) const |
| Locate <value> associated with <key>. More... | |
| int | find (const ACE_Active_Map_Manager_Key &key) const |
| Is <key> in the map? More... | |
| int | find (const ACE_Active_Map_Manager_Key &key, T *&internal_value) const |
| int | unbind (const ACE_Active_Map_Manager_Key &key) |
| Remove <key> from the map. More... | |
| int | unbind (const ACE_Active_Map_Manager_Key &key, T &value) |
| Remove <key> from the map, and return the <value> associated with <key>. More... | |
| int | unbind (const ACE_Active_Map_Manager_Key &key, T *&internal_value) |
| size_t | current_size (void) const |
| Return the current size of the map. More... | |
| size_t | total_size (void) const |
| Return the total size of the map. More... | |
| void | dump (void) const |
| Dump the state of an object. More... | |
| ACE_Map_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex > | begin (void) |
| Return forward iterator. More... | |
| ACE_Map_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex > | end (void) |
| ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex > | rbegin (void) |
| Return reverse iterator. More... | |
| ACE_Map_Reverse_Iterator< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex > | rend (void) |
Static Public Methods | |
| const ACE_Active_Map_Manager_Key | npos (void) |
| Returns a key that cannot be found in the map. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
Protected Types | |
| typedef ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex > | ACE_AMM_BASE |
| Private base class. More... | |
Private Methods | |
| void | operator= (const ACE_Active_Map_Manager< T > &) |
| ACE_Active_Map_Manager (const ACE_Active_Map_Manager< T > &) | |
Since the key is system generated, searches are very fast and take a constant amount of time.
Definition at line 35 of file Active_Map_Manager_T.h.
|
|||||
|
Private base class.
Definition at line 183 of file Active_Map_Manager_T.h. |
|
|||||
|
Definition at line 47 of file Active_Map_Manager_T.h. |
|
|||||
|
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 43 of file Active_Map_Manager_T.h. |
|
|||||
|
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 48 of file Active_Map_Manager_T.h. |
|
|||||
|
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 44 of file Active_Map_Manager_T.h. |
|
|||||
|
Definition at line 40 of file Active_Map_Manager_T.h. |
|
|||||
|
Definition at line 41 of file Active_Map_Manager_T.h. |
|
|||||
|
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 49 of file Active_Map_Manager_T.h. |
|
|||||
|
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 45 of file Active_Map_Manager_T.h. |
|
||||||||||
|
Initialize a <Active_Map_Manager> with the <ACE_DEFAULT_MAP_SIZE>.
Definition at line 225 of file Active_Map_Manager_T.i.
00226 : ACE_AMM_BASE (alloc) 00227 { 00228 } |
|
||||||||||||||||
|
Initialize a <Active_Map_Manager> with <size> entries.
Definition at line 231 of file Active_Map_Manager_T.i.
00233 : ACE_AMM_BASE (size, 00234 alloc) 00235 { 00236 } |
|
||||||||||
|
Close down a <Active_Map_Manager> and release dynamically allocated resources.
Definition at line 239 of file Active_Map_Manager_T.i.
00240 {
00241 }
|
|
||||||||||
|
|
|
||||||||||
|
Return forward iterator.
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 282 of file Active_Map_Manager_T.i.
00283 {
00284 return ACE_AMM_BASE::begin ();
00285 }
|
|
||||||||||||||||
|
Reserves a slot in the internal structure and returns the key and a pointer to the value. User should place their <value> into <*internal_value>. This method is useful in reducing the number of copies required in some cases. Note that <internal_value> is only a temporary pointer and will change when the map resizes. Therefore, the user should use the pointer immediately and not hold on to it. Definition at line 4 of file Active_Map_Manager_T.i. References ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::cur_size_, ACE_Map_Entry< ACE_Active_Map_Manager_Key, T >::ext_id_, ACE_Active_Map_Manager_Key::increment_slot_generation_count, ACE_Map_Entry< ACE_Active_Map_Manager_Key, T >::int_id_, ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::move_from_free_list_to_occupied_list, ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::next_free, ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::search_structure_, and ACE_Active_Map_Manager_Key::slot_index.
00006 {
00007 ACE_UINT32 slot_index;
00008 int result = this->next_free (slot_index);
00009
00010 if (result == 0)
00011 {
00012 // Move from free list to occupied list
00013 this->move_from_free_list_to_occupied_list (slot_index);
00014
00015 // Reset the key.
00016 this->search_structure_[slot_index].ext_id_.increment_slot_generation_count ();
00017 this->search_structure_[slot_index].ext_id_.slot_index (slot_index);
00018
00019 // Copy the key for the user.
00020 key = this->search_structure_[slot_index].ext_id_;
00021
00022 // This is where the user should place the value.
00023 internal_value = &this->search_structure_[slot_index].int_id_;
00024
00025 // Update the current size.
00026 ++this->cur_size_;
00027 }
00028
00029 return result;
00030 }
|
|
||||||||||
|
Add <value> to the map. The user does not care about the corresponding key produced by the Active_Map_Manager.
Definition at line 50 of file Active_Map_Manager_T.i. References bind.
00051 {
00052 ACE_Active_Map_Manager_Key key;
00053 return this->bind (value, key);
00054 }
|
|
||||||||||||||||
|
Add <value> to the map, and the corresponding key produced by the Active_Map_Manager is returned through <key>.
Definition at line 33 of file Active_Map_Manager_T.i. Referenced by bind.
00035 {
00036 T *internal_value = 0;
00037 int result = this->bind (key,
00038 internal_value);
00039
00040 if (result == 0)
00041 {
00042 // Store new value.
00043 *internal_value = value;
00044 }
00045
00046 return result;
00047 }
|
|
||||||||||
|
Close down a <Active_Map_Manager> and release dynamically allocated resources.
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 251 of file Active_Map_Manager_T.i.
00252 {
00253 return ACE_AMM_BASE::close ();
00254 }
|
|
||||||||||
|
Return the current size of the map.
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 257 of file Active_Map_Manager_T.i.
00258 {
00259 return ACE_AMM_BASE::current_size ();
00260 }
|
|
||||||||||
|
Dump the state of an object.
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 276 of file Active_Map_Manager_T.i.
00277 {
00278 ACE_AMM_BASE::dump ();
00279 }
|
|
||||||||||
|
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 288 of file Active_Map_Manager_T.i.
00289 {
00290 return ACE_AMM_BASE::end ();
00291 }
|
|
||||||||||||||||
|
Locate <value> associated with <key>. The value is returned via <internal_value> and hence a copy is saved. Note that <internal_value> is only a temporary pointer and will change when the map resizes. Therefore, the user should use the pointer immediately and not hold on to it. Definition at line 57 of file Active_Map_Manager_T.i. References ACE_Map_Entry< ACE_Active_Map_Manager_Key, T >::ext_id_, ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::free_list_id, ACE_Map_Entry< ACE_Active_Map_Manager_Key, T >::int_id_, ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::search_structure_, ACE_Active_Map_Manager_Key::slot_generation, ACE_Active_Map_Manager_Key::slot_index, and ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::total_size_.
00059 {
00060 ACE_UINT32 slot_index = key.slot_index ();
00061 ACE_UINT32 slot_generation = key.slot_generation ();
00062
00063 if (slot_index > this->total_size_ ||
00064 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
00065 this->search_structure_[slot_index].free_ ||
00066 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
00067 this->search_structure_[slot_index].ext_id_.slot_generation () != slot_generation ||
00068 this->search_structure_[slot_index].ext_id_.slot_index () ==
00069 (ACE_UINT32)this->free_list_id ())
00070 {
00071 return -1;
00072 }
00073 else
00074 {
00075 // This is where the user value is.
00076 internal_value = &this->search_structure_[slot_index].int_id_;
00077 }
00078
00079 return 0;
00080 }
|
|
||||||||||
|
Is <key> in the map?
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 83 of file Active_Map_Manager_T.i. References find.
00084 {
00085 T *internal_value = 0;
00086 return this->find (key,
00087 internal_value);
00088 }
|
|
||||||||||||||||
|
Locate <value> associated with <key>.
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 91 of file Active_Map_Manager_T.i. Referenced by find, rebind, and unbind.
00093 {
00094 T *internal_value = 0;
00095 int result = this->find (key,
00096 internal_value);
00097
00098 if (result == 0)
00099 value = *internal_value;
00100
00101 return result;
00102 }
|
|
||||||||||
|
Returns a key that cannot be found in the map.
Definition at line 270 of file Active_Map_Manager_T.i.
00271 {
00272 return ACE_Active_Map_Manager_Key (~0, ~0);
00273 }
|
|
||||||||||||||||
|
Initialize a <Active_Map_Manager> with size <length>.
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 244 of file Active_Map_Manager_T.i.
00246 {
00247 return ACE_AMM_BASE::open (length, alloc);
00248 }
|
|
||||||||||
|
|
|
||||||||||
|
Return reverse iterator.
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 294 of file Active_Map_Manager_T.i.
00295 {
00296 return ACE_AMM_BASE::rbegin ();
00297 }
|
|
||||||||||||||||||||||||
|
Reassociate <key> with <value>, storing the old key and value into the "out" parameter <old_key> and <old_value>. The function fails if <key> is not in the map. Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 139 of file Active_Map_Manager_T.i. References find, ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::search_structure_, and ACE_Active_Map_Manager_Key::slot_index.
00143 {
00144 int result = this->find (key);
00145
00146 if (result == 0)
00147 {
00148 // Copy old key.
00149 old_key = this->search_structure_[key.slot_index ()].ext_id_;
00150
00151 // Copy old value.
00152 old_value = this->search_structure_[key.slot_index ()].int_id_;
00153
00154 // Store new value.
00155 this->search_structure_[key.slot_index ()].int_id_ = value;
00156 }
00157
00158 return result;
00159 }
|
|
||||||||||||||||||||
|
Reassociate <key> with <value>, storing the old value into the "out" parameter <old_value>. The function fails if <key> is not in the map. Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 120 of file Active_Map_Manager_T.i. References find, ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::search_structure_, and ACE_Active_Map_Manager_Key::slot_index.
00123 {
00124 int result = this->find (key);
00125
00126 if (result == 0)
00127 {
00128 // Copy old value.
00129 old_value = this->search_structure_[key.slot_index ()].int_id_;
00130
00131 // Store new value.
00132 this->search_structure_[key.slot_index ()].int_id_ = value;
00133 }
00134
00135 return result;
00136 }
|
|
||||||||||||||||
|
Reassociate <key> with <value>. The function fails if <key> is not in the map.
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 105 of file Active_Map_Manager_T.i. References find, ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::search_structure_, and ACE_Active_Map_Manager_Key::slot_index.
00107 {
00108 int result = this->find (key);
00109
00110 if (result == 0)
00111 {
00112 // Store new value.
00113 this->search_structure_[key.slot_index ()].int_id_ = value;
00114 }
00115
00116 return result;
00117 }
|
|
||||||||||
|
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 300 of file Active_Map_Manager_T.i.
00301 {
00302 return ACE_AMM_BASE::rend ();
00303 }
|
|
||||||||||
|
Return the total size of the map.
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 263 of file Active_Map_Manager_T.i.
00264 {
00265 return ACE_AMM_BASE::total_size ();
00266 }
|
|
||||||||||||||||
|
Locate <value> associated with <key>. The value is returned via <internal_value> and hence a copy is saved. Note that <internal_value> is only a temporary pointer and will change when the map resizes or when this slot is reused. Therefore, the user should use the pointer immediately and not hold on to it. Definition at line 162 of file Active_Map_Manager_T.i. References ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::cur_size_, ACE_Map_Entry< ACE_Active_Map_Manager_Key, T >::ext_id_, find, ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::move_from_occupied_list_to_free_list, ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >::search_structure_, and ACE_Active_Map_Manager_Key::slot_index.
00164 {
00165 int result = this->find (key,
00166 internal_value);
00167
00168 if (result == 0)
00169 {
00170 ACE_UINT32 slot_index = key.slot_index ();
00171
00172 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
00173
00174 //
00175 // In the case of lazy map managers, the movement of free slots
00176 // from the occupied list to the free list is delayed until we
00177 // run out of free slots in the free list.
00178 //
00179
00180 this->search_structure_[slot_index].free_ = 1;
00181
00182 #else
00183
00184 // Move from occupied list to free list.
00185 this->move_from_occupied_list_to_free_list (slot_index);
00186
00187 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
00188
00189 // Reset the slot_index. This will tell us that this entry is free.
00190 this->search_structure_[slot_index].ext_id_.slot_index (this->free_list_id ());
00191
00192 // Update the current size.
00193 --this->cur_size_;
00194 }
00195
00196 return result;
00197 }
|
|
||||||||||||||||
|
Remove <key> from the map, and return the <value> associated with <key>.
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 200 of file Active_Map_Manager_T.i. References unbind.
00202 {
00203 T *internal_value;
00204 int result = this->unbind (key,
00205 internal_value);
00206
00207 if (result == 0)
00208 {
00209 // Copy old value.
00210 value = *internal_value;
00211 }
00212
00213 return result;
00214 }
|
|
||||||||||
|
Remove <key> from the map.
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 217 of file Active_Map_Manager_T.i. Referenced by unbind.
00218 {
00219 T *internal_value;
00220 return this->unbind (key,
00221 internal_value);
00222 }
|
|
|||||
|
Declare the dynamic allocation hooks.
Reimplemented from ACE_Map_Manager< ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex >. Definition at line 178 of file Active_Map_Manager_T.h. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002