#include <msg_converter.h>
|
template<class U , class V > |
using | Callback = bool(*)(const std::shared_ptr< U > &, V *) |
|
◆ Callback
template<class U , class V >
◆ MsgConverter() [1/2]
apollo::perception::MsgConverter::MsgConverter |
( |
| ) |
|
|
default |
◆ MsgConverter() [2/2]
apollo::perception::MsgConverter::MsgConverter |
( |
const std::shared_ptr< cyber::Node > & |
node | ) |
|
|
inlineexplicit |
◆ ~MsgConverter()
virtual apollo::perception::MsgConverter::~MsgConverter |
( |
| ) |
|
|
virtualdefault |
◆ Add()
template<class From , class To >
bool apollo::perception::MsgConverter::Add |
( |
const std::string & |
from_topic, |
|
|
const std::string & |
to_topic, |
|
|
Callback< From, To > |
convert |
|
) |
| |
在文件 msg_converter.h 第 53 行定义.
55 {
56 AINFO <<
"Convert: " << from_topic <<
" to " << to_topic;
57 auto writer = node_->CreateWriter<To>(to_topic);
58 auto reader = node_->CreateReader<From>(
59 from_topic, [=](const std::shared_ptr<From> &from) {
60 std::shared_ptr<To> to(new To());
61 bool res = convert(from, to.get());
62 if (res) {
63 writer->Write(to);
64 }
65 });
66
67 writers_.push_back(writer);
68 readers_.push_back(reader);
69 return true;
70}
该类的文档由以下文件生成: