Apollo 10.0
自动驾驶开放平台
apollo::localization::msf::MapImageCache类 参考

The cache to load map images. 更多...

#include <visualization_engine.h>

apollo::localization::msf::MapImageCache 的协作图:

Public 类型

typedef std::list< std::pair< MapImageKey, cv::Mat > >::iterator ListIterator
 

Public 成员函数

 MapImageCache (int capacity)
 
bool Get (const MapImageKey &key, cv::Mat *image)
 
void Set (const MapImageKey &key, const cv::Mat &image)
 

详细描述

The cache to load map images.

在文件 visualization_engine.h144 行定义.

成员类型定义说明

◆ ListIterator

typedef std::list<std::pair<MapImageKey,cv::Mat>>::iterator apollo::localization::msf::MapImageCache::ListIterator

在文件 visualization_engine.h146 行定义.

构造及析构函数说明

◆ MapImageCache()

apollo::localization::msf::MapImageCache::MapImageCache ( int  capacity)
inlineexplicit

在文件 visualization_engine.h149 行定义.

149: _capacity(capacity) {}

成员函数说明

◆ Get()

bool apollo::localization::msf::MapImageCache::Get ( const MapImageKey key,
cv::Mat *  image 
)

在文件 visualization_engine.cc51 行定义.

51 {
52 auto found_iter = _map.find(key);
53 if (found_iter == _map.end()) {
54 return false;
55 }
56 // move the corresponding key to list front
57 _list.splice(_list.begin(), _list, found_iter->second);
58 *image = found_iter->second->second;
59 return true;
60}

◆ Set()

void apollo::localization::msf::MapImageCache::Set ( const MapImageKey key,
const cv::Mat &  image 
)

在文件 visualization_engine.cc62 行定义.

62 {
63 auto found_iter = _map.find(key);
64 if (found_iter != _map.end()) {
65 // move the corresponding key to list front
66 _list.splice(_list.begin(), _list, found_iter->second);
67 found_iter->second->second = image;
68 return;
69 }
70 // reached capacity, remove node in list, remove key in map
71 if (_map.size() == _capacity) {
72 MapImageKey key_to_del = _list.back().first;
73 _list.back().second.release();
74 _list.pop_back();
75 _map.erase(key_to_del);
76 }
77 _list.emplace_front(key, image);
78 _map[key] = _list.begin();
79}

该类的文档由以下文件生成: