RTI Connext Modern C++ API  Version 6.1.1
dds::core::policy::DestinationOrder Class Reference

Controls the logical order of updates to the same instance by a dds::pub::Publisher. More...

#include <dds/core/policy/CorePolicy.hpp>

Public Member Functions

 DestinationOrder ()
 Creates the default policy. More...
 
 DestinationOrder (dds::core::policy::DestinationOrderKind the_kind)
 Creates a policy with the specified destination order kind. More...
 
DestinationOrderkind (dds::core::policy::DestinationOrderKind the_kind)
 Sets the destination order kind. More...
 
dds::core::policy::DestinationOrderKind kind () const
 Getter (see the setter with the same name) More...
 
DestinationOrderImpl & scope (rti::core::policy::DestinationOrderScopeKind the_scope)
 <<extension>> Sets the destination order scope More...
 
rti::core::policy::DestinationOrderScopeKind scope () const
 <<extension>> Getter (see the setter with the same name) More...
 
dds::core::policy::DestinationOrdersource_timestamp_tolerance (const dds::core::Duration &ms)
 <<extension>> Sets the allowed tolerance between source timestamps of consecutive samples. More...
 
dds::core::Duration source_timestamp_tolerance () const
 <<extension>> Getter (see the setter with the same name) More...
 

Static Public Member Functions

static DestinationOrder SourceTimestamp ()
 Creates a DestinationOrder with DestinationOrderKind::BY_SOURCE_TIMESTAMP. More...
 
static DestinationOrder ReceptionTimestamp ()
 Creates a DestinationOrder with DestinationOrderKind::BY_RECEPTION_TIMESTAMP. More...
 

Detailed Description

Controls the logical order of updates to the same instance by a dds::pub::Publisher.

Entity:
dds::topic::Topic, dds::sub::DataReader, dds::pub::DataWriter
Status:
dds::core::status::StatusMask::offered_incompatible_qos(), dds::core::status::StatusMask::requested_incompatible_qos()
Properties:
RxO = YES
Changeable = UNTIL ENABLE

Usage

When multiple DataWriters send data for the same topic, the order in which data from different DataWriters are received by the applications of different DataReaders may be different. So different DataReaders may not receive the same "last" value when DataWriters stop sending data.

This QoS policy controls how each subscriber resolves the final value of a data instance that is written by multiple dds::pub::DataWriter entities (which may be associated with different dds::pub::Publisher entities) running on different nodes.

This QoS can be used to create systems that have the property of "eventual consistency." Thus intermediate states across multiple applications may be inconsistent, but when DataWriters stop sending changes to the same topic, all applications will end up having the same state.

This QoS policy can be set for both DataWriters and DataReaders.

For the DataReader:

The default setting, dds::core::policy::DestinationOrderKind::BY_RECEPTION_TIMESTAMP, indicates that (assuming the OWNERSHIP_STRENGTH policy allows it) the latest received value for the instance should be the one whose value is kept. That is, data will be delivered by a dds::sub::DataReader in the order in which it was received (which may lead to inconsistent final values).

For dds::core::policy::DestinationOrderKind::BY_SOURCE_TIMESTAMP, if the scope is set to dds::core::policy::DestinationOrderScopeKind::INSTANCE (default), within each instance, the sample's source timestamp shall be used to determine the most recent information. This is the only setting that, in the case of concurrent same-strength DataWriters updating the same instance, ensures that all DataReaders end up with the same final value for the instance. If a DataReader receives a sample for an instance with a source timestamp that is older than the last source timestamp received for the instance, the sample is dropped. The SAMPLE_REJECTED status or the SAMPLE_LOST status will not be updated.

If scope is set to dds::core::policy::DestinationOrderScopeKind::TOPIC, the ordering is enforced per topic across all instances.

In addition, a DataReader will accept a sample only if the source timestamp is no farther in the future from the reception timestamp than source_timestamp_tolerance. Otherwise, the DDS sample is dropped. The SAMPLE_REJECTED status or the SAMPLE_LOST status will not be updated.

For the DataWriter:

For the default setting, dds::core::policy::DestinationOrderKind::BY_RECEPTION_TIMESTAMP, the DataWriter will not enforce source timestamp ordering when writing samples using the dds::pub::DataWriter::write(const T&,rti::pub::WriteParams&) or dds::pub::DataWriter::write(const T&,const dds::core::Time&) API. The source timestamp of a new sample can be older than the source timestamp of the previous samples.

