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

m_value

std::vector<DataRepresentationId>

Empty vector

Note

This QoS Policy concerns to Topic, DataReader and DataWriter entities.
It cannot be changed on enabled entities.

DataRepresentationId

There are three possible values (see DataRepresentationId):

Example

C++

DataRepresentationQosPolicy data_representation;
//Add XCDR v1 data representation to the list of valid representations
data_representation.m_value.push_back(DataRepresentationId_t::XCDR_DATA_REPRESENTATION);
//Add XML data representation to the list of valid representations
data_representation.m_value.push_back(DataRepresentationId_t::XML_DATA_REPRESENTATION);

XML

This QoS Policy cannot be configured using XML for the moment.

3.1.2.3.2. TypeConsistencyEnforcementQosPolicy

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

TypeConsistencyKind

ALLOW_TYPE_COERCION

m_ignore_sequence_bounds

bool

true

m_ignore_string_bounds

bool

true

m_ignore_member_names

bool

true

m_prevent_type_widening

bool

true

m_force_type_validation

bool

true

  • 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 concerns 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.

Example

C++

TypeConsistencyEnforcementQosPolicy type_enforcement;
//The TypeConsistencyEnforcementQosPolicy is default constructed with kind = ALLOW_TYPE_COERCION
//Change the kind to DISALLOW_TYPE_COERCION
type_enforcement.m_kind = TypeConsistencyKind::DISALLOW_TYPE_COERCION;
//Configures the system to ignore the sequence sizes in assignations
type_enforcement.m_ignore_sequence_bounds = true;
//Configures the system to ignore the string sizes in assignations
type_enforcement.m_ignore_string_bounds = true;
//Configures the system to ignore the member names. Members with same ID could have different names
type_enforcement.m_ignore_member_names = true;
//Configures the system to allow type widening
type_enforcement.m_prevent_type_widening = false;
//Configures the system to not use the complete Type Information in entities match process
type_enforcement.m_force_type_validation = false;

XML

This QoS Policy cannot be configured using XML for the moment.