Apollo 10.0
自动驾驶开放平台
apollo::cyber::PyWriter类 参考

#include <py_cyber.h>

apollo::cyber::PyWriter 的协作图:

Public 成员函数

 PyWriter (const std::string &channel, const std::string &type, const uint32_t qos_depth, Node *node)
 
int write (const std::string &data)
 

详细描述

在文件 py_cyber.h71 行定义.

构造及析构函数说明

◆ PyWriter()

apollo::cyber::PyWriter::PyWriter ( const std::string &  channel,
const std::string &  type,
const uint32_t  qos_depth,
Node node 
)
inline

在文件 py_cyber.h73 行定义.

75 : channel_name_(channel),
76 data_type_(type),
77 qos_depth_(qos_depth),
78 node_(node) {
79 std::string proto_desc;
80 message::ProtobufFactory::Instance()->GetDescriptorString(type,
81 &proto_desc);
82 if (proto_desc.empty()) {
83 AWARN << "cpp can't find proto_desc msgtype->" << data_type_;
84 return;
85 }
86 proto::RoleAttributes role_attr;
87 role_attr.set_channel_name(channel_name_);
88 role_attr.set_message_type(data_type_);
89 role_attr.set_proto_desc(proto_desc);
90 auto qos_profile = role_attr.mutable_qos_profile();
91 qos_profile->set_depth(qos_depth_);
92 writer_ = node_->CreateWriter<message::PyMessageWrap>(role_attr);
93 }
auto CreateWriter(const proto::RoleAttributes &role_attr) -> std::shared_ptr< Writer< MessageT > >
Create a Writer with specific message type.
Definition node.h:192
#define AWARN
Definition log.h:43

成员函数说明

◆ write()

int apollo::cyber::PyWriter::write ( const std::string &  data)
inline

在文件 py_cyber.h95 行定义.

95 {
96 auto message = std::make_shared<message::PyMessageWrap>(data, data_type_);
97 message->set_type_name(data_type_);
98 return writer_->Write(message);
99 }

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