62.4.2 Sequences
In general, sequences in QosPolicies are described with the following XML format:
<a_sequence_member_name>
<element>...</element>
<element>...</element>
...
</a_sequence_member_name>
Each element of the sequence is enclosed in an <element> tag. For example:
<property>
<value>
<element>
<name>my name</name>
<value>my value</value>
</element>
<element>
<name>my name2</name>
<value>my value2</value>
</element>
</value>
</property>
A sequence without elements represents a sequence of length 0. For example:
<discovery>
<!-- initial_peers sequence contains zero elements -->
<initial_peers/>
</discovery>
For sequences that may have a default initialization that is not empty (such as the initial_peers field in the 56.2 DISCOVERY QosPolicy (DDS Extension)), using the above construct would result in an empty list and not the default value. So to simply show a sequence for the sake of completeness, but not change its default value, comment it out, as follows:
<discovery>
<!-- initial_peers sequence contains the default value -->
<!-- <initial_peers/> -->
</discovery>
As a general rule, sequences defined in a derived QoS will replace the corresponding sequences in the base QoS. (The concepts of derived and base QoS are described in 62.2.3 QoS Profile Inheritance and Composition.) For example, consider the following:
<qos_profile name="MyBaseProfile">
<domain_participant_qos>
<discovery>
<initial_peers>
<element>192.168.1.1</element>
<element>192.168.1.2</element>
</initial_peers>
</discovery>
</domain_participant_qos>
</qos_profile>
<qos_profile name="MyDerivedProfile" base_name="MyBaseProfile">
<domain_participant_qos>
<discovery>
<initial_peers>
<element>192.168.1.3</element>
</initial_peers>
</discovery>
</domain_participant_qos>
</qos_profile>
The initial peers sequence defined above in the participant QoS of MyDerivedProfile will contain a single element with a value 192.168.1.3. The elements 192.168.1.1 and 192.168.1.2 will not be inherited. However, there is one exception to this behavior.
The <property> and <data_tags> tags provide an attribute called inherit that allows you to choose the inheritance behavior for the sequence defined within the tag.
By default, the value of the attribute inherit is true. Therefore, the <property> tag defined within a derived QoS profile will inherit its elements from the <property> tag defined within a base QoS profile.
In the following example, the property sequence defined in the participant QoS of MyDerivedProfile will contain two properties:
- dds.transport.UDPv4.builtin.send_socket_buffer_size will be inherited from the base profile and have the value 524288.
- dds.transport.UDPv4.builtin.recv_socket_buffer_size will overwrite the value defined in the base QoS profile with 1048576.
<qos_profile name="MyBaseProfile">
<domain_participant_qos>
<property>
<value>
<element>
<name>
dds.transport.UDPv4.builtin.send_socket_buffer_size
</name>
<value>524288</value>
</element>
<element>
<name>
dds.transport.UDPv4.builtin.recv_socket_buffer_size
</name>
<value>2097152</value>
</element>
</value>
</property>
</domain_participant_qos>
</qos_profile>
<qos_profile name="MyDerivedProfile" base_name="MyBaseProfile">
<domain_participant_qos>
<property>
<value>
<element>
<name>
dds.transport.UDPv4.builtin.recv_socket_buffer_size
</name>
<value>1048576</value>
</element>
</value>
</property>
</domain_participant_qos>
</qos_profile>
To discard all the properties defined in the base QoS profile, set inherit to false.
In the following example, the property sequence defined in the participant QoS of MyDerivedProfile will contain a single property named dds.transport.UDPv4.builtin.recv_socket_buffer_size, with a value of 1048576. The property dds.transport.UDPv4.builtin.send_socket_buffer_size will not be inherited.
<qos_profile name="MyBaseProfile">
<domain_participant_qos>
<property>
<value>
<element>
<name>
dds.transport.UDPv4.builtin.send_socket_buffer_size
</name>
<value>524288</value>
</element>
<element>
<name>
dds.transport.UDPv4.builtin.recv_socket_buffer_size
</name>
<value>2097152</value>
</element>
</value>
</property>
</domain_participant_qos>
</qos_profile>
<qos_profile name="MyDerivedProfile" base_name="MyBaseProfile"
<domain_participant_qos>
<property inherit="false">
<value>
<element>
<name>
dds.transport.UDPv4.builtin.recv_socket_buffer_size
</name>
<value>1048576</value>
</element>
</value>
</property>
</domain_participant_qos>
</qos_profile>