#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 第 112 行定义.
113 : channel_name_(channel), data_type_(type), node_(node), func_(nullptr) {
116 [this](const std::shared_ptr<const message::PyMessageWrap>& request) {
117 this->cb(request);
118 };
119 reader_ = node_->
CreateReader<message::PyMessageWrap>(channel,
f);
120 } else {
122 [this](const std::shared_ptr<const message::RawMessage>& request) {
123 this->cb_rawmsg(request);
124 };
125 reader_rawmsg_ = node_->
CreateReader<message::RawMessage>(channel,
f);
126 }
127 }
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 第 131 行定义.
131 {
132 std::string msg("");
133 std::unique_lock<std::mutex> ul(msg_lock_);
134 if (!cache_.empty()) {
135 msg = std::move(cache_.front());
136 cache_.pop_front();
137 }
138
139 if (!wait) {
140 return msg;
141 }
142
143 msg_cond_.wait(ul, [this] { return !this->cache_.empty(); });
144 if (!cache_.empty()) {
145 msg = std::move(cache_.front());
146 cache_.pop_front();
147 }
148
149 return msg;
150 }
◆ register_func()
void apollo::cyber::PyReader::register_func |
( |
int(*)(const char *) |
func | ) |
|
|
inline |
该类的文档由以下文件生成: