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

Specifies how long the data written by a dds::pub::DataWriter is considered valid. More...

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

Public Member Functions

 Lifespan ()
 Creates the default policy with an infinite lifespan.
 
 Lifespan (const dds::core::Duration &d)
 Creates a policy with the specified lifespan duration.
 
Lifespanduration (const dds::core::Duration &d)
 Sets the maximum duration for which the data is valid.
 
const dds::core::Duration duration () const
 Getter (see setter with the same name)
 

Detailed Description

Specifies how long the data written by a dds::pub::DataWriter is considered valid.

Each data sample written by the dds::pub::DataWriter has an associated expiration time beyond which the data should not be delivered to any application. Once the sample expires, the data will be removed from the dds::sub::DataReader caches as well as from the transient and persistent information caches.

The expiration time of each sample from the dds::pub::DataWriter's cache is computed by adding the duration specified by this QoS policy to the time when the sample is added to the dds::pub::DataWriter's cache. This timestamp is not necessarily equal to the sample's source timestamp that can be provided by the user using the dds::pub::DataWriter::write(const T&,const dds::core::Time&) or dds::pub::DataWriter::write(const T&,rti::pub::WriteParams&) API.

The expiration time of each sample from the dds::sub::DataReader's cache is computed by adding the duration to the reception timestamp.

See Also
dds::pub::DataWriter::write()
dds::pub::DataWriter::write(const T&,const dds::core::Time&)
Entity:
dds::topic::Topic, dds::pub::DataWriter
Properties:
RxO = N/A
Changeable = YES

Usage

The Lifespan QoS policy can be used to control how much data is stored by RTI Connext. Even if it is configured to store "all" of the data sent or received for a topic (see dds::core::policy::History), the total amount of data it stores may be limited by this QoS policy.

You may also use this QoS policy to ensure that applications do not receive or act on data, commands or messages that are too old and have 'expired.'

To avoid inconsistencies, multiple writers of the same instance should have the same lifespan.

See Also
dds::sub::SampleInfo::source_timestamp
dds::sub::SampleInfo::reception_timestamp

Constructor & Destructor Documentation

dds::core::policy::Lifespan::Lifespan ( )
inline

Creates the default policy with an infinite lifespan.

dds::core::policy::Lifespan::Lifespan ( const dds::core::Duration d)
inlineexplicit

Creates a policy with the specified lifespan duration.

Member Function Documentation

Lifespan& dds::core::policy::Lifespan::duration ( const dds::core::Duration d)
inline

Sets the maximum duration for which the data is valid.

[default] dds::core::Duration::infinite()

[range] [1 nanosec, 1 year] or dds::core::Duration::infinite()

const dds::core::Duration dds::core::policy::Lifespan::duration ( ) const
inline

Getter (see setter with the same name)


RTI Connext Modern C++ API Version 6.0.0 Copyright © Sun Mar 3 2019 Real-Time Innovations, Inc