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

Single umbrella entry point for the public VLink communication SDK. 更多...

#include "./client.h"
#include "./server.h"
#include "./publisher.h"
#include "./subscriber.h"
#include "./getter.h"
#include "./setter.h"
#include "./base/message_loop.h"
#include "./base/utils.h"
vlink.h 的引用(Include)关系图:

浏览源代码.

详细描述

Single umbrella entry point for the public VLink communication SDK.

Including <vlink/vlink.h> pulls in every primitive of the three VLink communication models together with the MessageLoop dispatcher and a small set of base utilities. Application code should rarely need to include any other VLink header directly; transport-specific configuration types are brought in transitively through the primitive headers.

Pulled-in Headers and Mapped Primitives
Header Public Primitive(s) Model Role
client.h Client<ReqT,RespT> Method RPC caller side
server.h Server<ReqT,RespT> Method RPC handler side
publisher.h Publisher<MsgT> Event Topic emitter
subscriber.h Subscriber<MsgT> Event Topic listener
getter.h Getter<ValueT> Field Latest-value reader
setter.h Setter<ValueT> Field Latest-value writer
base/message_loop.h MessageLoop Dispatch Callback re-routing
base/utils.h sleep_for, env helpers, etc. Utilities General-purpose helpers
Three Communication Models Side-by-side
*   +----------------------+   +-----------------------+   +-------------------------+
*   |     EVENT MODEL      |   |     METHOD MODEL      |   |       FIELD MODEL       |
*   |  (pub/sub stream)    |   |  (request/response)   |   |   (latest-value sync)   |
*   +----------------------+   +-----------------------+   +-------------------------+
*   |  Publisher<MsgT>     |   |  Client<Req,Resp>     |   |  Setter<ValueT>         |
*   |       |              |   |        |              |   |        |                |
*   |       v  publish()   |   |        v  invoke()    |   |        v  set()         |
*   |    transport         |   |     transport         |   |     transport           |
*   |       |              |   |        |              |   |   (retains latest)      |
*   |       v              |   |        v              |   |        |                |
*   |  Subscriber<MsgT>    |   |  Server<Req,Resp>     |   |        v                |
*   |   on each msg        |   |   handler fills resp  |   |  Getter<ValueT>         |
*   |                      |   |        |              |   |     get() / listen()    |
*   |                      |   |        v reply        |   |                         |
*   |                      |   |    Client receives    |   |                         |
*   +----------------------+   +-----------------------+   +-------------------------+
* 
Transport Selection via URL Prefix
The transport back-end is selected by the URL scheme. All API calls remain identical when the prefix is changed; this is the central design tenet of VLink.
Prefix Back-end Typical use case
intra:// In-process pub/sub Same-process zero-copy fan-out
shm:// Iceoryx shared memory Inter-process zero-copy on one host
shm2:// Native VLink shared memory Lightweight inter-process IPC
dds:// FastDDS (CDR) Standards-compliant DDS distribution
ddsc:// CycloneDDS CycloneDDS-based deployments
ddsr:// RTI Connext DDS RTI-licensed deployments
ddst:// TravoDDS TravoDDS-based deployments
zenoh:// Eclipse Zenoh Pub/sub-storage-query, edge to cloud
someip:// SOME/IP Automotive AUTOSAR adaptive services
fdbus:// FDBus Linux/Android service bus
qnx:// QNX native IPC QNX safety-critical platforms
mqtt:// MQTT Telemetry to cloud brokers
Quick-start Example – one process, three models
#include <vlink/vlink.h>
// ---- Event model ---------------------------------------------------------
vlink::Subscriber<MyMsg> sub("dds://vehicle/speed");
sub.listen([](const MyMsg& msg) { handle_event(msg); });
vlink::Publisher<MyMsg> pub("dds://vehicle/speed");
pub.publish(MyMsg{100});
// ---- Method model (synchronous RPC) -------------------------------------
vlink::Server<Req, Resp> svr("dds://compute/sum");
svr.listen([](const Req& q, Resp& r) { r.value = q.a + q.b; });
vlink::Client<Req, Resp> cli("dds://compute/sum");
Resp r;
if (cli.invoke(Req{1, 2}, r)) { use(r); }
// ---- Field model (latest-value sync) ------------------------------------
vlink::Setter<int> setter("shm://vehicle/gear");
setter.set(3);
vlink::Getter<int> getter("shm://vehicle/gear");
if (auto gear = getter.get()) { use(*gear); }
注解
Each primitive has a Security* counterpart (SecurityPublisher, SecuritySubscriber, SecurityClient, SecurityServer, SecuritySetter, SecurityGetter) that transparently encrypts and decrypts the payload using a Security::Config aggregate.
参见
publisher.h, subscriber.h, client.h, server.h, getter.h, setter.h