Apollo 10.0
自动驾驶开放平台
apollo::dreamview::UpdaterManager类 参考

Management for all data updater. 更多...

#include <updater_manager.h>

apollo::dreamview::UpdaterManager 的协作图:

Public 成员函数

 UpdaterManager ()
 
virtual ~UpdaterManager ()
 
void RegisterUpdater (std::string path_name, UpdaterBase *updater)
 Register data updater by websocket path name.
 
bool Start (const std::string &path_name, const double &time_interval_ms, const std::string &channel_name="", nlohmann::json *subscribe_param=nullptr)
 Start a updater implemetnent.
 
bool Stop (const std::string &path_name, const std::string &channel_name)
 Stop updater publish data.
 
UpdaterBaseGetUpdater (const std::string &path_name)
 Get registered updater
 
bool IsChannelInUpdater (const std::string &path_name, const std::string &message_type, const std::string &channel_name)
 Check if the channel belongs to an updater.
 

详细描述

Management for all data updater.

在文件 updater_manager.h42 行定义.

构造及析构函数说明

◆ UpdaterManager()

apollo::dreamview::UpdaterManager::UpdaterManager ( )
inline

在文件 updater_manager.h44 行定义.

44{}

◆ ~UpdaterManager()

virtual apollo::dreamview::UpdaterManager::~UpdaterManager ( )
inlinevirtual

在文件 updater_manager.h45 行定义.

45{}

成员函数说明

◆ GetUpdater()

UpdaterBase * apollo::dreamview::UpdaterManager::GetUpdater ( const std::string &  path_name)

Get registered updater

参数
path_nameThe path name of the data updater.

在文件 updater_manager.cc56 行定义.

56 {
57 if (updater_map_.find(path_name) == updater_map_.end()) {
58 return nullptr;
59 }
60 return updater_map_[path_name];
61}

◆ IsChannelInUpdater()

bool apollo::dreamview::UpdaterManager::IsChannelInUpdater ( const std::string &  path_name,
const std::string &  message_type,
const std::string &  channel_name 
)

Check if the channel belongs to an updater.

参数
path_nameThe path name of the data updater.
message_typeThe type of message in channel.
channel_nameThe name of channel.

在文件 updater_manager.cc63 行定义.

65 {
66 UpdaterBase* updater = GetUpdater(path_name);
67 UpdaterWithChannelsBase* updater_with_channels =
68 dynamic_cast<UpdaterWithChannelsBase*>(updater);
69 if (updater_with_channels == nullptr) {
70 return false;
71 }
72
73 return updater_with_channels->IsChannelInUpdater(message_type, channel_name);
74}
UpdaterBase * GetUpdater(const std::string &path_name)
Get registered updater

◆ RegisterUpdater()

void apollo::dreamview::UpdaterManager::RegisterUpdater ( std::string  path_name,
UpdaterBase updater 
)

Register data updater by websocket path name.

参数
path_nameThe path name of the data updater.
updaterThe data updater.

在文件 updater_manager.cc51 行定义.

52 {
53 updater_map_[path_name] = updater;
54}

◆ Start()

bool apollo::dreamview::UpdaterManager::Start ( const std::string &  path_name,
const double &  time_interval_ms,
const std::string &  channel_name = "",
nlohmann::json *  subscribe_param = nullptr 
)

Start a updater implemetnent.

参数
path_nameThe path name of the data updater.
time_interval_msData update frequency, If field time_interval_ms equals to 0, it is considered a single subscribe and will not start timer
subscribe_parambring extra params for some updater.

在文件 updater_manager.cc23 行定义.

26 {
27 auto iter = updater_map_.find(path_name);
28 if (iter == updater_map_.end()) {
29 AERROR << "Related data updater for " << path_name
30 << " is not exists, failed to start!";
31 return false;
32 }
33 UpdaterBase* updater = iter->second;
34 updater->StartStream(time_interval_ms, channel_name, subscribe_param);
35 return true;
36}
#define AERROR
Definition log.h:44

◆ Stop()

bool apollo::dreamview::UpdaterManager::Stop ( const std::string &  path_name,
const std::string &  channel_name 
)

Stop updater publish data.

参数
path_nameThe path name of the data updater.

在文件 updater_manager.cc38 行定义.

39 {
40 auto iter = updater_map_.find(path_name);
41 if (iter == updater_map_.end()) {
42 AERROR << "Related data updater for " << path_name
43 << " is not exists,failed to stop!";
44 return false;
45 }
46 UpdaterBase* updater = iter->second;
47 updater->StopStream(channel_name);
48 return true;
49}

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