MCPcopy Create free account
hub / github.com/apache/trafficserver / erase

Method erase

include/tscore/PriorityQueue.h:135–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133
134template <typename T, typename Comp>
135void
136PriorityQueue<T, Comp>::erase(PriorityQueueEntry<T> *entry)
137{
138 if (empty()) {
139 return;
140 }
141
142 // If the entry doesn't belong to this queue just return.
143 if (entry != _v[entry->index]) {
144 ink_assert(!in(entry));
145 return;
146 }
147
148 ink_release_assert(entry->index < _v.size());
149 const uint32_t original_index = entry->index;
150 if (original_index != (_v.size() - 1)) {
151 // Move the erased item to the end to be popped off
152 _swap(original_index, _v.size() - 1);
153 // Fix the index before we pop it
154 _v[_v.size() - 1]->index = original_index;
155 _v.pop_back();
156 _bubble_down(original_index);
157 _bubble_up(original_index);
158 } else { // Otherwise, we are already at the end, just pop
159 _v.pop_back();
160 }
161}
162
163template <typename T, typename Comp>
164void

Callers 8

stringClass · 0.45
addMethod · 0.45
removeMethod · 0.45
_change_parentMethod · 0.45
deactivateMethod · 0.45
freeMethod · 0.45
ltrimFunction · 0.45
revokePromiseMethod · 0.45

Calls 2

pop_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected