RTI Connext Modern C++ API  Version 6.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dds::core::policy::TypeConsistencyEnforcement Class Reference

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.
 
 TypeConsistencyEnforcement (dds::core::policy::TypeConsistencyEnforcementKind the_kind)
 Creates an instance with a specific enforcement kind.
 
TypeConsistencyEnforcementkind (dds::core::policy::TypeConsistencyEnforcementKind value)
 Sets the enforcement kind.
 
dds::core::policy::TypeConsistencyEnforcementKind kind () const
 Gets the enforcement kind.
 
TypeConsistencyEnforcementignore_sequence_bounds (bool ignore)
 Controls whether sequence bounds are ignored.
 
bool ignore_sequence_bounds () const
 Getter (see setter with the same name)
 
TypeConsistencyEnforcementignore_string_bounds (bool ignore)
 Controls whether string bounds are ignored.
 
bool ignore_string_bounds () const
 Getter (see setter with the same name)
 
TypeConsistencyEnforcementignore_member_names (bool ignore)
 Controls whether member names are ignored.
 
bool ignore_member_names () const
 Getter (see setter with the same name)
 
TypeConsistencyEnforcementprevent_type_widening (bool prevent)
 Controls whether type widening is prevented.
 
bool prevent_type_widening () const
 Getter (see setter with the same name)
 
TypeConsistencyEnforcementforce_type_validation (bool force)
 Controls whether type validation is forced.
 
bool force_type_validation () const
 Getter (see setter with the same name)
 
TypeConsistencyEnforcementignore_enum_literal_names (bool ignore)
 Controls whether enumeration literal names are ignored.
 
bool ignore_enum_literal_names () const
 Getter (see setter with the same name)
 

Static Public Member Functions

static TypeConsistencyEnforcement AllowTypeCoercion ()
 Creates an instance with TypeConsistencyEnforcementKind::ALLOW_TYPE_COERCION.
 
static TypeConsistencyEnforcement DisallowTypeCoercion ()
 Creates an instance with TypeConsistencyEnforcementKind::DISALLOW_TYPE_COERCION.
 
static TypeConsistencyEnforcement AutoTypeCoercion ()
 Creates an instance with TypeConsistencyEnforcementKind::AUTO_TYPE_COERCION.
 

Detailed Description

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:

  • When a Zero Copy DataReader is used, the kind is translated to TypeConsistencyKind::DISALLOW_TYPE_COERCION.
  • When the middleware is introspecting the built-in topic data declaration of a remote DataReader in order to determine whether it can match with a local DataWriter, if it observes that no TypeConsistencyEnforcementQosPolicy value is provided (as would be the case when communicating with a Service implementation not in conformance with this specification), it assumes a kind of TypeConsistencyKind::DISALLOW_TYPE_COERCION.

For additional information on type consistency enforcement refer to the Addendum for Extensible Types and the OMG Extensible and Dynamic Topic Types for DDS Specification.

Entity:
dds::sub::DataReader
Properties:
RxO = N/A
Changeable = UNTIL ENABLE

Constructor & Destructor Documentation

dds::core::policy::TypeConsistencyEnforcement::TypeConsistencyEnforcement ( )
inline

Creates the default policy.

dds::core::policy::TypeConsistencyEnforcement::TypeConsistencyEnforcement ( dds::core::policy::TypeConsistencyEnforcementKind  the_kind)
inlineexplicit

Creates an instance with a specific enforcement kind.

Member Function Documentation

TypeConsistencyEnforcement& dds::core::policy::TypeConsistencyEnforcement::kind ( dds::core::policy::TypeConsistencyEnforcementKind  value)
inline

Sets the enforcement kind.

[default] TypeConsistencyKind::AUTO_TYPE_COERCION

dds::core::policy::TypeConsistencyEnforcementKind dds::core::policy::TypeConsistencyEnforcement::kind ( ) const
inline

Gets the enforcement kind.

TypeConsistencyEnforcement& dds::core::policy::TypeConsistencyEnforcement::ignore_sequence_bounds ( bool  ignore)
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] false

bool dds::core::policy::TypeConsistencyEnforcement::ignore_sequence_bounds ( ) const
inline

Getter (see setter with the same name)

TypeConsistencyEnforcement& dds::core::policy::TypeConsistencyEnforcement::ignore_string_bounds ( bool  ignore)
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] false

bool dds::core::policy::TypeConsistencyEnforcement::ignore_string_bounds ( ) const
inline

Getter (see setter with the same name)

TypeConsistencyEnforcement& dds::core::policy::TypeConsistencyEnforcement::ignore_member_names ( bool  ignore)
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

bool dds::core::policy::TypeConsistencyEnforcement::ignore_member_names ( ) const
inline

Getter (see setter with the same name)

TypeConsistencyEnforcement& dds::core::policy::TypeConsistencyEnforcement::prevent_type_widening ( bool  prevent)
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

bool dds::core::policy::TypeConsistencyEnforcement::prevent_type_widening ( ) const
inline

Getter (see setter with the same name)

TypeConsistencyEnforcement& dds::core::policy::TypeConsistencyEnforcement::force_type_validation ( bool  force)
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

bool dds::core::policy::TypeConsistencyEnforcement::force_type_validation ( ) const
inline

Getter (see setter with the same name)

TypeConsistencyEnforcement& dds::core::policy::TypeConsistencyEnforcement::ignore_enum_literal_names ( bool  ignore)
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

bool dds::core::policy::TypeConsistencyEnforcement::ignore_enum_literal_names ( ) const
inline

Getter (see setter with the same name)

static TypeConsistencyEnforcement dds::core::policy::TypeConsistencyEnforcement::AllowTypeCoercion ( )
inlinestatic

Creates an instance with TypeConsistencyEnforcementKind::ALLOW_TYPE_COERCION.

static TypeConsistencyEnforcement dds::core::policy::TypeConsistencyEnforcement::DisallowTypeCoercion ( )
inlinestatic

Creates an instance with TypeConsistencyEnforcementKind::DISALLOW_TYPE_COERCION.

static TypeConsistencyEnforcement dds::core::policy::TypeConsistencyEnforcement::AutoTypeCoercion ( )
inlinestatic

Creates an instance with TypeConsistencyEnforcementKind::AUTO_TYPE_COERCION.


RTI Connext Modern C++ API Version 6.0.1 Copyright © Sat Nov 23 2019 Real-Time Innovations, Inc