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

Write-side primitive of the VLink field communication model. 更多...

#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <type_traits>
#include "./impl/setter_impl.h"
#include "./node.h"
#include "./internal/setter-inl.h"
setter.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

class  vlink::Setter< ValueT, SecT >
 Type-safe latest-value writer for the VLink field communication model. 更多...
 
class  vlink::SecuritySetter< ValueT >
 Convenience alias of Setter with per-message encryption enabled. 更多...
 

命名空间

 

详细描述

Write-side primitive of the VLink field communication model.

Setter<ValueT, SecT> publishes the latest value for a field topic. Every call to set() updates the locally cached value and emits the new serialised payload over the transport. When a late Getter joins after the setter has already written, an internally registered sync() callback resends the cached value so the late peer receives the current state immediately.

The class is a thin, header-only template wrapper around SetterImpl.

Field-model Data Flow
*   Setter<ValueT>             Transport Back-end             Getter<ValueT>
*   --------------             ------------------             ---------------
*      | set(v)                       |                              |
*      |  cache value                 |                              |
*      |  Serializer::serialize       |                              |
*      |----------------------------->|--- latest-value frame ------>|
*      |                              |  (overwrites any previous)   |
*      |                              |                              |--> callback(v)
*      |                              |                              |--> get() => v
*      | <-- late joiner sync ------- | <-- sync() fired by impl --- |
*      | re-emit cached value         |                              |
*      |----------------------------->|----------------------------->|
* 
Setter vs Publisher
Feature Setter<T> Publisher<T>
Transport role tag kSetter kPublisher
Latest-value retention Re-sent to late-joining getters No re-send to late subscribers
Sync-on-connect callback Yes (registered inside init()) No
Cross-role bridge mark_as_publisher() mark_as_setter()
Durability and Persistence Modes
Setter inherits durability behaviour from the transport's effective Qos profile. Common configurations:
Durability mode Behaviour
kVolatile Cached in-process only; re-sent on local sync() hook.
kTransientLocal Cached inside the transport writer for late subscribers.
kTransient Persisted in an external durability service (DDS only).
kPersistent Persisted to stable storage (DDS only).
Usage Example
vlink::Setter<MyStruct> setter("dds://vehicle/gear");
setter.set(MyStruct{3, "Drive"});
// A Getter that connects afterwards still receives the cached value:
vlink::Getter<MyStruct> getter("dds://vehicle/gear");
if (auto v = getter.get()) { use(*v); }
参见
getter.h, publisher.h, node.h, extension/qos.h