Apollo 11.0
自动驾驶开放平台
apollo::dreamview::UpdaterWithChannelsBase类 参考abstract

Base Class for data updater with multiply channels. 更多...

#include <updater_with_channels_base.h>

类 apollo::dreamview::UpdaterWithChannelsBase 继承关系图:
apollo::dreamview::UpdaterWithChannelsBase 的协作图:

Public 成员函数

virtual void GetChannelMsg (std::vector< std::string > *channels)=0
 GetChannelMsg
 
void GetChannelMsgWithFilter (std::vector< std::string > *channels, const std::string &filter_message_type, const std::string &filter_channel, bool reverse_filter_channel=false)
 GetChannelMsgWithFilter:by msg type and channel filter field to filter channels for DataUpdater
 
- Public 成员函数 继承自 apollo::dreamview::UpdaterBase
 UpdaterBase ()
 Updaterbase
 
virtual void StartStream (const double &time_interval_ms, const std::string &channel_name="", nlohmann::json *subscribe_param=nullptr)=0
 Start data flow.
 
virtual void StopStream (const std::string &channel_name="")=0
 Stop data flow.
 
virtual void PublishMessage (const std::string &channel_name="")=0
 Publish Message to dreamview frontend.
 
virtual ~UpdaterBase ()
 

Public 属性

std::vector< std::string > channels_
 

详细描述

Base Class for data updater with multiply channels.

The updater is responsible for maintaining and updating a data type used by the dreamview module, such as simulation_world, pointcloud, camera, pointcloud etc. Each type of data is a data stream that supports front-end and back-end communication of dreamview.

在文件 updater_with_channels_base.h 第 40 行定义.

成员函数说明

◆ GetChannelMsg()

virtual void apollo::dreamview::UpdaterWithChannelsBase::GetChannelMsg ( std::vector< std::string > *  channels)
pure virtual

◆ GetChannelMsgWithFilter()

void apollo::dreamview::UpdaterWithChannelsBase::GetChannelMsgWithFilter ( std::vector< std::string > *  channels,
const std::string &  filter_message_type,
const std::string &  filter_channel,
bool  reverse_filter_channel = false 
)

GetChannelMsgWithFilter:by msg type and channel filter field to filter channels for DataUpdater

参数
channelsoutput channel list
filter_message_typemessage type to filter channels
filter_channelchannel field to filter channels
reverse_filter_channelwhether to filter out the channel,default to false,if ture,filter out the channel list that contains filter_channel else,filter out the channel list that not contains filter_channel

在文件 updater_with_channels_base.cc 第 27 行定义.

29 {
30 auto channelManager =
31 apollo::cyber::service_discovery::TopologyManager::Instance()
32 ->channel_manager();
33 std::vector<apollo::cyber::proto::RoleAttributes> role_attr_vec;
34 channelManager->GetWriters(&role_attr_vec);
35 std::vector<std::string> records;
36 std::vector<std::string> other_record_node_name;
37 auto *record_player_factory = RecordPlayerFactory::Instance();
38 record_player_factory->GetAllRecords(&records);
39 const std::string current_record = record_player_factory->GetCurrentRecord();
40 for (auto iter = records.begin(); iter != records.end(); iter++) {
41 if (current_record.empty() || *iter != current_record) {
42 std::string other_node_name = "record_player_factory_" + *iter;
43 other_record_node_name.push_back(other_node_name);
44 }
45 }
46 std::vector<std::string> tmp_channels;
47 for (auto &role_attr : role_attr_vec) {
48 std::string messageType;
49 std::string node_name;
50 messageType = role_attr.message_type();
51 node_name = role_attr.node_name();
52 int index = 0;
53 if (!filter_message_type.empty()) {
54 index = messageType.rfind(filter_message_type);
55 }
56 int index_channel = 0;
57 bool select_current_channel = filter_channel.empty();
58 if (!filter_channel.empty()) {
59 index_channel = role_attr.channel_name().rfind(filter_channel);
60 select_current_channel = reverse_filter_channel ? (index_channel == -1)
61 : (index_channel != -1);
62 }
63 if (index != -1 && select_current_channel) {
64 if (current_record.empty() ||
65 std::find(other_record_node_name.begin(),
66 other_record_node_name.end(),
67 node_name) == other_record_node_name.end()) {
68 tmp_channels.push_back(role_attr.channel_name());
69 }
70 }
71 }
72 std::set<std::string> s(tmp_channels.begin(), tmp_channels.end());
73 channels->assign(tmp_channels.begin(), tmp_channels.end());
74 channels_.clear();
75 channels_.assign(s.begin(), s.end());
76}

类成员变量说明

◆ channels_

std::vector<std::string> apollo::dreamview::UpdaterWithChannelsBase::channels_

在文件 updater_with_channels_base.h 第 59 行定义.


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