|
VLink
2.0.0
A high-performance communication middleware
|
Write-side primitive of the VLink event communication model. 更多...
#include <memory>#include <string>#include <type_traits>#include "./impl/publisher_impl.h"#include "./node.h"#include "./internal/publisher-inl.h"类 | |
| class | vlink::Publisher< MsgT, SecT > |
| Type-safe topic emitter for the VLink event communication model. 更多... | |
| class | vlink::SecurityPublisher< MsgT > |
Convenience alias of Publisher with per-message security enabled. 更多... | |
命名空间 | |
| vlink | |
Write-side primitive of the VLink event communication model.
Publisher<MsgT, SecT> is the message emitter for VLink topics. Each call to publish() serialises an instance of MsgT according to the compile-time-detected codec and hands the resulting payload to the active transport back-end, which fans the bytes out to every connected Subscriber that shares the same topic URL.
The class is a thin, header-only template wrapper around PublisherImpl; all runtime work is delegated to the impl. Codec selection is fully resolved at compile time so the runtime dispatch is zero-cost.
* Publisher<MsgT> Transport Back-end Subscriber<MsgT> * ---------------- ------------------ ----------------- * | | | * |-- publish(msg, force) ---------->| | * | Serializer::serialize | | * | (loan-aware on shm/zenoh) | | * | |--- frame on wire ----------->| * | | | * | | |--> callback * | | | Serializer:: * | | | deserialize *
| Category | Example C++ Type | Serializer::Type | Notes |
|---|---|---|---|
| Raw bytes | Bytes | kBytesType | Pass-through, no codec call. |
| Protobuf value | MyProto | kProtoType | Uses SerializeToArray. |
| Protobuf pointer | MyProto* | kProtoPtrType | Caller owns lifetime. |
| FlatBuffers obj | MyTableT (NativeTable) | kFlatTableType | Object API. |
| FlatBuffers ptr | MyTable* (Table pointer) | kFlatPtrType | Zero-copy read view. |
| FlatBuffers build | MyBuilder (fbb_ + Finish) | kFlatBuilderType | Finishes builder on publish. |
| DDS CDR | type with serialize(Cdr&) | kCdrType | DDS fast path. |
| POD struct | trivial standard-layout type | kStandardType | sizeof(T) byte copy. |
| UTF-8 text | std::string | kStringType | Length-prefixed. |
| Custom | type with operator>>/<< | kCustomType | User-supplied codec. |
force=true to publish() if you wish to write regardless of detection state.