Home | History | Annotate | Download | only in base

Lines Matching defs:Entry

47   struct Entry {
54 // If an entry with matching key is found, returns that entry.
56 Entry* Lookup(void* key, uint32_t hash) const;
58 // If an entry with matching key is found, returns that entry.
59 // If no matching entry is found, a new entry is inserted with
61 Entry* LookupOrInsert(void* key, uint32_t hash,
64 // Removes the entry with matching key.
65 // It returns the value of the deleted entry
82 // for (Entry* p = map.Start(); p != NULL; p = map.Next(p)) {
88 Entry* Start() const;
89 Entry* Next(Entry* p) const;
96 Entry* map_;
100 Entry* map_end() const { return map_ + capacity_; }
101 Entry* Probe(void* key, uint32_t hash) const;
121 typename TemplateHashMapImpl<AllocationPolicy>::Entry*
123 Entry* p = Probe(key, hash);
128 typename TemplateHashMapImpl<AllocationPolicy>::Entry*
131 // Find a matching entry.
132 Entry* p = Probe(key, hash);
137 // No entry found; insert one.
155 // Lookup the entry for the key to remove.
156 Entry* p = Probe(key, hash);
163 // To remove an entry we need to ensure that it does not create an empty
164 // entry that will cause the search for another entry to stop too soon. If all
165 // the entries between the entry to remove and the next empty slot have their
166 // initial position inside this interval, clearing the entry to remove will
167 // not break the search. If, while searching for the next empty entry, an
168 // entry is encountered which does not have its initial position between the
169 // entry to remove and the position looked at, then this entry can be moved to
170 // the place of the entry to remove without breaking the search for it. The
171 // entry made vacant by this move is now the entry to remove and the process
175 // This guarantees loop termination as there is at least one empty entry so
176 // eventually the removed entry will have an empty entry after it.
179 // p is the candidate entry to clear. q is used to scan forwards.
180 Entry* q = p; // Start at the entry to remove.
182 // Move q to the next entry.
189 // and the entry p can be cleared without breaking the search for these
195 // Find the initial position for the entry at position q.
196 Entry* r = map_ + (q->hash & (capacity_ - 1));
198 // If the entry at position q has its initial position outside the range
200 // found. There is now a new candidate entry for clearing.
207 // Clear the entry which is allowed to en emptied.
216 const Entry* end = map_end();
217 for (Entry* p = map_; p < end; p++) {
224 typename TemplateHashMapImpl<AllocationPolicy>::Entry*
230 typename TemplateHashMapImpl<AllocationPolicy>::Entry*
231 TemplateHashMapImpl<AllocationPolicy>::Next(Entry* p) const {
232 const Entry* end = map_end();
243 typename TemplateHashMapImpl<AllocationPolicy>::Entry*
248 Entry* p = map_ + (hash & (capacity_ - 1));
249 const Entry* end = map_end();
267 map_ = reinterpret_cast<Entry*>(allocator.New(capacity * sizeof(Entry)));
278 Entry* map = map_;
285 for (Entry* p = map; n > 0; p++) {
287 Entry* entry = LookupOrInsert(p->key, p->hash, allocator);
288 entry->value = p->value;
289 entry->order = p->order;
321 typename TemplateHashMapImpl<AllocationPolicy>::Entry* entry)
322 : map_(map), entry_(entry) {}
325 typename TemplateHashMapImpl<AllocationPolicy>::Entry* entry_;