2 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
4 template <class T> ACE_INLINE int
5 ACE_Active_Map_Manager<T>::bind (ACE_Active_Map_Manager_Key &key,
9 int result = this->next_free (slot_index);
13 // Move from free list to occupied list
14 this->move_from_free_list_to_occupied_list (slot_index);
17 this->search_structure_[slot_index].ext_id_.increment_slot_generation_count ();
18 this->search_structure_[slot_index].ext_id_.slot_index (slot_index);
20 // Copy the key for the user.
21 key = this->search_structure_[slot_index].ext_id_;
23 // This is where the user should place the value.
24 internal_value = &this->search_structure_[slot_index].int_id_;
26 // Update the current size.
33 template <class T> ACE_INLINE int
34 ACE_Active_Map_Manager<T>::bind (const T &value,
35 ACE_Active_Map_Manager_Key &key)
37 T *internal_value = 0;
38 int result = this->bind (key,
44 *internal_value = value;
50 template <class T> ACE_INLINE int
51 ACE_Active_Map_Manager<T>::bind (const T &value)
53 ACE_Active_Map_Manager_Key key;
54 return this->bind (value, key);
57 template <class T> ACE_INLINE int
58 ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key,
59 T *&internal_value) const
61 ACE_UINT32 slot_index = key.slot_index ();
62 ACE_UINT32 slot_generation = key.slot_generation ();
64 if (slot_index > this->total_size_ ||
65 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
66 this->search_structure_[slot_index].free_ ||
67 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
68 this->search_structure_[slot_index].ext_id_.slot_generation () != slot_generation ||
69 this->search_structure_[slot_index].ext_id_.slot_index () ==
70 (ACE_UINT32)this->free_list_id ())
76 // This is where the user value is.
77 internal_value = &this->search_structure_[slot_index].int_id_;
83 template <class T> ACE_INLINE int
84 ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key) const
86 T *internal_value = 0;
87 return this->find (key,
91 template <class T> ACE_INLINE int
92 ACE_Active_Map_Manager<T>::find (const ACE_Active_Map_Manager_Key &key,
95 T *internal_value = 0;
96 int result = this->find (key,
100 value = *internal_value;
105 template <class T> ACE_INLINE int
106 ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key,
109 int result = this->find (key);
114 this->search_structure_[key.slot_index ()].int_id_ = value;
120 template <class T> ACE_INLINE int
121 ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key,
125 int result = this->find (key);
130 old_value = this->search_structure_[key.slot_index ()].int_id_;
133 this->search_structure_[key.slot_index ()].int_id_ = value;
139 template <class T> ACE_INLINE int
140 ACE_Active_Map_Manager<T>::rebind (const ACE_Active_Map_Manager_Key &key,
142 ACE_Active_Map_Manager_Key &old_key,
145 int result = this->find (key);
150 old_key = this->search_structure_[key.slot_index ()].ext_id_;
153 old_value = this->search_structure_[key.slot_index ()].int_id_;
156 this->search_structure_[key.slot_index ()].int_id_ = value;
162 template <class T> ACE_INLINE int
163 ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key,
166 int result = this->find (key,
171 ACE_UINT32 slot_index = key.slot_index ();
173 #if defined (ACE_HAS_LAZY_MAP_MANAGER)
176 // In the case of lazy map managers, the movement of free slots
177 // from the occupied list to the free list is delayed until we
178 // run out of free slots in the free list.
181 this->search_structure_[slot_index].free_ = 1;
185 // Move from occupied list to free list.
186 this->move_from_occupied_list_to_free_list (slot_index);
188 #endif /* ACE_HAS_LAZY_MAP_MANAGER */
190 // Reset the slot_index. This will tell us that this entry is free.
191 this->search_structure_[slot_index].ext_id_.slot_index (this->free_list_id ());
193 // Update the current size.
200 template <class T> ACE_INLINE int
201 ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key,
205 int result = this->unbind (key,
211 value = *internal_value;
217 template <class T> ACE_INLINE int
218 ACE_Active_Map_Manager<T>::unbind (const ACE_Active_Map_Manager_Key &key)
221 return this->unbind (key,
225 template <class T> ACE_INLINE
226 ACE_Active_Map_Manager<T>::ACE_Active_Map_Manager (ACE_Allocator *alloc)
227 : ACE_AMM_BASE (alloc)
231 template <class T> ACE_INLINE
232 ACE_Active_Map_Manager<T>::ACE_Active_Map_Manager (size_t size,
233 ACE_Allocator *alloc)
234 : ACE_AMM_BASE (size,
239 template <class T> ACE_INLINE int
240 ACE_Active_Map_Manager<T>::open (size_t length,
241 ACE_Allocator *alloc)
243 return ACE_AMM_BASE::open (length, alloc);
246 template <class T> ACE_INLINE int
247 ACE_Active_Map_Manager<T>::close ()
249 return ACE_AMM_BASE::close ();
252 template <class T> ACE_INLINE size_t
253 ACE_Active_Map_Manager<T>::current_size () const
255 return ACE_AMM_BASE::current_size ();
258 template <class T> ACE_INLINE size_t
259 ACE_Active_Map_Manager<T>::total_size () const
261 return ACE_AMM_BASE::total_size ();
265 template <class T> ACE_INLINE const ACE_Active_Map_Manager_Key
266 ACE_Active_Map_Manager<T>::npos ()
268 return ACE_Active_Map_Manager_Key (~0, ~0);
271 template <class T> ACE_INLINE void
272 ACE_Active_Map_Manager<T>::dump () const
274 #if defined (ACE_HAS_DUMP)
275 ACE_AMM_BASE::dump ();
276 #endif /* ACE_HAS_DUMP */
279 template <class T> ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
280 ACE_Active_Map_Manager<T>::begin ()
282 return ACE_AMM_BASE::begin ();
285 template <class T> ACE_INLINE ACE_Map_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
286 ACE_Active_Map_Manager<T>::end ()
288 return ACE_AMM_BASE::end ();
291 template <class T> ACE_INLINE ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
292 ACE_Active_Map_Manager<T>::rbegin ()
294 return ACE_AMM_BASE::rbegin ();
297 template <class T> ACE_INLINE ACE_Map_Reverse_Iterator<ACE_Active_Map_Manager_Key, T, ACE_Null_Mutex>
298 ACE_Active_Map_Manager<T>::rend ()
300 return ACE_AMM_BASE::rend ();
303 ACE_END_VERSIONED_NAMESPACE_DECL