Apollo 10.0
自动驾驶开放平台
apollo::cyber::ClientBase类 参考abstract

Base class of Client 更多...

#include <client_base.h>

类 apollo::cyber::ClientBase 继承关系图:
apollo::cyber::ClientBase 的协作图:

Public 成员函数

 ClientBase (const std::string &service_name)
 Construct a new Client Base object
 
virtual ~ClientBase ()
 
virtual void Destroy ()=0
 Destroy the Client
 
const std::string & ServiceName () const
 Get the service name
 
virtual bool ServiceIsReady () const =0
 Ensure whether there is any Service named service_name_
 

Protected 成员函数

bool WaitForServiceNanoseconds (std::chrono::nanoseconds time_out)
 

Protected 属性

std::string service_name_
 

详细描述

Base class of Client

在文件 client_base.h33 行定义.

构造及析构函数说明

◆ ClientBase()

apollo::cyber::ClientBase::ClientBase ( const std::string &  service_name)
inlineexplicit

Construct a new Client Base object

参数
service_namethe service we can request

在文件 client_base.h40 行定义.

41 : service_name_(service_name) {}

◆ ~ClientBase()

virtual apollo::cyber::ClientBase::~ClientBase ( )
inlinevirtual

在文件 client_base.h42 行定义.

42{}

成员函数说明

◆ Destroy()

virtual void apollo::cyber::ClientBase::Destroy ( )
pure virtual

Destroy the Client

apollo::cyber::Client< Request, Response > 内被实现.

◆ ServiceIsReady()

virtual bool apollo::cyber::ClientBase::ServiceIsReady ( ) const
pure virtual

Ensure whether there is any Service named service_name_

apollo::cyber::Client< Request, Response > 内被实现.

◆ ServiceName()

const std::string & apollo::cyber::ClientBase::ServiceName ( ) const
inline

Get the service name

在文件 client_base.h52 行定义.

52{ return service_name_; }

◆ WaitForServiceNanoseconds()

bool apollo::cyber::ClientBase::WaitForServiceNanoseconds ( std::chrono::nanoseconds  time_out)
inlineprotected

在文件 client_base.h62 行定义.

62 {
63 bool has_service = false;
64 auto step_duration = std::chrono::nanoseconds(5 * 1000 * 1000);
65 while (time_out.count() > 0) {
66 has_service = service_discovery::TopologyManager::Instance()
67 ->service_manager()
68 ->HasService(service_name_);
69 if (!has_service) {
70 std::this_thread::sleep_for(step_duration);
71 time_out -= step_duration;
72 } else {
73 break;
74 }
75 }
76 return has_service;
77 }

类成员变量说明

◆ service_name_

std::string apollo::cyber::ClientBase::service_name_
protected

在文件 client_base.h60 行定义.


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