CoreDX DDS Modern C++ API
QoS Provider Use Cases

The QoS Provider allows an application to load QoS policy values from an external source rather than embedded in source code.

The CoreDX DDS QoS Provider supports two URI kinds: "file://" and "data://". The "file://" form supports loading XML from a file, while "data://" supports reading the xml from an in-memory buffer.

Here's an example QOS XML file:

<dds>
<qos_profile name="profile_1">
<participantfactory_qos name="dpf_1">
<entity_factory>
<autoenable_created_entities>false</autoenable_created_entities>
</entity_factory>
</participantfactory_qos>
<participant_qos name="dp_1">
<properties>
<property>
<name>A1</name> <value>val_A1</value>
</property>
<property>
<name>A2</name><value>val_A2</value><propagate>true</propagate>
</property>
</properties>
<entity_factory>
<autoenable_created_entities>false</autoenable_created_entities>
</entity_factory>
<user_data>
<value>'A',' ','P','a','r','t','i','c','i','p','a','n','t'</value>
</user_data>
<peer_participants>
<value>
<participant_locator>
<participant_id>0</participant_id>
<participant_id_max>10</participant_id_max>
<locator>
<kind>UDPV4_LOCATOR_KIND_QOS</kind>
<port>7410</port>
<addr>10,0,0,5</addr>
</locator>
</participant_locator>
</value>
<strict_match>TRUE</strict_match>
</peer_participants>
<logging>
<flags>0x0040</flags>
</logging>
</participant_qos>
<topic_qos name="top_1">
<deadline>
<period>
<sec>10</sec>
<nanosec>500000000</nanosec>
</period>
</deadline>
<destination_order>
<kind>BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS</kind>
</destination_order>
<durability>
<kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind>
</durability>
<durability_service>
<service_cleanup_delay>
<sec>20</sec>
<nanosec>500000000</nanosec>
</service_cleanup_delay>
<history_kind>KEEP_ALL_HISTORY_QOS</history_kind>
<history_depth>-1</history_depth>
<max_samples>LENGTH_UNLIMITED</max_samples>
<max_instances>2</max_instances>
<max_samples_per_instance>3</max_samples_per_instance>
</durability_service>
<history>
<kind>KEEP_ALL_HISTORY_QOS</kind>
<depth>10</depth>
</history>
<latency_budget>
<duration>
<sec>22</sec>
<nanosec>0</nanosec>
</duration>
</latency_budget>
<lifespan>
<duration>
<sec>23</sec>
<nanosec>0</nanosec>
</duration>
</lifespan>
<liveliness>
<kind>MANUAL_BY_PARTICIPANT_LIVELINESS_QOS</kind>
<lease_duration>
<sec>24</sec>
<nanosec>0</nanosec>
</lease_duration>
</liveliness>
<ownership>
<kind>EXCLUSIVE_OWNERSHIP_QOS</kind>
</ownership>
<reliability>
<kind>RELIABLE_RELIABILITY_QOS</kind>
<max_blocking_time>
<sec>25</sec>
<nanosec>0</nanosec>
</max_blocking_time>
</reliability>
<resource_limits>
<max_samples>100</max_samples>
<max_instances>101</max_instances>
<max_samples_per_instance>102</max_samples_per_instance>
</resource_limits>
<topic_data>
<value>'A',' ','T','o','p','i','c'</value>
</topic_data>
<transport_priority>
<value>501</value>
</transport_priority>
<representation>
<value>0x000</value>
</representation>
</topic_qos>
<publisher_qos name="pub_1">
<entity_factory>
<autoenable_created_entities>false</autoenable_created_entities>
</entity_factory>
<group_data>
<value>'A',' ','P','u','b'</value>
</group_data>
<partition>
<name></name>
</partition>
<presentation>
<access_scope>TOPIC_PRESENTATION_QOS</access_scope>
<coherent_access>TRUE</coherent_access>
<ordered_access>TRUE</ordered_access>
</presentation>
</publisher_qos>
<subscriber_qos name="sub_1">
<entity_factory>
<autoenable_created_entities>false</autoenable_created_entities>
</entity_factory>
<group_data>
<value>'A',' ','S','u','b'</value>
</group_data>
<partition>
<name>
<element>partition_1</element>
<element>partition_2</element>
<element>p*</element>
</name>
</partition>
<presentation>
<access_scope>TOPIC_PRESENTATION_QOS</access_scope>
<coherent_access>TRUE</coherent_access>
<ordered_access>TRUE</ordered_access>
</presentation>
</subscriber_qos>
<datawriter_qos name="dw_1">
<deadline>
<period>
<sec>10</sec>
<nanosec>500000000</nanosec>
</period>
</deadline>
<destination_order>
<kind>BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS</kind>
</destination_order>
<durability>
<kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind>
</durability>
<durability_service>
<service_cleanup_delay>
<sec>20</sec>
<nanosec>500000000</nanosec>
</service_cleanup_delay>
<history_kind>KEEP_ALL_HISTORY_QOS</history_kind>
<history_depth>-1</history_depth>
<max_samples>LENGTH_UNLIMITED</max_samples>
<max_instances>2</max_instances>
<max_samples_per_instance>3</max_samples_per_instance>
</durability_service>
<history>
<kind>KEEP_ALL_HISTORY_QOS</kind>
<depth>10</depth>
</history>
<latency_budget>
<duration>
<sec>22</sec>
<nanosec>0</nanosec>
</duration>
</latency_budget>
<lifespan>
<duration>
<sec>23</sec>
<nanosec>0</nanosec>
</duration>
</lifespan>
<liveliness>
<kind>MANUAL_BY_PARTICIPANT_LIVELINESS_QOS</kind>
<lease_duration>
<sec>24</sec>
<nanosec>0</nanosec>
</lease_duration>
</liveliness>
<ownership>
<kind>EXCLUSIVE_OWNERSHIP_QOS</kind>
</ownership>
<ownership_strength>
<value>99</value>
</ownership_strength>
<reliability>
<kind>BEST_EFFORT_RELIABILITY_QOS</kind>
<max_blocking_time>
<sec>42</sec>
<nanosec>0</nanosec>
</max_blocking_time>
</reliability>
<resource_limits>
<max_samples>100</max_samples>
<max_instances>101</max_instances>
<max_samples_per_instance>102</max_samples_per_instance>
</resource_limits>
<transport_priority>
<value>501</value>
</transport_priority>
<user_data>
<value>'A',' ','W','r','i','t','e','r'</value>
</user_data>
<writer_data_lifecycle>
<autodispose_unregistered_instances>false</autodispose_unregistered_instances>
</writer_data_lifecycle>
<representation>
<value>0x000</value>
</representation>
</datawriter_qos>
<datareader_qos name="dr_1">
<deadline>
<period>
<sec>10</sec>
<nanosec>500000000</nanosec>
</period>
</deadline>
<destination_order>
<kind>BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS</kind>
</destination_order>
<durability>
<kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind>
</durability>
<history>
<kind>KEEP_ALL_HISTORY_QOS</kind>
<depth>21</depth>
</history>
<latency_budget>
<duration>
<sec>22</sec>
<nanosec>0</nanosec>
</duration>
</latency_budget>
<liveliness>
<kind>MANUAL_BY_PARTICIPANT_LIVELINESS_QOS</kind>
<lease_duration>
<sec>23</sec>
<nanosec>0</nanosec>
</lease_duration>
</liveliness>
<ownership>
<kind>EXCLUSIVE_OWNERSHIP_QOS</kind>
</ownership>
<reader_data_lifecycle>
<autopurge_nowriter_samples_delay>
<sec>24</sec>
<nanosec>0</nanosec>
</autopurge_nowriter_samples_delay>
<autopurge_disposed_samples_delay>
<sec>25</sec>
<nanosec>0</nanosec>
</autopurge_disposed_samples_delay>
</reader_data_lifecycle>
<reliability>
<kind>RELIABLE_RELIABILITY_QOS</kind>
</reliability>
<resource_limits>
<max_samples>100</max_samples>
<max_instances>101</max_instances>
<max_samples_per_instance>102</max_samples_per_instance>
</resource_limits>
<time_based_filter>
<minimum_separation>
<sec>27</sec>
<nanosec>0</nanosec>
</minimum_separation>
</time_based_filter>
<user_data>
<value>'A',' ','R','e','a','d','e','r'</value>
</user_data>
<representation>
<value>0x000</value>
</representation>
<type_consistency>
<kind>ALLOW_TYPE_COERCION</kind>
</type_consistency>
</datareader_qos>
<datareader_qos name="dr_2" base_name="dr_1">
<deadline>
<period>
<sec>20</sec>
<nanosec>500000000</nanosec>
</period>
</deadline>
</datareader_qos>
</qos_profile>
</dds>

