3.1.2.3. XTypes Extensions
This section explain those QoS Policy extensions defined in the XTypes Specification:
3.1.2.3.1. DataRepresentationQosPolicy
This XTypes QoS Policy states which data representations will be used by the DataWriters and DataReaders.
The DataWriters offer a single data representation that will be used to communicate with the matched DataReaders.
The DataReaders can request one or more data representations and in order to have communication with the DataWriter,
the offered data representation needs to be contained within the DataReader request.
See DataRepresentationQosPolicy
.
List of QoS Policy data members:
Data Member Name |
Type |
Default Value |
DataReader default value |
DataWriter default value |
Topic default value |
---|---|---|---|---|---|
std::vector<DataRepresentationId> |
Empty vector |
Note
This QoS Policy applies to Topic, DataReader and DataWriter entities.
It cannot be changed on enabled entities.
DataRepresentationId
There are three possible values (see DataRepresentationId
):
XCDR_DATA_REPRESENTATION
: This option corresponds to the first version of the Extended CDR Representation encoding.XML_DATA_REPRESENTATION
: This option corresponds to the XML Data Representation.XCDR2_DATA_REPRESENTATION
: This option corresponds to the second version of the Extended CDR Representation encoding.
Example
C++
// This example uses a DataWriter, but it can also be applied to Topic entities.
// DataRepresentationQosPolicy of DataReaders is contained in the TypeConsistencyQos
// (for further details see TypeConsistencyQos section).
DataWriterQos writer_qos;
// Add XCDR v1 data representation to the list of valid representations
writer_qos.representation().m_value.push_back(DataRepresentationId_t::XCDR_DATA_REPRESENTATION);
// Add XML data representation to the list of valid representations
writer_qos.representation().m_value.push_back(DataRepresentationId_t::XML_DATA_REPRESENTATION);
// Use modified QoS in the creation of the corresponding entity
writer_ = publisher_->create_datawriter(topic_, writer_qos);
XML
This QoS Policy cannot be configured using XML for the moment.
3.1.2.3.2. TypeConsistencyEnforcementQosPolicy
Warning
This QoS Policy will be implemented in future releases.
This XTypes QoS Policy extension defines the rules for determining whether the data type used in the
DataWriter is consistent with the one used in the DataReader.
See TypeConsistencyEnforcementQosPolicy
.
List of QoS Policy data members:
Data Member Name |
Type |
Default Value |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_kind
: It determines whether the type in the DataWriter type must be equal to the type in the DataReader or not. See TypeConsistencyKind for further details.m_ignore_sequence_bounds
: This data member controls whether the sequence bounds are taken into account for type assignability or not. If its value is true, the sequences maximum lengths are not considered, which means that a sequence T2 with length L2 would be assignable to a sequence T1 with length L1, even if L2 is greater than L1. But if it is false, L1 must be higher or equal to L2 to consider the sequences as assignable.m_ignore_string_bounds
: It controls whether the string bounds are considered for type assignation or not. If its value is true, the strings maximum lengths are not considered, which means that a string S2 with length L2 would be assignable to a string S1 with length L1, even if L2 is greater than L1. But if it is false, L1 must be higher or equal to L2 to consider the strings as assignable.m_ignore_member_names
: This boolean controls whether the member names are taken into consideration for type assignability or not. If it is true, apart from the member ID, the member names are considered as part of assignability, which means that the members with the same ID must also have the same name. But if the value is false, the member names are ignored.m_prevent_type_widening
: This data member controls whether the type widening is allowed or not. If it is false, the type widening is permitted, but if true, a wider type cannot be assignable to a narrower type.m_force_type_validation
: It controls if the service needs the type information to complete the matching between a DataWriter and a DataReader. If it is enabled, it must have the Complete Type Information, otherwise it is not necessary.
Note
This QoS Policy applies to DataReader entities.
It cannot be changed on enabled entities.
TypeConsistencyKind
There are two possible values:
DISALLOW_TYPE_COERCION
: The DataWriter and the DataReader must support the same data type in order to communicate.ALLOW_TYPE_COERCION
: The DataWriter and the DataReader do not need to support the same data type in order to communicate as long as the DataReader’s type is assignable from the DataWriter’s type.