Home | History | Annotate | Download | only in base

Lines Matching defs:Pointer

34   // This section is up-front for Pointer only.
44 // A pointer to a value stored in the queue. The pointer becomes invalid
46 class Pointer {
48 // Constructs a null pointer.
49 Pointer() : priority_(kNullPriority) {
54 // An uninitialized iterator behaves like an uninitialized pointer as per
60 Pointer(const Pointer& p)
68 Pointer& operator=(const Pointer& p) {
88 // Comparing to Pointer from a different PriorityQueue is undefined.
89 bool Equals(const Pointer& other) const {
94 *this = Pointer();
108 // It is guaranteed that Pointer will treat |iterator| as a
110 Pointer(Priority priority, const ListIterator& iterator)
125 // Used by the queue to check if a Pointer is valid.
138 // Adds |value| with |priority| to the queue. Returns a pointer to the
140 Pointer Insert(const T& value, Priority priority) {
149 return Pointer(priority, list.insert(list.end(),
152 return Pointer(priority, list.insert(list.end(), value));
156 // Adds |value| with |priority| to the queue. Returns a pointer to the
158 Pointer InsertAtFront(const T& value, Priority priority) {
167 return Pointer(priority, list.insert(list.begin(),
170 return Pointer(priority, list.insert(list.begin(), value));
174 // Removes the value pointed by |pointer| from the queue. All pointers to this
175 // value including |pointer| become invalid.
176 void Erase(const Pointer& pointer) {
178 DCHECK_LT(pointer.priority_, lists_.size());
182 DCHECK_EQ(1u, valid_ids_.erase(pointer.id_));
183 DCHECK_EQ(pointer.iterator_->first, pointer.id_);
187 lists_[pointer.priority_].erase(pointer.iterator_);
190 // Returns a pointer to the first value of minimum priority or a null-pointer
192 Pointer FirstMin() const {
197 return Pointer(i, list->begin());
199 return Pointer();
202 // Returns a pointer to the last value of minimum priority or a null-pointer
204 Pointer LastMin() const {
209 return Pointer(i, --list->end());
211 return Pointer();
214 // Returns a pointer to the first value of maximum priority or a null-pointer
216 Pointer FirstMax() const {
222 return Pointer(index, list->begin());
224 return Pointer();
227 // Returns a pointer to the last value of maximum priority or a null-pointer
229 Pointer LastMax() const {
235 return Pointer(index, --list->end());
237 return Pointer();
241 // priority and then FIFO, returns a pointer to the value following
242 // the value of the given pointer (which must be non-NULL).
248 Pointer GetNextTowardsLastMin(const Pointer& pointer) const {
250 DCHECK(!pointer.is_null());
251 DCHECK_LT(pointer.priority_, lists_.size());
253 typename Pointer::ListIterator it = pointer.iterator_;
254 Priority priority = pointer.priority_;
259 return Pointer();
263 return Pointer(priority, it);