RTI Connext Modern C++ API
Version 6.1.2
|
Defines the rules for determining whether the type used to publish a given topic is consistent with that used to subscribe to it. More...
#include <dds/core/policy/CorePolicy.hpp>
Public Member Functions | |
TypeConsistencyEnforcement () | |
Creates the default policy. More... | |
TypeConsistencyEnforcement (dds::core::policy::TypeConsistencyEnforcementKind the_kind) | |
Creates an instance with a specific enforcement kind. More... | |
TypeConsistencyEnforcement & | kind (dds::core::policy::TypeConsistencyEnforcementKind value) |
Sets the enforcement kind. More... | |
dds::core::policy::TypeConsistencyEnforcementKind | kind () const |
Gets the enforcement kind. More... | |
TypeConsistencyEnforcement & | ignore_sequence_bounds (bool ignore) |
Controls whether sequence bounds are ignored. More... | |
bool | ignore_sequence_bounds () const |
Getter (see setter with the same name) More... | |
TypeConsistencyEnforcement & | ignore_string_bounds (bool ignore) |
Controls whether string bounds are ignored. More... | |
bool | ignore_string_bounds () const |
Getter (see setter with the same name) More... | |
TypeConsistencyEnforcement & | ignore_member_names (bool ignore) |
Controls whether member names are ignored. More... | |
bool | ignore_member_names () const |
Getter (see setter with the same name) More... | |
TypeConsistencyEnforcement & | prevent_type_widening (bool prevent) |
Controls whether type widening is prevented. More... | |
bool | prevent_type_widening () const |
Getter (see setter with the same name) More... | |
TypeConsistencyEnforcement & | force_type_validation (bool force) |
Controls whether type validation is forced. More... | |
bool | force_type_validation () const |
Getter (see setter with the same name) More... | |
TypeConsistencyEnforcement & | ignore_enum_literal_names (bool ignore) |
Controls whether enumeration literal names are ignored. More... | |
bool | ignore_enum_literal_names () const |
Getter (see setter with the same name) More... | |
Static Public Member Functions | |
static TypeConsistencyEnforcement | AllowTypeCoercion () |
Creates an instance with TypeConsistencyEnforcementKind::ALLOW_TYPE_COERCION. More... | |
static TypeConsistencyEnforcement | DisallowTypeCoercion () |
Creates an instance with TypeConsistencyEnforcementKind::DISALLOW_TYPE_COERCION. More... | |
static TypeConsistencyEnforcement | AutoTypeCoercion () |
Creates an instance with TypeConsistencyEnforcementKind::AUTO_TYPE_COERCION. More... | |
Defines the rules for determining whether the type used to publish a given topic is consistent with that used to subscribe to it.
This policy defines a type consistency kind, which allows applications to select from among a set of predetermined behaviors. The following consistency kinds are specified: TypeConsistencyKind::DISALLOW_TYPE_COERCION, TypeConsistencyKind::ALLOW_TYPE_COERCION and TypeConsistencyKind::AUTO_TYPE_COERCION.
The type-consistency-enforcement rules consist of two steps:
Step 1. If both the DataWriter and DataReader specify a TypeObject, it is considered first. If the DataReader allows type coercion, then its type must be assignable from the DataWriter's type, taking into account the values of prevent_type_widening, ignore_sequence_bounds, ignore_string_bounds, ignore_member_names, and ignore_enum_literal_names. If the DataReader does not allow type coercion, then its type must be equivalent to the type of the DataWriter.
Step 2. If either the DataWriter or the DataReader does not provide a TypeObject definition, then the registered type names are examined. The DataReader's and DataWriter's registered type names must match exactly, as was true in RTI Connext releases prior to 5.0.0.
If either Step 1 or Step 2 fails, the Topics associated with the DataReader and DataWriter are considered to be inconsistent and the dds::core::status::InconsistentTopicStatus is updated.
The default enforcement kind is TypeConsistencyKind::AUTO_TYPE_COERCION. This default kind translates to TypeConsistencyKind::ALLOW_TYPE_COERCION except in the following cases:
For additional information on type consistency enforcement refer to the Extensible Types Guide and the OMG Extensible and Dynamic Topic Types for DDS Specification.
|
inline |
Creates the default policy.
|
inlineexplicit |
Creates an instance with a specific enforcement kind.
|
inline |
Sets the enforcement kind.
[default] TypeConsistencyKind::AUTO_TYPE_COERCION
|
inline |
Gets the enforcement kind.
|
inline |
Controls whether sequence bounds are ignored.
If the option is set to true, then sequence bounds (maximum lengths) are not considered as part of the type assignability. This means that a T2 sequence type with maximum length L2 would be assignable to a T1 sequence type with maximum length L1, even if L2 is greater than L1. If the option is set to false, then sequence bounds are taken into consideration for type assignability, and in order for T1 to be assignable from T2, it is required that L1 >= L2.
[default] true
|
inline |
Getter (see setter with the same name)
|
inline |
Controls whether string bounds are ignored.
If the option is set to true, then string bounds (maximum lengths) are not considered as part of the type assignability. This means that a T2 string type with maximum length L2 would be assignable to a T1 string type with maximum length L1, even if L2 is greater than L1. If the option is set to false, then string bounds are taken into consideration for type assignability, and in order for T1 to be assignable from T2, it is required that L1 >= L2.
[default] true
|
inline |
Getter (see setter with the same name)
|
inline |
Controls whether member names are ignored.
If the option is set to true, then member names are not considered as part of the type assignability. If the option is set to false, then member names are taken into consideration for type assignability, and in order for members with the same ID to be assignable, the members must also have the same name.
[default] false
|
inline |
Getter (see setter with the same name)
|
inline |
Controls whether type widening is prevented.
If the option is set to false, then type widening is permitted. If the option is set to true, then a wider type may not be assignable from a narrower type.
[default] false
|
inline |
Getter (see setter with the same name)
|
inline |
Controls whether type validation is forced.
If the option is set to true, then type information must be available in order to complete matching between a dds::pub::DataWriter and a dds::sub::DataReader. If the option is set to false, then matching can occur without complete type information as long as the type names match exactly. Note that if the types have the same name but are not assignable, DataReaders may fail to deserialize incoming data samples.
[default] false
|
inline |
Getter (see setter with the same name)
|
inline |
Controls whether enumeration literal names are ignored.
If the option is set to true, then enumeration constants may change their names, but not their values, and still maintain assignability. If the option is set to false, then in order for enumerations to be assignable, any constant that has the same value in both enumerations must also have the same name.
[default] false
|
inline |
Getter (see setter with the same name)
|
inlinestatic |
Creates an instance with TypeConsistencyEnforcementKind::ALLOW_TYPE_COERCION.
|
inlinestatic |
Creates an instance with TypeConsistencyEnforcementKind::DISALLOW_TYPE_COERCION.
|
inlinestatic |
Creates an instance with TypeConsistencyEnforcementKind::AUTO_TYPE_COERCION.