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

Base class for a Writer. 更多...

#include <writer_base.h>

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

Public 成员函数

 WriterBase (const proto::RoleAttributes &role_attr)
 Construct a new Writer Base object
 
virtual ~WriterBase ()
 
virtual bool Init ()=0
 Init the Writer
 
virtual void Shutdown ()=0
 Shutdown the Writer
 
virtual bool HasReader ()
 Is there any Reader that subscribes our Channel? You can publish message when this return true
 
virtual void GetReaders (std::vector< proto::RoleAttributes > *readers)
 Get all Readers that subscriber our writing channel
 
const std::string & GetChannelName () const
 Get Writer's Channel name
 
const uint64_t GetChannelId () const
 Get Writer's Channel id
 
bool IsInit () const
 Is Writer initialized?
 

Protected 属性

proto::RoleAttributes role_attr_
 
std::mutex lock_
 
bool init_
 

详细描述

Base class for a Writer.

A Writer is an object to send messages through a 'Channel'

警告
One Writer can only write one channel. But different writers can write through the same channel

在文件 writer_base.h37 行定义.

构造及析构函数说明

◆ WriterBase()

apollo::cyber::WriterBase::WriterBase ( const proto::RoleAttributes role_attr)
inlineexplicit

Construct a new Writer Base object

参数
role_attrrole attributes for this Writer

在文件 writer_base.h44 行定义.

45 : role_attr_(role_attr), init_(false) {}
proto::RoleAttributes role_attr_

◆ ~WriterBase()

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

在文件 writer_base.h46 行定义.

46{}

成员函数说明

◆ GetChannelId()

const uint64_t apollo::cyber::WriterBase::GetChannelId ( ) const
inline

Get Writer's Channel id

返回
const uint64_t& const reference to the channel id

在文件 writer_base.h91 行定义.

◆ GetChannelName()

const std::string & apollo::cyber::WriterBase::GetChannelName ( ) const
inline

Get Writer's Channel name

返回
const std::string& const reference to the channel name

在文件 writer_base.h82 行定义.

82 {
83 return role_attr_.channel_name();
84 }

◆ GetReaders()

virtual void apollo::cyber::WriterBase::GetReaders ( std::vector< proto::RoleAttributes > *  readers)
inlinevirtual

Get all Readers that subscriber our writing channel

参数
readersresult vector of RoleAttributes

apollo::cyber::Writer< MessageT > 重载.

在文件 writer_base.h75 行定义.

75{}

◆ HasReader()

virtual bool apollo::cyber::WriterBase::HasReader ( )
inlinevirtual

Is there any Reader that subscribes our Channel? You can publish message when this return true

返回
true if the channel has reader
false if the channel has no reader

apollo::cyber::Writer< MessageT > 重载.

在文件 writer_base.h68 行定义.

68{ return false; }

◆ Init()

virtual bool apollo::cyber::WriterBase::Init ( )
pure virtual

Init the Writer

返回
true if init success
false if init failed

apollo::cyber::blocker::IntraWriter< MessageT > , 以及 apollo::cyber::Writer< MessageT > 内被实现.

◆ IsInit()

bool apollo::cyber::WriterBase::IsInit ( ) const
inline

Is Writer initialized?

返回
true if the Writer is inited
false if the Write is not inited

在文件 writer_base.h99 行定义.

99 {
100 std::lock_guard<std::mutex> g(lock_);
101 return init_;
102 }

◆ Shutdown()

virtual void apollo::cyber::WriterBase::Shutdown ( )
pure virtual

类成员变量说明

◆ init_

bool apollo::cyber::WriterBase::init_
protected

在文件 writer_base.h107 行定义.

◆ lock_

std::mutex apollo::cyber::WriterBase::lock_
mutableprotected

在文件 writer_base.h106 行定义.

◆ role_attr_

proto::RoleAttributes apollo::cyber::WriterBase::role_attr_
protected

在文件 writer_base.h105 行定义.


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