|
VLink
2.0.0
A high-performance communication middleware
|
Publish-side base shared by every transport-specific publisher. More...
#include <publisher_impl.h>
Public Member Functions | |
| ~PublisherImpl () override | |
| Releases the helper state. More... | |
| void | interrupt () override |
Wakes waiters and forwards the interrupt to NodeImpl. More... | |
| virtual void | detect_subscribers (ConnectCallback &&callback) |
Registers callback to fire when subscriber presence changes. More... | |
| virtual bool | wait_for_subscribers (std::chrono::milliseconds timeout) |
Blocks until at least one subscriber is reachable or timeout elapses. More... | |
| virtual bool | has_subscribers () const =0 |
| Reports whether at least one subscriber is currently connected. More... | |
| virtual bool | write (const Bytes &msg_data)=0 |
| Publishes a serialised payload to every connected subscriber. More... | |
| virtual bool | write (const IntraData &intra_data) |
| Publishes an in-process payload without serialisation. More... | |
| void | update_subscribers () |
| Notifies the base class that subscriber presence may have changed. More... | |
Public Member Functions inherited from vlink::NodeImpl | |
| virtual void | init ()=0 |
| Brings the underlying transport channel online. More... | |
| virtual void | deinit ()=0 |
| Tears the underlying transport channel down. More... | |
| virtual bool | suspend () |
| Pauses message delivery without releasing the channel. More... | |
| virtual bool | resume () |
Resumes message delivery after suspend(). More... | |
| virtual bool | is_suspend () const |
| Reports whether the node is currently suspended. More... | |
| virtual bool | is_support_loan () const |
| Indicates whether zero-copy loaning is available on this backend. More... | |
| virtual Bytes | loan (int64_t size) |
Borrows a write buffer of size bytes from the transport. More... | |
| virtual bool | return_loan (const Bytes &bytes) |
| Returns a previously loaned buffer to the transport. More... | |
| virtual void | set_manual_unloan (bool manual_unloan) |
| Toggles automatic versus manual release of received loaned buffers. More... | |
| virtual const struct Conf * | get_conf () const |
Returns the associated transport Conf, or nullptr in the base. More... | |
| virtual const AbstractNode * | get_abstract_node () const |
Returns the companion AbstractNode, when the impl is split. More... | |
| virtual Status::BasePtr | get_status (Status::Type type) const |
| Retrieves a transport-specific status object. More... | |
| virtual bool | check_version (const Version &version) |
Compares version with the runtime VLink library version. More... | |
| virtual bool | attach (class MessageLoop *message_loop) |
Attaches the node to a MessageLoop for callback dispatch. More... | |
| virtual bool | detach () |
Detaches the node from its MessageLoop. More... | |
| class MessageLoop * | get_message_loop () const |
Returns the currently attached MessageLoop. More... | |
| template<typename T > | |
| const T * | get_target_conf () const |
Convenience downcast wrapper around get_conf(). More... | |
| void | register_status_handler (StatusCallback &&callback) |
| Installs a DDS-family status handler. More... | |
| bool | has_register_status () const |
| Reports whether a status handler has been registered. More... | |
| void | call_status (Status::BasePtr ptr) |
| Delivers a status notification to the registered handler. More... | |
| void | set_property (const std::string &prop, const std::string &value) |
| Sets a named property on this node. More... | |
| std::string | get_property (const std::string &prop) const |
| Retrieves the value of a named property. More... | |
| Conf::PropertiesMap | get_all_properties () const |
| Returns a copy of every property currently set on this node. More... | |
| void | set_discovery_enabled (bool enable) |
| Toggles whether this node is reported to the discovery layer. More... | |
| bool | get_discovery_enabled () const |
| Returns the current discovery-reporting flag. More... | |
| void | set_record_path (const std::string &path) |
| Configures per-node message recording. More... | |
| bool | enable_security (const Security::Config &cfg) |
| Installs application-layer security from a const-reference config. More... | |
| bool | enable_security (Security::Config &&cfg) |
Installs application-layer security by consuming cfg. More... | |
| void | set_ssl_options (const SslOptions &options) |
| Merges SSL options into the node property map. More... | |
| void | try_record (ActionType action_type, const Bytes &data) |
| Records a message to the global and / or per-node bag writers. More... | |
| void | reset_interrupted () |
Clears the interrupted flag set by interrupt(). More... | |
| bool | is_interrupted () const |
Reports whether interrupt() has been called and not yet reset. More... | |
| void | init_ext () |
| Registers the node with the runtime-owned discovery reporter. More... | |
| void | deinit_ext () |
| Deregisters the node from the runtime-owned discovery reporter. More... | |
Protected Member Functions | |
| PublisherImpl () | |
Stamps the node as kPublisher and primes the helper state. More... | |
Protected Member Functions inherited from vlink::NodeImpl | |
| NodeImpl (ImplType type) | |
| virtual | ~NodeImpl () |
Additional Inherited Members | |
Public Types inherited from vlink::NodeImpl | |
| using | ConnectCallback = Function< void(bool)> |
| Callback fired when peer presence changes. More... | |
| using | StatusCallback = Function< void(const Status::BasePtr &ptr)> |
| Callback fired on DDS-family status notifications (e.g. deadline missed). More... | |
| using | SyncCallback = Function< void()> |
Callback fired when a SetterImpl completes a late-getter sync. More... | |
| using | ReqRespCallback = Function< void(uint64_t, const Bytes &, Bytes *)> |
Request / response handler installed by ServerImpl::listen(). More... | |
| using | MsgCallback = Function< void(const Bytes &)> |
| Callback delivering a serialised payload to a subscriber or getter. More... | |
| using | IntraMsgCallback = Function< void(const IntraData &)> |
| Callback delivering an in-process payload to an intra:// subscriber. More... | |
Static Public Member Functions inherited from vlink::NodeImpl | |
| static void | global_init () |
| Initialises process-wide VLink singletons. More... | |
Public Attributes inherited from vlink::NodeImpl | |
| std::string | url |
Full URL string of the node, e.g. "dds://my/topic". More... | |
| std::string | ser_type |
Concrete serialisation type tag (e.g. "demo.proto.PointCloud"). More... | |
| ImplType | impl_type {kUnknownImplType} |
| Role of this implementation node. More... | |
| SchemaType | schema_type {SchemaType::kUnknown} |
| Coarse schema family reported to discovery and bag / proxy paths. More... | |
| TransportType | transport_type {TransportType::kUnknown} |
| Transport backend identifier for this node. More... | |
| bool | is_cdr_type {false} |
true when DDS native CDR serialisation is in use. More... | |
| bool | is_security_type {false} |
true when an authenticated transport is enabled. More... | |
| bool | is_discovery_enabled {true} |
| Whether the node is reported to the discovery layer. More... | |
| std::atomic_bool | has_suspend {false} |
| Atomic suspend flag (currently unused by the default impls). More... | |
| std::unique_ptr< CpuProfiler > | profiler |
| Optional per-node CPU profiler activated under global profiling. More... | |
| std::unique_ptr< Security > | security |
Installed per-node message-security context, or nullptr. More... | |
Publish-side base shared by every transport-specific publisher.
Owns the helper condition variable and connect-callback storage that back Publisher<T>::wait_for_subscribers() and Publisher<T>::detect_subscribers(). Transports invoke update_subscribers() from their discovery threads whenever the subscriber count flips between zero and non-zero.
|
override |
Releases the helper state.
|
protected |
Stamps the node as kPublisher and primes the helper state.
|
virtual |
Registers callback to fire when subscriber presence changes.
The callback is invoked with true when the first subscriber appears and with false after the last one drops. When subscribers are already known at registration time the callback is primed with true before this function returns.
| callback | Callable void(bool) describing the new presence. |
|
pure virtual |
Reports whether at least one subscriber is currently connected.
Pure virtual; subclasses query their discovery handle. Used by both wait_for_subscribers() and update_subscribers() to detect state transitions.
true when a subscriber is reachable.
|
overridevirtual |
Wakes waiters and forwards the interrupt to NodeImpl.
Marks the node interrupted and notifies the helper condition variable so pending wait_for_subscribers() calls return false promptly.
Reimplemented from vlink::NodeImpl.
| void vlink::PublisherImpl::update_subscribers | ( | ) |
Notifies the base class that subscriber presence may have changed.
Compares has_subscribers() against the helper cache; on a transition the condition variable is signalled and the stored ConnectCallback is invoked. Intended for use from transport discovery threads.
|
virtual |
Blocks until at least one subscriber is reachable or timeout elapses.
Returns immediately when has_subscribers() already reports true. Negative timeouts (e.g. Timeout::kInfinite) wait indefinitely.
| timeout | Wait budget; negative disables the deadline. |
true when a subscriber arrived in time; false otherwise.
|
pure virtual |
Publishes a serialised payload to every connected subscriber.
Pure virtual. msg_data is produced by Serializer::serialize() at the public layer.
| msg_data | Serialised payload bytes. |
true when the frame was successfully delivered or queued.
|
virtual |
Publishes an in-process payload without serialisation.
Default implementation warns and returns false; only IntraPublisherImpl forwards the shared payload directly to co-located subscribers.
| intra_data | Shared payload pointer. |
true when the message was dispatched; false otherwise.