A URI to load this file (assuming it is named 'qos_profile.xml' in the current directory) is:

char * uri = "file:///qos_profile.xml";

A URI to load this file from a "data://" URI would look something like this (abbreviated for space):

char * uri = "data://,"
"<dds>"
" <qos_profile name=\"profile_1\">"
" <participantfactory_qos name=\"dpf_1\">"
" <entity_factory>"
" ..."
" </qos_profile>"
"</dds>";

Constructing a QoS Provider

The QoS Provider is constructed by providing the URI and an optional profile name. If the profile name is absent, then the QoS Provider loads the first profile found in the XML data. If the requested QoS profile is not found in the XML, then the QoS Provider construction will throw a dds::core::Error exception.

dds::core::QosProvider qos_provider( "file:///qos_profile.xml", "profile_1" );

Using QoS Provider

The QoS Provider can now be used to get QoS policies for each kind of DDS entity.

dds::domain::qos::DomainParticipantQos dp_qos = qos_provider.participant_qos( "dp_1" );
dds::topic::qos::TopicQos topic_qos = qos_provider.topic_qos( "top_1" );
dds::pub::qos::PublisherQos pub_qos = qos_provider.publisher_qos( "pub_1" );
dds::pub::qos::DataWriterQos dw_qos = qos_provider.datawriter_qos( "dw_1" );
dds::sub::qos::SubscriberQos sub_qos = qos_provider.subscriber_qos( "sub_1" );
dds::sub::qos::DataReaderQos dr_qos = qos_provider.datareader_qos( "dr_1" );

If a requested QoS name is not found, then the QoS Provider will throw a dds::core::Error exception.

try {
dds::domain::qos::DomainParticipantQos dp_qos = qos_provider.participant_qos( "INVALID_NAME" );
} catch ( dds::core::Error & ex ) {
std::cout << "Error: " << ex.what() << std::endl;
}

© 2009-2020 Twin Oaks Computing, Inc
Castle Rock, CO 80104
All rights reserved.