VLink  2.0.0
A high-performance communication middleware
publisher_impl.h File Reference

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

#include <chrono>
#include <memory>
#include "./node_impl.h"
Include dependency graph for publisher_impl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

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

Namespaces

 

Detailed Description

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