91#ifdef VLINK_SUPPORT_DDS
96#include <shared_mutex>
104namespace eprosima::fastdds::dds {
134 explicit DdsConf(
const std::string& _topic, int32_t _domain = 0, int32_t _depth = 0,
const std::string& _qos =
"");
148 explicit DdsConf(
const std::string& _topic, int32_t _domain,
const PropertiesMap& _qos_ext);
156 [[nodiscard]]
bool operator==(
const DdsConf& conf)
const noexcept;
164 [[nodiscard]]
bool operator!=(
const DdsConf& conf)
const noexcept;
171 [[nodiscard]]
TransportType get_transport_type()
const override;
183 [[nodiscard]]
static std::vector<std::tuple<std::string, std::string>> get_discovered_topics(int32_t _domain);
195 static bool load_global_qos_file(
const std::string& filepath);
211 template <
typename TypeSupportT,
typename TypeSupportRespT =
void>
212 static void register_topic(
const std::string& name);
225 template <
typename TypeSupportT,
typename TypeSupportRespT =
void>
226 static void register_url(
const std::string& name);
240 static void register_qos(
const std::string& name,
const Qos& qos);
243 template <
typename TypeSupportT>
244 static void register_topic_internal(
const std::string& name);
246 static void register_qos_internal(
const std::string& name,
const Qos& qos);
248 static std::function<
void*()> find_type_support(
const std::string& name);
250 static const Qos& find_qos(
const std::string& name);
252 static std::string get_topic_for_url(
const std::string& url);
254 friend class DdsFactory;
255 static std::map<std::string, std::function<
void*()>> type_support_map_;
256 static std::map<std::string, Qos> qos_map_;
257 static std::shared_mutex mtx_;
258 static constexpr const char* kRespSuffix{
"___resp"};
259#ifndef VLINK_ENABLE_C_INTERFACE
270inline DdsConf::DdsConf(
const std::string& _topic, int32_t _domain, int32_t _depth,
const std::string& _qos)
271 : topic(_topic), domain(_domain), depth(_depth), qos(_qos) {}
273inline DdsConf::DdsConf(
const std::string& _topic, int32_t _domain,
const PropertiesMap& _qos_ext)
274 : topic(_topic), domain(_domain), qos_ext(_qos_ext) {}
276inline bool DdsConf::operator==(
const DdsConf& conf)
const noexcept {
277 return topic == conf.topic && domain == conf.domain && depth == conf.depth && qos == conf.qos &&
278 qos_ext == conf.qos_ext;
281inline bool DdsConf::operator!=(
const DdsConf& conf)
const noexcept {
return !(*
this == conf); }
283inline TransportType DdsConf::get_transport_type()
const {
return TransportType::kDds; }
285template <
typename TypeSupportT,
typename TypeSupportRespT>
286inline void DdsConf::register_topic(
const std::string& name) {
287 std::lock_guard lock(mtx_);
288 register_topic_internal<TypeSupportT>(name);
289 if constexpr (!std::is_same_v<TypeSupportRespT, void>) {
290 register_topic_internal<TypeSupportRespT>(name + kRespSuffix);
294template <
typename TypeSupportT,
typename TypeSupportRespT>
295inline void DdsConf::register_url(
const std::string& name) {
296 register_topic<TypeSupportT, TypeSupportRespT>(get_topic_for_url(name));
299template <
typename TypeSupportT>
300inline void DdsConf::register_topic_internal(
const std::string& name) {
301 static_assert(std::is_base_of_v<eprosima::fastdds::dds::TopicDataType, TypeSupportT>,
"Must be dds type.");
303 type_support_map_[name] = [] {
return new TypeSupportT(); };
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
TransportType
Enumeration of all supported transport backends.
Definition types.h:107
Quality of Service (QoS) policy aggregate for VLink publishers and subscribers.
Abstract base class for VLink transport configuration objects.
Definition conf.h:83