When using dds::core::policy::DestinationOrderKind::BY_SOURCE_TIMESTAMP, If scope is set to dds::core::policy::DestinationOrderScopeKind::INSTANCE (default), when writing a sample, the sample's timestamp must not be older than the timestamp of the previously written DDS sample for the same instance. If, however, the timestamp is older than the timestamp of the previously written DDS sample—but the difference is less than the source_timestamp_tolerance—the DDS sample will use the previously written DDS sample's timestamp as its timestamp. Otherwise, if the difference is greater than the tolerance, the write will fail with retcode dds::core::InvalidArgumentError.

If scope is set to dds::core::policy::DestinationOrderScopeKind::TOPIC, a new sample timestamp must not be older than the timestamp of the previously written DDS sample, across all instances. (The ordering is enforced across all instances.)

Compatibility

The value offered is considered compatible with the value requested if and only if the inequality offered kind >= requested kind evaluates to 'TRUE'. For the purposes of this inequality, the values of dds::core::policy::DestinationOrder::kind are considered ordered such that dds::core::policy::DestinationOrderKind::BY_RECEPTION_TIMESTAMP < dds::core::policy::DestinationOrderKind::BY_SOURCE_TIMESTAMP

Constructor & Destructor Documentation

◆ DestinationOrder() [1/2]

dds::core::policy::DestinationOrder::DestinationOrder ( )
inline

Creates the default policy.

◆ DestinationOrder() [2/2]

dds::core::policy::DestinationOrder::DestinationOrder ( dds::core::policy::DestinationOrderKind  the_kind)
inlineexplicit

Creates a policy with the specified destination order kind.

Member Function Documentation

◆ kind() [1/2]

DestinationOrder& dds::core::policy::DestinationOrder::kind ( dds::core::policy::DestinationOrderKind  the_kind)
inline

Sets the destination order kind.

[default] dds::core::policy::DestinationOrderKind::BY_RECEPTION_TIMESTAMP,

◆ kind() [2/2]

dds::core::policy::DestinationOrderKind dds::core::policy::DestinationOrder::kind ( ) const
inline

Getter (see the setter with the same name)

◆ SourceTimestamp()

static DestinationOrder dds::core::policy::DestinationOrder::SourceTimestamp ( )
inlinestatic

Creates a DestinationOrder with DestinationOrderKind::BY_SOURCE_TIMESTAMP.

◆ ReceptionTimestamp()

static DestinationOrder dds::core::policy::DestinationOrder::ReceptionTimestamp ( )
inlinestatic

Creates a DestinationOrder with DestinationOrderKind::BY_RECEPTION_TIMESTAMP.

References dds::core::Duration::from_millisecs().

◆ scope() [1/2]

DestinationOrderImpl & scope ( rti::core::policy::DestinationOrderScopeKind  the_scope)

<<extension>> Sets the destination order scope

Note
This function is an extension, it must be called via this->extensions()

Indicates if tolerance check and the current sample's timestamp is computed based on instance or topic basis.
[default] dds::core::policy::DestinationOrderScopeKind::INSTANCE

◆ scope() [2/2]

<<extension>> Getter (see the setter with the same name)

◆ source_timestamp_tolerance() [1/2]

dds::core::policy::DestinationOrder & source_timestamp_tolerance ( const dds::core::Duration ms)

<<extension>> Sets the allowed tolerance between source timestamps of consecutive samples.

Note
This function is an extension, it must be called via this->extensions()

When a dds::pub::DataWriter sets dds::core::policy::DestinationOrderKind to dds::core::policy::DestinationOrderKind::BY_SOURCE_TIMESTAMP, when writing a sample, its timestamp must not be less than the timestamp of the previously written sample. However, if it is less than the timestamp of the previously written sample but the difference is less than this tolerance, the sample will use the previously written sample's timestamp as its timestamp. Otherwise, if the difference is greater than this tolerance, the write will fail.

When a dds::sub::DataReader sets dds::core::policy::DestinationOrderKind to dds::core::policy::DestinationOrderKind::BY_SOURCE_TIMESTAMP, the dds::sub::DataReader will accept a sample only if the source timestamp is no farther in the future from the reception timestamp than this tolerance. Otherwise, the sample is dropped.

[default] 100 milliseconds for dds::pub::DataWriter, 30 seconds for dds::sub::DataReader and when default-constructed

◆ source_timestamp_tolerance() [2/2]

dds::core::Duration source_timestamp_tolerance ( ) const

<<extension>> Getter (see the setter with the same name)