17 DATA_READY = UINT32_MAX
35 std::atomic<ASyncSubscriberState>
state =
45template <
typename Data>
71 Topic::CheckSubscriberType<Data>(topic);
76 block_->data_.buff_addr = Topic::AllocateSubscriberBuffer<Data>();
77 block_->data_.copy_payload = &Topic::CopyPayload<Data>;
106 other.block_ =
nullptr;
124 other.block_ =
nullptr;
136 return block_->data_.state.load(std::memory_order_acquire) ==
152 if (
block_->data_.state.load(std::memory_order_acquire) ==
157 return *
reinterpret_cast<Data*
>(
block_->data_.buff_addr);
数据节点模板,继承自 BaseNode,用于存储具体数据类型。 Template data node that inherits from BaseNode to store specific data...
Data data_
存储的数据 / The stored data.
微秒时间戳 / Microsecond timestamp
Data data_
存储的数据 / Stored data.
先 StartWaiting(),再自己来取数据的订阅者 / Subscriber that first calls StartWaiting() and later pulls the data it...
ASyncSubscriber(Topic topic)
通过 Topic 句柄构造异步订阅者 / Construct an asynchronous subscriber from a Topic handle
ASyncSubscriber(ASyncSubscriber &&other) noexcept
移动构造异步订阅者 / Move-construct one asynchronous subscriber
ASyncSubscriber(const ASyncSubscriber &other)=delete
禁止拷贝异步订阅者 / Copy construction is disabled for asynchronous subscribers
Data & GetData()
获取当前数据 / Retrieve the current data
ASyncSubscriber & operator=(const ASyncSubscriber &other)=delete
禁止拷贝赋值异步订阅者 / Copy assignment is disabled for asynchronous subscribers
LockFreeList::Node< ASyncBlock > * block_
订阅者数据块 / Subscriber data block.
bool Available()
检查数据是否可用 / Check whether data is available
MicrosecondTimestamp GetTimestamp() const
获取最近一次接收的消息时间戳 / Get the latest received message timestamp
ASyncSubscriber(const char *name, Domain *domain=nullptr)
通过主题名称构造异步订阅者 / Construct an asynchronous subscriber by topic name
ASyncSubscriber & operator=(ASyncSubscriber &&other) noexcept
移动赋值异步订阅者 / Move-assign one asynchronous subscriber
void StartWaiting()
开始等待数据更新 / Start waiting for a data update
topic 所属的命名域 / Naming domain that groups topics
发布订阅主题 / Publish-subscribe topic
@ ASYNC
异步本地缓冲型订阅者 / Asynchronous local-buffer subscriber.
ASyncSubscriberState
异步订阅者本地缓冲区的状态 / State of the async subscriber's local buffer
static TopicHandle WaitTopic(const char *name, uint32_t timeout=UINT32_MAX, Domain *domain=nullptr)
等待指定名称的 topic 出现 / Wait until a topic with the given name exists
LibXR 命名空间 / LibXR namespace.
异步订阅者自己挂的数据块 / Data block owned by one asynchronous subscriber
std::atomic< ASyncSubscriberState > state
当前异步订阅状态 / Current async subscriber state.
void(* copy_payload)(void *dst, void *payload_addr)
MicrosecondTimestamp timestamp
最近接收的消息时间戳 / Latest received message timestamp.
所有订阅块共用的公共头 / Common header shared by all subscriber blocks