|
VLink
2.0.0
A high-performance communication middleware
|
Read-side primitive of the VLink field communication model. More...
#include <memory>#include <mutex>#include <optional>#include <string>#include <type_traits>#include "./base/condition_variable.h"#include "./base/functional.h"#include "./impl/getter_impl.h"#include "./node.h"#include "./internal/getter-inl.h"Go to the source code of this file.
Classes | |
| class | vlink::Getter< ValueT, SecT > |
| Type-safe latest-value reader for the VLink field communication model. More... | |
| class | vlink::SecurityGetter< ValueT > |
Convenience alias of Getter with per-message decryption enabled. More... | |
Namespaces | |
| vlink | |
Read-side primitive of the VLink field communication model.
Getter<ValueT, SecT> mirrors the latest value produced by a matching Setter on the same URL. Unlike Subscriber it retains only the most recent payload rather than queuing every update, and it offers a blocking wait_for_value() entry point in addition to the standard event callback.
The class is a thin, header-only template wrapper around GetterImpl and owns its own cached value_, change-tracking buffer, and condition variable.
* Setter<ValueT> Transport Back-end Getter<ValueT> * -------------- ------------------ --------------- * | set(v) | | * |----------------------------->| serialised latest value | * | |--- overwrites previous ----->| * | | | * | | | Serializer:: * | | | deserialize * | | |--> listen cb (optional) * | | |--> value_ cached * | | |--> wait_for_value * | | | returns true * | | |--> get() => value *
| Feature | Getter<T> | Subscriber<T> |
|---|---|---|
| Value retention | Latest value cached | None |
| Transport role tag | kGetter | kSubscriber |
| Blocking read | wait_for_value() | N/A |
| Duplicate suppression | set_change_reporting(true) | N/A |
| Cross-role bridge | mark_as_subscriber() | mark_as_getter() |
| Method | Blocking | Result type | Notes |
|---|---|---|---|
get() | No | std::optional | Returns nullopt initially |
wait_for_value(timeout) | Yes | bool (then get()) | Default infinite if 0 |
listen(callback) | No | void(const ValueT&) | Fires on every update |
listen(cb) + change_reporting | No | void(const ValueT&) | Suppress identical bytes |
Setter writes for the first time, get() returns std::nullopt and wait_for_value() blocks.