Apollo 9.0
自动驾驶开放平台
apollo::cyber::PyClient类 参考

#include <py_cyber.h>

apollo::cyber::PyClient 的协作图:

Public 成员函数

 PyClient (const std::string &name, const std::string &data_type, Node *node)
 
std::string send_request (std::string request)
 

详细描述

在文件 py_cyber.h 第 254 行定义.

构造及析构函数说明

◆ PyClient()

apollo::cyber::PyClient::PyClient ( const std::string &  name,
const std::string &  data_type,
Node *  node 
)
inline

在文件 py_cyber.h 第 256 行定义.

257 : node_(node), service_name_(name), data_type_(data_type) {
258 client_ =
259 node_->CreateClient<message::PyMessageWrap, message::PyMessageWrap>(
260 name);
261 }
auto CreateClient(const std::string &service_name) -> std::shared_ptr< Client< Request, Response > >
Create a Client object to request Service with service_name
Definition node.h:267

成员函数说明

◆ send_request()

std::string apollo::cyber::PyClient::send_request ( std::string  request)
inline

在文件 py_cyber.h 第 263 行定义.

263 {
264 std::shared_ptr<message::PyMessageWrap> m;
265 m.reset(new message::PyMessageWrap(request, data_type_));
266
267 auto response = client_->SendRequest(m);
268 if (response == nullptr) {
269 AINFO << "SendRequest:response is null";
270 return std::string("");
271 }
272 response->ParseFromString(response->data());
273
274 return response->data();
275 }
#define AINFO
Definition log.h:42

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