35 #ifndef COSTMAP_QUEUE_MAP_BASED_QUEUE_H 36 #define COSTMAP_QUEUE_MAP_BASED_QUEUE_H 60 template <
class item_t>
90 void enqueue(
const double priority, item_t item)
101 auto map_item = std::make_pair(priority, std::move(std::vector<item_t>()));
104 std::pair<ItemMapIterator, bool> insert_result =
item_bins_.insert(std::move(map_item));
139 throw std::out_of_range(
"front() called on empty costmap_queue::MapBasedQueue!");
142 return iter_->second.back();
152 iter_->second.pop_back();
156 auto not_empty = [](
const typename ItemMap::value_type& key_val) {
return !key_val.second.empty(); };
161 using ItemMap = std::map<double, std::vector<item_t>>;
173 #endif // COSTMAP_QUEUE_MAP_BASED_QUEUE_H
item_t & front()
Return the item at the front of the queue.
ItemMapIterator last_insert_iter_
void enqueue(const double priority, item_t item)
Add a new item to the queue with a set priority.
typename ItemMap::iterator ItemMapIterator
void pop()
Remove (and destroy) the item at the front of the queue.
Templatized interface for a priority queue.
virtual void reset()
Clear the queue.
bool isEmpty()
Check to see if there is anything in the queue.
MapBasedQueue(bool reset_bins=true)
Default Constructor.
std::map< double, std::vector< CellData >> ItemMap