当前位置: 首页 > news >正文

RTI QOS继承关系

在RTI Connext中,QoS继承关系是指一个QoS Profile可以从另一个QoS Profile继承配置,从而简化配置过程并提高可重用性。通过继承,子Profile会首先初始化为父Profile的所有QoS设置,然后可以覆盖其中的部分设置。

实现方式

  1. 单继承: 使用base_name属性指定父Profile。例如:

<qos_library name="MyLibrary"><qos_profile name="ChildProfile" base_name="ParentLibrary::ParentProfile"><datawriter_qos><reliability><kind>RELIABLE_RELIABILITY_QOS</kind></reliability></datawriter_qos></qos_profile>
</qos_library>
  1. 在这个例子中,ChildProfile继承了ParentProfile的所有设置,并覆盖了DataWriterreliability设置。

  2. 组合(Composition): 从Connext 6开始,支持通过<base_name>元素组合多个QoS Snippet(小片段)。例如:

<qos_library name="MyLibrary"><qos_profile name="ComposedProfile" base_name="BaseProfile"><base_name><element>Snippet1</element><element>Snippet2</element></base_name><datareader_qos><history><kind>KEEP_LAST_HISTORY_QOS</kind><depth>10</depth></history></datareader_qos></qos_profile>
</qos_library>

在这个例子中,ComposedProfile继承了BaseProfile,并组合了Snippet1Snippet2的设置。

实际例子

以下是一个完整的继承和组合的例子:

<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://community.rti.com/schema/7.5.0/rti_dds_qos_profiles.xsd" version="7.5.0"><qos_library name="ExampleLibrary"><!-- 父Profile --><qos_profile name="BaseProfile"><datawriter_qos><reliability><kind>RELIABLE_RELIABILITY_QOS</kind></reliability></datawriter_qos></qos_profile><!-- 子Profile,继承BaseProfile --><qos_profile name="DerivedProfile" base_name="ExampleLibrary::BaseProfile"><datawriter_qos><history><kind>KEEP_LAST_HISTORY_QOS</kind><depth>5</depth></history></datawriter_qos></qos_profile><!-- 组合多个Snippet --><qos_profile name="ComposedProfile" base_name="DerivedProfile"><base_name><element>Snippet1</element><element>Snippet2</element></base_name><datareader_qos><durability><kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind></durability></datareader_qos></qos_profile></qos_library>
</dds>

在这个例子中:

  1. BaseProfile定义了DataWriterreliabilityRELIABLE
  2. DerivedProfile继承了BaseProfile,并覆盖了history设置。
  3. ComposedProfile继承了DerivedProfile,并组合了Snippet1Snippet2,同时为DataReader设置了durability

使用场景

  • 简化配置:通过继承和组合,可以避免重复定义相同的QoS设置。
  • 提高可维护性:当需要修改某些通用设置时,只需更新父Profile或Snippet即可。

Sources:

  • QoS Profile Inheritance and Composition
  • RTI Connext Builtin QoS Profiles

相关文章:

  • 数值数据标准化:机器学习中的关键预处理技术
  • 设计模式--建造者模式详解
  • C++如何理解和避免ABA问题?在无锁编程中如何解决
  • Diffusion inversion后的latent code与标准的高斯随机噪音不一样
  • SQL实战:01之行转列实现
  • 在线地图工具geojson.io
  • Godot开发2D冒险游戏——第一节:主角登场!
  • 4.1.1 类的序列化与反序列化(XmlSerializer)
  • [原创](现代Delphi 12指南):[macOS 64bit App开发]:如何使用NSString类型字符串?
  • Tomcat Web应用(Ubuntu 18.04.6 LTS)部署笔记
  • React-组件通信
  • 【高中数学/古典概率】4红2黑六选二,求取出两次都是红球的概率
  • AI在论文评审中的应用与工具推荐
  • WASM与Kotlin反编译难度对比分析
  • NVIDIA自动驾驶安全与技术读后感
  • 【低配置电脑预训练minimind的实践】
  • 关于 xpath 查找 XML 元素的一点总结
  • go.mod介绍
  • ‌RISC-V低功耗MCU动态时钟门控技术详解
  • CSS基础
  • 历史一刻,两个航天员乘组拍摄全家福
  • 神舟二十号3名航天员顺利进驻中国空间站
  • “全国十大考古”揭晓:盘龙城遗址、周原遗址等入选
  • 习近平举行仪式欢迎肯尼亚总统鲁托访华
  • 人民日报开新栏,冼星海之女追忆父亲创作《黄河大合唱》
  • 2025年超长期特别国债24日首次发行