Apollo 10.0
自动驾驶开放平台
|
Client get Response
from a responding Service
by sending a Request
更多...
#include <client.h>
Public 类型 | |
using | SharedRequest = typename std::shared_ptr< Request > |
using | SharedResponse = typename std::shared_ptr< Response > |
using | Promise = std::promise< SharedResponse > |
using | SharedPromise = std::shared_ptr< Promise > |
using | SharedFuture = std::shared_future< SharedResponse > |
using | CallbackType = std::function< void(SharedFuture)> |
Public 成员函数 | |
Client (const std::string &node_name, const std::string &service_name) | |
Construct a new Client object | |
Client ()=delete | |
forbid Constructing a new Client object with empty params | |
virtual | ~Client () |
bool | Init () |
Init the Client | |
SharedResponse | SendRequest (SharedRequest request, const std::chrono::seconds &timeout_s=std::chrono::seconds(5)) |
Request the Service with a shared ptr Request type | |
SharedResponse | SendRequest (const Request &request, const std::chrono::seconds &timeout_s=std::chrono::seconds(5)) |
Request the Service with a Request object | |
SharedFuture | AsyncSendRequest (SharedRequest request) |
Send Request shared ptr asynchronously | |
SharedFuture | AsyncSendRequest (const Request &request) |
Send Request object asynchronously | |
SharedFuture | AsyncSendRequest (SharedRequest request, CallbackType &&cb) |
Send Request shared ptr asynchronously and invoke cb after we get response | |
bool | ServiceIsReady () const |
Is the Service is ready? | |
void | Destroy () |
destroy this Client | |
template<typename RatioT = std::milli> | |
bool | WaitForService (std::chrono::duration< int64_t, RatioT > timeout=std::chrono::duration< int64_t, RatioT >(-1)) |
wait for the connection with the Service established | |
![]() | |
ClientBase (const std::string &service_name) | |
Construct a new Client Base object | |
virtual | ~ClientBase () |
const std::string & | ServiceName () const |
Get the service name | |
额外继承的成员函数 | |
![]() | |
bool | WaitForServiceNanoseconds (std::chrono::nanoseconds time_out) |
![]() | |
std::string | service_name_ |
Client get Response
from a responding Service
by sending a Request
using apollo::cyber::Client< Request, Response >::CallbackType = std::function<void(SharedFuture)> |
using apollo::cyber::Client< Request, Response >::Promise = std::promise<SharedResponse> |
using apollo::cyber::Client< Request, Response >::SharedFuture = std::shared_future<SharedResponse> |
using apollo::cyber::Client< Request, Response >::SharedPromise = std::shared_ptr<Promise> |
using apollo::cyber::Client< Request, Response >::SharedRequest = typename std::shared_ptr<Request> |
using apollo::cyber::Client< Request, Response >::SharedResponse = typename std::shared_ptr<Response> |
|
inline |
Construct a new Client object
node_name | used to fill RoleAttribute |
service_name | service name the Client can request |
|
delete |
forbid Constructing a new Client object with empty params
|
inlinevirtual |
Client< Request, Response >::SharedFuture Client::AsyncSendRequest | ( | const Request & | request | ) |
Send Request object asynchronously
Client< Request, Response >::SharedFuture Client::AsyncSendRequest | ( | SharedRequest | request | ) |
Send Request shared ptr asynchronously
Client< Request, Response >::SharedFuture Client::AsyncSendRequest | ( | SharedRequest | request, |
CallbackType && | cb | ||
) |
Send Request shared ptr asynchronously and invoke cb
after we get response
request | Request shared ptr |
cb | callback function after we get response |
std::future
shared ptr
|
virtual |
bool Client::Init | ( | ) |
Init the Client
Client< Request, Response >::SharedResponse Client::SendRequest | ( | const Request & | request, |
const std::chrono::seconds & | timeout_s = std::chrono::seconds(5) |
||
) |
Request the Service with a Request object
request | Request object |
timeout_s | request timeout, if timeout, response will be empty |
Client< Request, Response >::SharedResponse Client::SendRequest | ( | SharedRequest | request, |
const std::chrono::seconds & | timeout_s = std::chrono::seconds(5) |
||
) |
Request the Service with a shared ptr Request type
request | shared ptr of Request type |
timeout_s | request timeout, if timeout, response will be empty |
|
virtual |
|
inline |
wait for the connection with the Service established
RatioT | timeout unit, default is std::milli |
timeout | wait time in unit of RatioT |