25 #include <unordered_map> 33 template <
typename I,
typename T>
39 const T *
Find(
const I
id)
const {
40 auto *result = apollo::common::util::FindOrNull(
map_,
id);
41 return result ? result->get() :
nullptr;
51 bool Add(
const I
id, std::unique_ptr<T> ptr) {
59 queue_.emplace(
id, ptr.get());
60 map_[id] = std::move(ptr);
73 std::queue<std::pair<I, const T *>>
queue_;
74 std::unordered_map<I, std::unique_ptr<T>>
map_;
void Clear()
Definition: indexed_queue.h:64
bool Add(const I id, std::unique_ptr< T > ptr)
Definition: indexed_queue.h:51
const T * Find(const I id) const
Definition: indexed_queue.h:39
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
size_t capacity_
Definition: indexed_queue.h:72
Planning module main class. It processes GPS and IMU as input, to generate planning info...
std::unordered_map< I, std::unique_ptr< T > > map_
Definition: indexed_queue.h:74
IndexedQueue(size_t capacity)
Definition: indexed_queue.h:37
std::queue< std::pair< I, const T * > > queue_
Definition: indexed_queue.h:73
Definition: indexed_queue.h:34
const T * Latest() const
Definition: indexed_queue.h:44