RTI Connext Modern C++ API Version 7.3.0
dds::core::policy::WriterDataLifecycle Class Reference

Controls how a dds::pub::DataWriter handles the lifecycle of the instances (keys) that it writes. More...

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

Public Member Functions

 WriterDataLifecycle ()
 Creates the default policy. More...
 
 WriterDataLifecycle (bool autodispose)
 Creates an instance with a value for auto-dispose unregistered instances and default values for the rest of parameters. More...
 
WriterDataLifecycleautodispose_unregistered_instances (bool b)
 Indicates whether the DataWriter should automatically dispose an instance when it unregisters it. More...
 
bool autodispose_unregistered_instances () const
 Getter (see setter with the same name) More...
 
dds::core::policy::WriterDataLifecycleautopurge_unregistered_instances_delay (const dds::core::Duration &duration)
 <<extension>> Maximum duration for which the DataWriter will maintain information regarding an instance once it has unregistered the instance. More...
 
dds::core::Duration autopurge_unregistered_instances_delay () const
 <<extension>> Getter (see setter with the same name) More...
 
dds::core::policy::WriterDataLifecycleautopurge_disposed_instances_delay (const dds::core::Duration &duration)
 <<extension>> Maximum duration for which the DataWriter will maintain information regarding an instance once it has disposed the instance. More...
 
dds::core::Duration autopurge_disposed_instances_delay () const
 <<extension>> Getter (see setter with the same name) More...
 

Static Public Member Functions

static WriterDataLifecycle AutoDisposeUnregisteredInstances ()
 Creates WriterDataLifecycle(true) More...
 
static WriterDataLifecycle ManuallyDisposeUnregisteredInstances ()
 Creates WriterDataLifecycle(false) More...
 

Detailed Description

Controls how a dds::pub::DataWriter handles the lifecycle of the instances (keys) that it writes.

Entity:
dds::pub::DataWriter
Properties:
RxO = N/A
Changeable = YES

Usage

This policy determines how the dds::pub::DataWriter acts with regards to the lifecycle of the data instances it manages (data instances that have been either explicitly registered with the dds::pub::DataWriter or implicitly registered by directly writing the data).

You may use dds::pub::DataWriter::unregister_instance to indicate that the dds::pub::DataWriter no longer wants to send data for a dds::topic::Topic.

The behavior controlled by this QoS policy applies on a per instance (key) basis for keyed Topics, so that when a dds::pub::DataWriter unregisters an instance, RTI Connext can automatically also dispose that instance. This is the default behavior.

In many cases where the ownership of a Topic is shared (see dds::core::policy::Ownership), DataWriters may want to relinquish their ownership of a particular instance of the Topic to allow other DataWriters to send updates for the value of that instance regardless of Ownership Strength. In that case, you may only want a DataWriter to unregister an instance without disposing the instance. Disposing an instance is a statement that an instance no longer exists. User applications may be coded to trigger on the disposal of instances, thus the ability to unregister without disposing may be useful to properly maintain the semantic of disposal.

Constructor & Destructor Documentation

◆ WriterDataLifecycle() [1/2]

dds::core::policy::WriterDataLifecycle::WriterDataLifecycle ( )
inline

Creates the default policy.

◆ WriterDataLifecycle() [2/2]

dds::core::policy::WriterDataLifecycle::WriterDataLifecycle ( bool  autodispose)
inlineexplicit

Creates an instance with a value for auto-dispose unregistered instances and default values for the rest of parameters.

Member Function Documentation

◆ autodispose_unregistered_instances() [1/2]

WriterDataLifecycle & dds::core::policy::WriterDataLifecycle::autodispose_unregistered_instances ( bool  b)
inline

Indicates whether the DataWriter should automatically dispose an instance when it unregisters it.

  • true
    The dds::pub::DataWriter will dispose of the instance each time it is unregistered. The behavior is identical to explicitly calling one of the dispose operations on the instance prior to calling the unregister operation.
  • false (default)
    The dds::pub::DataWriter will not dispose of the instance. The application can still call one of the dispose operations prior to unregistering the instance and dispose of the instance that way.

