VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
setter.h 文件参考

Type-safe field-model writer for VLink topics. 更多...

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

浏览该文件的源代码.

 Type-safe field writer for the VLink field communication model. 更多...
 Convenience alias for Setter with message security enabled. 更多...

命名空间

详细描述

Type-safe field-model writer for VLink topics.

Setter<ValueT, SecT> is the write side of the VLink field model. Each call to set() serialises the value and writes it to the transport as the new "latest value" for the topic. All Getter nodes on the same URL will be notified of the update.

Field Model Overview
Setter<T> Transport Back-end Getter<T>
| | |
|-- set(value) ----------> | |
| serialize(value) | |
| |-- latest-value delivery ----> |
| | (overwrites previous) |--> callback(value)
| | |--> get() => value
Key Differences: Setter vs Publisher
Feature Setter<T> Publisher<T>
Transport role kSetter kPublisher
Value retention Last value re-sent to late getters No re-send to late subs
Sync callback on connect Yes – sync() callback No
Cross-transport use As publisher: mark_as_publisher() As setter: mark_as_setter()
Sync on Late Connect
When a Getter connects after the Setter has already written, the transport fires the sync() callback registered internally. The Setter re-sends its cached value so the late Getter receives the current state immediately:
Setter<int> s("shm://my_field");
s.set(42); // Getter joins later and immediately receives 42
Usage
Setter<MyStruct> setter("dds://vehicle/gear");
setter.set(MyStruct{3, "Drive"}); // write a new field value
模板参数
ValueTValue type. Must satisfy Serializer::is_supported().
SecTSecurity mode; defaults to SecurityType::kWithoutSecurity.