#include <py_cyber.h>
|
| | PyReader (const std::string &channel, const std::string &type, Node *node) |
| |
| void | register_func (int(*func)(const char *)) |
| |
| std::string | read (bool wait=false) |
| |
◆ PyReader()
| apollo::cyber::PyReader::PyReader |
( |
const std::string & |
channel, |
|
|
const std::string & |
type, |
|
|
Node * |
node |
|
) |
| |
|
inline |
在文件 py_cyber.h 第 111 行定义.
112 : channel_name_(channel), data_type_(type), node_(node), func_(nullptr) {
115 [this](const std::shared_ptr<const message::PyMessageWrap>& request) {
116 this->cb(request);
117 };
118 reader_ = node_->
CreateReader<message::PyMessageWrap>(channel,
f);
119 } else {
121 [this](const std::shared_ptr<const message::RawMessage>& request) {
122 this->cb_rawmsg(request);
123 };
124 reader_rawmsg_ = node_->
CreateReader<message::RawMessage>(channel,
f);
125 }
126 }
auto CreateReader(const std::string &channel_name, const CallbackFunc< MessageT > &reader_func=nullptr) -> std::shared_ptr< cyber::Reader< MessageT > >
Create a Reader with specific message type with channel name qos and other configs used will be defau...
◆ read()
| std::string apollo::cyber::PyReader::read |
( |
bool |
wait = false | ) |
|
|
inline |
在文件 py_cyber.h 第 130 行定义.
130 {
131 std::string msg("");
132 std::unique_lock<std::mutex> ul(msg_lock_);
133 if (!cache_.empty()) {
134 msg = std::move(cache_.front());
135 cache_.pop_front();
136 }
137
138 if (!wait) {
139 return msg;
140 }
141
142 msg_cond_.wait(ul, [this] { return !this->cache_.empty(); });
143 if (!cache_.empty()) {
144 msg = std::move(cache_.front());
145 cache_.pop_front();
146 }
147
148 return msg;
149 }
◆ register_func()
| void apollo::cyber::PyReader::register_func |
( |
int(*)(const char *) |
func | ) |
|
|
inline |
该类的文档由以下文件生成: