Apollo  6.0
Open source self driving car software
Public Types | Public Member Functions | List of all members
apollo::cyber::Writer< MessageT > Class Template Reference

#include <writer.h>

Inheritance diagram for apollo::cyber::Writer< MessageT >:
Inheritance graph
Collaboration diagram for apollo::cyber::Writer< MessageT >:
Collaboration graph

Public Types

using TransmitterPtr = std::shared_ptr< transport::Transmitter< MessageT > >
 
using ChangeConnection = typename service_discovery::Manager::ChangeConnection
 

Public Member Functions

 Writer (const proto::RoleAttributes &role_attr)
 Construct a new Writer object. More...
 
virtual ~Writer ()
 
bool Init () override
 Init the Writer. More...
 
void Shutdown () override
 Shutdown the Writer. More...
 
virtual bool Write (const MessageT &msg)
 Write a MessageT instance. More...
 
virtual bool Write (const std::shared_ptr< MessageT > &msg_ptr)
 Write a shared ptr of MessageT. More...
 
bool HasReader () override
 Is there any Reader that subscribes our Channel? You can publish message when this return true. More...
 
void GetReaders (std::vector< proto::RoleAttributes > *readers) override
 Get all Readers that subscriber our writing channel. More...
 
- Public Member Functions inherited from apollo::cyber::WriterBase
 WriterBase (const proto::RoleAttributes &role_attr)
 Construct a new Writer Base object. More...
 
virtual ~WriterBase ()
 
const std::string & GetChannelName () const
 Get Writer's Channel name. More...
 
bool IsInit () const
 Is Writer initialized? More...
 

Additional Inherited Members

- Protected Attributes inherited from apollo::cyber::WriterBase
proto::RoleAttributes role_attr_
 
std::mutex lock_
 
bool init_
 

Member Typedef Documentation

◆ ChangeConnection

template<typename MessageT>
using apollo::cyber::Writer< MessageT >::ChangeConnection = typename service_discovery::Manager::ChangeConnection

◆ TransmitterPtr

template<typename MessageT>
using apollo::cyber::Writer< MessageT >::TransmitterPtr = std::shared_ptr<transport::Transmitter<MessageT> >

Constructor & Destructor Documentation

◆ Writer()

template<typename MessageT >
apollo::cyber::Writer< MessageT >::Writer ( const proto::RoleAttributes &  role_attr)
explicit

Construct a new Writer object.

Parameters
role_attrwe use RoleAttributes to identify a Writer

◆ ~Writer()

template<typename MessageT >
apollo::cyber::Writer< MessageT >::~Writer ( )
virtual

Member Function Documentation

◆ GetReaders()

template<typename MessageT >
void apollo::cyber::Writer< MessageT >::GetReaders ( std::vector< proto::RoleAttributes > *  readers)
overridevirtual

Get all Readers that subscriber our writing channel.

Parameters
readersvector result of RoleAttributes

Reimplemented from apollo::cyber::WriterBase.

◆ HasReader()

template<typename MessageT >
bool apollo::cyber::Writer< MessageT >::HasReader ( )
overridevirtual

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 from apollo::cyber::WriterBase.

◆ Init()

template<typename MessageT >
bool apollo::cyber::Writer< MessageT >::Init ( )
overridevirtual

Init the Writer.

Returns
true if init successfully
false if init failed

Implements apollo::cyber::WriterBase.

◆ Shutdown()

template<typename MessageT >
void apollo::cyber::Writer< MessageT >::Shutdown ( )
overridevirtual

Shutdown the Writer.

Implements apollo::cyber::WriterBase.

◆ Write() [1/2]

template<typename MessageT >
bool apollo::cyber::Writer< MessageT >::Write ( const MessageT &  msg)
virtual

Write a MessageT instance.

Parameters
msgthe message we want to write
Returns
true if write successfully
false if write failed

Reimplemented in apollo::cyber::blocker::IntraWriter< MessageT >.

◆ Write() [2/2]

template<typename MessageT >
bool apollo::cyber::Writer< MessageT >::Write ( const std::shared_ptr< MessageT > &  msg_ptr)
virtual

Write a shared ptr of MessageT.

Parameters
msg_ptrthe message shared ptr we want to write
Returns
true if write successfully
false if write failed

Reimplemented in apollo::cyber::blocker::IntraWriter< MessageT >.


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