VLink  2.0.0
A high-performance communication middleware
publisher_impl.h 文件参考

Transport-neutral base class for every event-model publisher implementation. 更多...

#include <chrono>
#include <memory>
#include "./node_impl.h"
publisher_impl.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

class  vlink::PublisherImpl
 Publish-side base shared by every transport-specific publisher. 更多...
 

命名空间

 

详细描述

Transport-neutral base class for every event-model publisher implementation.

This is an internal implementation header used by the public Publisher template; applications should depend on publisher.h. PublisherImpl extends NodeImpl with the publish-side bookkeeping that lets a transport detect subscriber presence and dispatch payloads either as serialised bytes (the common case) or as zero-copy in-process IntraData (only the intra backend overrides that path).

ImplType
The constructor stamps impl_type with kPublisher, allowing discovery and recording layers to label the produced frames correctly.
Lifecycle
  • Construction stamps the impl type and prepares the helper state.
  • The public Publisher template calls init() once the conf is wired.
  • detect_subscribers() may be installed at any time; if a subscriber is already known it fires once immediately.
  • write() (overload chosen by the user) produces frames until interrupt() is called, after which reset_interrupted() can be used to resume.
Role table
Capability Owner
Serialised write path Subclass override of write(const Bytes&)
Zero-copy intra write IntraPublisherImpl override of write(IntraData)
Subscriber presence query Subclass override of has_subscribers()
Presence change publishing update_subscribers() in this class
Wait-for-subscriber gate wait_for_subscribers() / helper CV
Internal API contract
Method Default Subclass duty
has_subscribers() const Pure virtual Query transport
write(const Bytes&) Pure virtual Publish wire frame
write(const IntraData&) Warns, returns false Only intra:// overrides
detect_subscribers(cb) Stores callback Usually inherited
wait_for_subscribers(timeout) Helper CV wait Usually inherited
update_subscribers() Implemented here Call from transport thread