Apollo 11.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.h70 行定义.

构造及析构函数说明

◆ PyWriter()

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

在文件 py_cyber.h72 行定义.

74 : channel_name_(channel),
75 data_type_(type),
76 qos_depth_(qos_depth),
77 node_(node) {
78 std::string proto_desc;
79 message::ProtobufFactory::Instance()->GetDescriptorString(type,
80 &proto_desc);
81 if (proto_desc.empty()) {
82 AWARN << "cpp can't find proto_desc msgtype->" << data_type_;
83 return;
84 }
85 proto::RoleAttributes role_attr;
86 role_attr.set_channel_name(channel_name_);
87 role_attr.set_message_type(data_type_);
88 role_attr.set_proto_desc(proto_desc);
89 auto qos_profile = role_attr.mutable_qos_profile();
90 qos_profile->set_depth(qos_depth_);
91 writer_ = node_->CreateWriter<message::PyMessageWrap>(role_attr);
92 }
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.h94 行定义.

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

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