Apollo  6.0
Open source self driving car software
Public Member Functions | Protected Attributes | List of all members
apollo::cyber::WriterBase Class Referenceabstract

Base class for a Writer. A Writer is an object to send messages through a 'Channel'. More...

#include <writer_base.h>

Inheritance diagram for apollo::cyber::WriterBase:
Inheritance graph
Collaboration diagram for apollo::cyber::WriterBase:
Collaboration graph

Public Member Functions

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

Protected Attributes

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

Detailed Description

Base class for a Writer. A Writer is an object to send messages through a 'Channel'.

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

Constructor & Destructor Documentation

◆ WriterBase()

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

Construct a new Writer Base object.

Parameters
role_attrrole attributes for this Writer

◆ ~WriterBase()

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

Member Function Documentation

◆ GetChannelName()

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

Get Writer's Channel name.

Returns
const std::string& const reference to the channel name

◆ GetReaders()

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

Get all Readers that subscriber our writing channel.

Parameters
readersresult vector of RoleAttributes

Reimplemented in apollo::cyber::Writer< MessageT >.

◆ HasReader()

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

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

Returns
true if the channel has reader
false if the channel has no reader

Reimplemented in apollo::cyber::Writer< MessageT >.

◆ Init()

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

Init the Writer.

Returns
true if init success
false if init failed

Implemented in apollo::cyber::Writer< MessageT >, and apollo::cyber::blocker::IntraWriter< MessageT >.

◆ IsInit()

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

Is Writer initialized?

Returns
true if the Writer is inited
false if the Write is not inited

◆ Shutdown()

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

Member Data Documentation

◆ init_

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

◆ lock_

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

◆ role_attr_

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

The documentation for this class was generated from the following file: