Apollo 10.0
自动驾驶开放平台
|
Reader subscribes a channel, it has two main functions: 更多...
#include <reader.h>
Public 类型 | |
using | BlockerPtr = std::unique_ptr< blocker::Blocker< MessageT > > |
using | ReceiverPtr = std::shared_ptr< transport::Receiver< MessageT > > |
using | ChangeConnection = typename service_discovery::Manager::ChangeConnection |
using | Iterator = typename std::list< std::shared_ptr< MessageT > >::const_iterator |
Public 成员函数 | |
Reader (const proto::RoleAttributes &role_attr, const CallbackFunc< MessageT > &reader_func=nullptr, uint32_t pending_queue_size=DEFAULT_PENDING_QUEUE_SIZE) | |
Constructor a Reader object. | |
virtual | ~Reader () |
bool | Init () override |
Init Reader | |
void | Shutdown () override |
Shutdown Reader | |
void | Observe () override |
Get All data that Blocker stores | |
void | ClearData () override |
Clear Blocker 's data | |
bool | HasReceived () const override |
Query whether we have received data since last clear | |
bool | Empty () const override |
Query whether the Reader has data to be handled | |
double | GetDelaySec () const override |
Get time interval of since last receive message | |
uint32_t | PendingQueueSize () const override |
Get pending_queue_size configuration | |
virtual void | Enqueue (const std::shared_ptr< MessageT > &msg) |
Push msg to Blocker's PublishQueue | |
virtual void | SetHistoryDepth (const uint32_t &depth) |
Set Blocker's PublishQueue 's capacity to depth | |
virtual uint32_t | GetHistoryDepth () const |
Get Blocker's PublishQueue 's capacity | |
virtual std::shared_ptr< MessageT > | GetLatestObserved () const |
Get the latest message we Observe | |
virtual std::shared_ptr< MessageT > | GetOldestObserved () const |
Get the oldest message we Observe | |
virtual Iterator | Begin () const |
Get the begin iterator of ObserveQueue , used to traverse | |
virtual Iterator | End () const |
Get the end iterator of ObserveQueue , used to traverse | |
bool | HasWriter () override |
Is there is at least one writer publish the channel that we subscribes? | |
void | GetWriters (std::vector< proto::RoleAttributes > *writers) override |
Get all writers pushlish the channel we subscribes | |
![]() | |
ReaderBase (const proto::RoleAttributes &role_attr) | |
virtual | ~ReaderBase () |
const std::string & | GetChannelName () const |
Get Reader's Channel name | |
uint64_t | ChannelId () const |
Get Reader's Channel id | |
const proto::QosProfile & | QosProfile () const |
Get qos profile. | |
bool | IsInit () const |
Query whether the Reader is initialized | |
Protected 属性 | |
double | latest_recv_time_sec_ = -1.0 |
double | second_to_lastest_recv_time_sec_ = -1.0 |
uint32_t | pending_queue_size_ |
![]() | |
proto::RoleAttributes | role_attr_ |
std::atomic< bool > | init_ |
Reader subscribes a channel, it has two main functions:
CallbackFunc
to handle the message then it arrivedPublishQueue
, and we can use Observe
to fetch messages from PublishQueue
to ObserveQueue
. But, if you have set CallbackFunc, you can ignore this. One Reader uses one ChannelBuffer
, the message we are handling is stored in ChannelBuffer Reader will Join the topology when init and Leave the topology when shutdown ChannelBuffer
has limited length, it's passed through the pending_queue_size
param. pending_queue_size is default set to 1, So, If you handle slower than writer sending, older messages that are not handled will be lost. You can increase pending_queue_size
to resolve this problem. using apollo::cyber::Reader< MessageT >::BlockerPtr = std::unique_ptr<blocker::Blocker<MessageT> > |
using apollo::cyber::Reader< MessageT >::ChangeConnection = typename service_discovery::Manager::ChangeConnection |
using apollo::cyber::Reader< MessageT >::Iterator = typename std::list<std::shared_ptr<MessageT> >::const_iterator |
using apollo::cyber::Reader< MessageT >::ReceiverPtr = std::shared_ptr<transport::Receiver<MessageT> > |
|
explicit |
Constructor a Reader object.
role_attr | is a protobuf message RoleAttributes, which includes the channel name and other info. |
reader_func | is the callback function, when the message is received. |
pending_queue_size | is the max depth of message cache queue. |
|
virtual |
|
inlinevirtual |
Get the begin iterator of ObserveQueue
, used to traverse
被 apollo::cyber::blocker::IntraReader< MessageT > 重载.
|
overridevirtual |
Clear Blocker
's data
实现了 apollo::cyber::ReaderBase.
|
overridevirtual |
Query whether the Reader has data to be handled
实现了 apollo::cyber::ReaderBase.
|
inlinevirtual |
Get the end iterator of ObserveQueue
, used to traverse
被 apollo::cyber::blocker::IntraReader< MessageT > 重载.
|
virtual |
Push msg
to Blocker's PublishQueue
msg | message ptr to be pushed |
被 apollo::cyber::blocker::IntraReader< MessageT > 重载.
|
overridevirtual |
Get time interval of since last receive message
实现了 apollo::cyber::ReaderBase.
|
virtual |
Get Blocker's PublishQueue
's capacity
被 apollo::cyber::blocker::IntraReader< MessageT > 重载.
|
virtual |
Get the latest message we Observe
被 apollo::cyber::blocker::IntraReader< MessageT > 重载.
|
virtual |
Get the oldest message we Observe
被 apollo::cyber::blocker::IntraReader< MessageT > 重载.
|
overridevirtual |
Get all writers pushlish the channel we subscribes
writers | result vector of RoleAttributes |
重载 apollo::cyber::ReaderBase .
|
overridevirtual |
Query whether we have received data since last clear
实现了 apollo::cyber::ReaderBase.
|
overridevirtual |
Is there is at least one writer publish the channel that we subscribes?
重载 apollo::cyber::ReaderBase .
|
overridevirtual |
Init Reader
实现了 apollo::cyber::ReaderBase.
|
overridevirtual |
|
overridevirtual |
Get pending_queue_size configuration
|
virtual |
Set Blocker's PublishQueue
's capacity to depth
depth | the value you want to set |
被 apollo::cyber::blocker::IntraReader< MessageT > 重载.
|
overridevirtual |
Shutdown Reader
实现了 apollo::cyber::ReaderBase.
|
protected |
|
protected |
|
protected |