VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
qnx_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2026 by Thun Lu. All rights reserved.
3 * Author: Thun Lu <thun.lu@zohomail.cn>
4 * Repo: https://github.com/thun-res/vlink
5 * _ __ __ _ __
6 * | | / / / / (_) ____ / /__
7 * | | / / / / / / / __ \ / //_/
8 * | |/ / / /___ / / / / / / / ,<
9 * |___/ /_____/ /_/ /_/ /_/ /_/|_|
10 *
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
14 *
15 * http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
22 */
23
24/**
25 * @file qnx_conf.h
26 * @brief Transport configuration for the @c qnx:// QNX IPC backend.
27 *
28 * @details
29 * @c QnxConf configures the QNX IPC transport, which uses QNX native inter-process
30 * communication primitives for same-machine message passing on QNX Neutrino RTOS
31 * targets. It provides deterministic, real-time message delivery without relying
32 * on a third-party middleware layer.
33 *
34 * @par Supported Node Types
35 * @c qnx:// supports all six node types: @c kPublisher, @c kSubscriber, @c kServer,
36 * @c kClient, @c kSetter, and @c kGetter.
37 *
38 * @par URL Format
39 * @code
40 * qnx://<address>[?event=<name>]
41 * @endcode
42 *
43 * | Component | Description |
44 * | ---------- | ------------------------------------------------------------------ |
45 * | @c address | QNX channel/topic name; formed from @c host + @c "/" + @c path |
46 * | @c event | Optional secondary event filter (@c ?event=) |
47 *
48 * @par Example
49 * @code
50 * vlink::Publisher<MyMsg> pub("qnx://my_topic");
51 * vlink::Subscriber<MyMsg> sub("qnx://my_topic");
52 * @endcode
53 *
54 * @note This header is compiled only when @c VLINK_SUPPORT_QNX is defined.
55 * @note This transport is only available on QNX targets; it is not usable on Linux.
56 * @note @c is_valid() returns @c false if @c address is empty.
57 */
58
59#pragma once
60
61#ifdef VLINK_SUPPORT_QNX
62
63#include <cstdint>
64#include <string>
65
66#include "../impl/conf.h"
67
68namespace vlink {
69
70/**
71 * @struct QnxConf
72 * @brief Configuration for the @c qnx:// QNX native IPC transport.
73 *
74 * @details
75 * Can be constructed directly or parsed from a URL string via @c Url.
76 */
77struct VLINK_EXPORT QnxConf final : public Conf {
78 std::string address; ///< QNX channel/topic address (host + "/" + path from URL).
79 std::string event; ///< Optional secondary event filter string.
80
81 /**
82 * @brief Constructs a @c QnxConf with explicit parameters.
83 *
84 * @param _address Channel/topic address string.
85 * @param _event Optional event filter; empty by default.
86 */
87 explicit QnxConf(const std::string& _address, const std::string& _event = "");
88
89 /**
90 * @brief Returns @c true if both fields equal those of @p conf.
91 *
92 * @param conf Configuration to compare.
93 * @return @c true if @c address and @c event are equal.
94 */
95 [[nodiscard]] bool operator==(const QnxConf& conf) const noexcept;
96
97 /**
98 * @brief Returns @c true if either field differs from @p conf.
99 *
100 * @param conf Configuration to compare.
101 * @return Logical negation of @c operator==.
102 */
103 [[nodiscard]] bool operator!=(const QnxConf& conf) const noexcept;
104
105 /**
106 * @brief Returns @c TransportType::kQnx identifying this transport.
107 *
108 * @return @c TransportType::kQnx.
109 */
110 [[nodiscard]] TransportType get_transport_type() const override;
111
112#ifndef VLINK_ENABLE_C_INTERFACE
114#endif
115 VLINK_ALLOW_IMPL_TYPE(kServer | kClient | kPublisher | kSubscriber | kSetter | kGetter)
116 VLINK_CONF_IMPL(QnxConf)
117};
118
119////////////////////////////////////////////////////////////////
120/// Details
121////////////////////////////////////////////////////////////////
122
123inline QnxConf::QnxConf(const std::string& _address, const std::string& _event) : address(_address), event(_event) {}
124
125inline bool QnxConf::operator==(const QnxConf& conf) const noexcept {
126 return address == conf.address && event == conf.event;
127}
128
129inline bool QnxConf::operator!=(const QnxConf& conf) const noexcept { return !(*this == conf); }
130
131inline TransportType QnxConf::get_transport_type() const { return TransportType::kQnx; }
132
133} // namespace vlink
134
135#endif
Abstract transport configuration base class and associated helper macros.
#define VLINK_CONF_IMPL(classname)
Standard boilerplate for concrete Conf subclass declarations.
Definition conf.h:227
#define VLINK_DECLARE_GLOBAL_PROPERTY()
Declares per-transport global state: thread count and property storage.
Definition conf.h:292
#define VLINK_ALLOW_IMPL_TYPE(type)
Declares a static constexpr bitmask of supported ImplType values.
Definition conf.h:268
#define VLINK_EXPORT
Definition macros.h:85