[default] false

◆ autodispose_unregistered_instances() [2/2]

bool dds::core::policy::WriterDataLifecycle::autodispose_unregistered_instances ( ) const
inline

Getter (see setter with the same name)

◆ AutoDisposeUnregisteredInstances()

static WriterDataLifecycle dds::core::policy::WriterDataLifecycle::AutoDisposeUnregisteredInstances ( )
inlinestatic

Creates WriterDataLifecycle(true)

◆ ManuallyDisposeUnregisteredInstances()

static WriterDataLifecycle dds::core::policy::WriterDataLifecycle::ManuallyDisposeUnregisteredInstances ( )
inlinestatic

Creates WriterDataLifecycle(false)

◆ autopurge_unregistered_instances_delay() [1/2]

dds::core::policy::WriterDataLifecycle & autopurge_unregistered_instances_delay ( const dds::core::Duration duration)

<<extension>> Maximum duration for which the DataWriter will maintain information regarding an instance once it has unregistered the instance.

Note
This function is an extension, it must be called via the extensions() member function

Determines how long the dds::pub::DataWriter will maintain information regarding an instance that has been unregistered. By default, the dds::pub::DataWriter resources associated with an instance (e.g., the space needed to remember the Instance Key or KeyHash) are released lazily. This means the resources are only reclaimed when the space is needed for another instance because dds::core::policy::ResourceLimits::max_instances is exceeded. This behavior can be changed by setting autopurge_unregistered_instances_delay to a value other than dds::core::Duration::infinite().

After this time elapses, the dds::pub::DataWriter will purge all internal information regarding the instance, including historical samples, even if dds::core::policy::ResourceLimits::max_instances has not been reached.

The purging of unregistered instances can be done based on the source timestamp of the unregister sample or the time where the unregister sample was added to the DataWriter queue by setting the following property to 1 or 0 respectively (default: 0): dds.data_writer.history.source_timestamp_based_autopurge_instances_delay.

For durable writer history, autopurge_unregistered_instances_delay supports only the dds::core::Duration::infinite() value.

[default] dds::core::Duration::infinite() (disabled) for all dds::pub::DataWriter except for the built-in discovery DataWriters
dds::core::Duration::zero() for built-in discovery DataWriters (see rti::core::policy::DiscoveryConfig::publication_writer_data_lifecycle, rti::core::policy::DiscoveryConfig::subscription_writer_data_lifecycle and rti::core::policy::DiscoveryConfig::participant_configuration_writer_data_lifecycle).

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

◆ autopurge_unregistered_instances_delay() [2/2]

dds::core::Duration autopurge_unregistered_instances_delay ( ) const

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

◆ autopurge_disposed_instances_delay() [1/2]

dds::core::policy::WriterDataLifecycle & autopurge_disposed_instances_delay ( const dds::core::Duration duration)

<<extension>> Maximum duration for which the DataWriter will maintain information regarding an instance once it has disposed the instance.

Note
This function is an extension, it must be called via the extensions() member function

Determines how long the dds::pub::DataWriter will maintain information regarding an instance that has been disposed of. By default, disposing of an instance does not make it eligible to be purged. By setting autopurge_disposed_instances_delay to a value other than dds::core::Duration::infinite(), the DataWriter will delete the resources associated with an instance (including historical samples) once the time has elapsed and all matching DataReaders have acknowledged all the samples for this instance including the dispose sample.

The purging of disposed instances can be done based on the source timestamp of the dispose sample or the time when the dispose sample was added to the DataWriter queue by setting the following property to 1 or 0 respectively (default: 0): dds.data_writer.history.source_timestamp_based_autopurge_instances_delay.

This QoS value is supported with durable DataWriter queues only for dds::core::Duration::zero() and dds::core::Duration::infinite() values (finite values are not supported).

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

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

◆ autopurge_disposed_instances_delay() [2/2]

dds::core::Duration autopurge_disposed_instances_delay ( ) const

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