RTI Connext .NET API (legacy)  Version 6.1.2

Information that accompanies each sample that is read or taken. More...

#include <managed_subscription.h>

Properties

SampleStateKind sample_state [get, set]
 The sample state of the sample. More...
 
ViewStateKind view_state [get, set]
 The view state of the instance. More...
 
InstanceStateKind instance_state [get, set]
 The instance state of the instance. More...
 
Time_t source_timestamp [get, set]
 The timestamp when the sample was written by a DataWriter. More...
 
InstanceHandle_t instance_handle [get, set]
 Identifies locally the corresponding instance. More...
 
InstanceHandle_t publication_handle [get, set]
 Identifies locally the DataWriter that modified the instance. More...
 
System::Int32 disposed_generation_count [get, set]
 The disposed generation count of the instance at the time of sample reception. More...
 
System::Int32 no_writers_generation_count [get, set]
 The no writers generation count of the instance at the time of sample reception. More...
 
System::Int32 sample_rank [get, set]
 The sample rank of the sample. More...
 
System::Int32 generation_rank [get, set]
 The generation rank of the sample. More...
 
System::Int32 absolute_generation_rank [get, set]
 The absolute generation rank of the sample. More...
 
System::Boolean valid_data [get, set]
 Indicates whether the DataSample contains data or else it is only used to communicate a change in the instance_state of the instance. More...
 
Time_t reception_timestamp [get, set]
 <<extension>> The timestamp when the sample was committed by a DataReader. More...
 
SequenceNumber_t publication_sequence_number [get, set]
 <<extension>> The publication sequence number. More...
 
SequenceNumber_t reception_sequence_number [get, set]
 <<extension>> The reception sequence number when sample was committed by a DataReader More...
 
GUID_t original_publication_virtual_guid [get, set]
 <<extension>> The original publication virtual GUID. More...
 
SequenceNumber_t original_publication_virtual_sequence_number [get, set]
 <<extension>> The original publication virtual sequence number. More...
 
GUID_t related_original_publication_virtual_guid [get, set]
 <<extension>> The original publication virtual GUID of a related sample. More...
 
SequenceNumber_t related_original_publication_virtual_sequence_number [get, set]
 <<extension>> The original publication virtual sequence number of a related sample. More...
 
System::Int32 flag [get, set]
 <<extension>> Flags associated with the sample. More...
 
GUID_t source_guid [get, set]
 <<extension>> The application logical data source that is related to the sample. More...
 
GUID_t related_source_guid [get, set]
 <<extension>> The application logical data source that is related to the sample. More...
 
GUID_t related_subscription_guid [get, set]
 <<extension>> The related_reader_guid associated with the sample. More...
 
GUID_t topic_query_guid [get, set]
 <<extension>> The GUID of the DDS::TopicQuery that is related to the sample. More...
 
Nullable< CoherentSetInfo_tcoherent_set_info [get]
 <<extension>> The information about the coherent set that this sample is a part of. More...
 

Detailed Description

Information that accompanies each sample that is read or taken.

Interpretation of the SampleInfo

The DDS::SampleInfo contains information pertaining to the associated Data instance sample including:

  • the sample_state of the Data value (i.e., if it has already been read or not)

  • the view_state of the related instance (i.e., if the instance is new or not)

  • the instance_state of the related instance (i.e., if the instance is alive or not)
  • DDS::SampleInfo::valid_data flag. This flag indicates whether there is data associated with the sample. Some samples do not contain data indicating only a change on the instance_state of the corresponding instance.
  • The values of disposed_generation_count and no_writers_generation_count for the related instance at the time the sample was received. These counters indicate the number of times the instance had become ALIVE (with instance_state= DDS::InstanceStateKind::ALIVE_INSTANCE_STATE) at the time the sample was received.
  • The sample_rank and generation_rank of the sample within the returned sequence. These ranks provide a preview of the samples that follow within the sequence returned by the read or take operations.

  • The absolute_generation_rank of the sample within the DDS::DataReader. This rank provides a preview of what is available within the DDS::DataReader.
  • The source_timestamp of the sample. This is the timestamp provided by the DDS::DataWriter at the time the sample was produced.

Interpretation of the SampleInfo disposed_generation_count and no_writers_generation_count

For each instance, RTI Connext internally maintains two counts, the DDS::SampleInfo::disposed_generation_count and DDS::SampleInfo::no_writers_generation_count, relative to each DataReader:

  • These 'generation counts' are reset to zero when the instance resource is reclaimed.

The DDS::SampleInfo::disposed_generation_count and DDS::SampleInfo::no_writers_generation_count available in the DDS::SampleInfo capture a snapshot of the corresponding counters at the time the sample was received.

Interpretation of the SampleInfo sample_rank, generation_rank and absolute_generation_rank

The DDS::SampleInfo::sample_rank and DDS::SampleInfo::generation_rank available in the DDS::SampleInfo are computed based solely on the actual samples in the ordered collection returned by read or take.

  • The DDS::SampleInfo::generation_rank available in the DDS::SampleInfo indicates the difference in "generations" between the sample (S) and the Most Recent Sample of the same instance that appears in the returned Collection (MRSIC). That is, it counts the number of times the instance transitioned from not-alive to alive in the time from the reception of the S to the reception of MRSIC.
  • These 'generation ranks' are reset to zero when the instance resource is reclaimed.

The DDS::SampleInfo::generation_rank is computed using the formula:

generation_rank = (MRSIC.disposed_generation_count
                          + MRSIC.no_writers_generation_count)
                    - (S.disposed_generation_count
                          + S.no_writers_generation_count)                 

The DDS::SampleInfo::absolute_generation_rank available in the DDS::SampleInfo indicates the difference in "generations" between the sample (S) and the Most Recent Sample of the same instance that the middleware has received (MRS). That is, it counts the number of times the instance transitioned from not-alive to alive in the time from the reception of the S to the time when the read or take was called.

absolute_generation_rank = (MRS.disposed_generation_count
                                  + MRS.no_writers_generation_count)
                             - (S.disposed_generation_count
                                  + S.no_writers_generation_count)                 

Interpretation of the SampleInfo counters and ranks

These counters and ranks allow the application to distinguish samples belonging to different "generations" of the instance. Note that it is possible for an instance to transition from not-alive to alive (and back) several times before the application accesses the data by means of read or take. In this case, the returned collection may contain samples that cross generations (i.e. some samples were received before the instance became not-alive, other after the instance re-appeared again). Using the information in the DDS::SampleInfo, the application can anticipate what other information regarding the same instance appears in the returned collection, as well as in the infrastructure and thus make appropriate decisions.

For example, an application desiring to only consider the most current sample for each instance would only look at samples with sample_rank == 0. Similarly, an application desiring to only consider samples that correspond to the latest generation in the collection will only look at samples with generation_rank == 0. An application desiring only samples pertaining to the latest generation available will ignore samples for which absolute_generation_rank != 0. Other application-defined criteria may also be used.

See also
DDS::SampleStateKind, DDS::InstanceStateKind, DDS::ViewStateKind, DDS::SampleInfo::valid_data
DDSInstanceViewStates.png
Statechart of the instance_state and view_state of a single instance

Property Documentation

◆ sample_state

SampleStateKind DDS::SampleInfo::sample_state
getset

The sample state of the sample.

Indicates whether or not the corresponding data sample has already been read.

See also
DDS::SampleStateKind

◆ view_state

ViewStateKind DDS::SampleInfo::view_state
getset

The view state of the instance.

Indicates whether the DDS::DataReader has already seen samples for the most-current generation of the related instance.

See also
DDS::ViewStateKind

◆ instance_state

InstanceStateKind DDS::SampleInfo::instance_state
getset

The instance state of the instance.

Indicates whether the instance is currently in existence or, if it has been disposed, the reason why it was disposed.

See also
DDS::InstanceStateKind

◆ source_timestamp

Time_t DDS::SampleInfo::source_timestamp
getset

The timestamp when the sample was written by a DataWriter.

◆ instance_handle

InstanceHandle_t DDS::SampleInfo::instance_handle
getset

Identifies locally the corresponding instance.

◆ publication_handle

InstanceHandle_t DDS::SampleInfo::publication_handle
getset

Identifies locally the DataWriter that modified the instance.

The publication_handle is the same DDS::InstanceHandle_t that is returned by the operation DDS::DataReader::get_matched_publications and can also be used as a parameter to the operation DDS::DataReader::get_matched_publication_data.

◆ disposed_generation_count

System:: Int32 DDS::SampleInfo::disposed_generation_count
getset

The disposed generation count of the instance at the time of sample reception.

Indicates how many times the instance_state of the corresponding instance changed from DDS::InstanceStateKind::NOT_ALIVE_DISPOSED_INSTANCE_STATE to DDS::InstanceStateKind::ALIVE_INSTANCE_STATE. The counter is reset when the instance resource is reclaimed (removed from the DataReader cache).

See also
Interpretation of the SampleInfo disposed_generation_count and no_writers_generation_count Interpretation of the SampleInfo counters and ranks

◆ no_writers_generation_count

System:: Int32 DDS::SampleInfo::no_writers_generation_count
getset

The no writers generation count of the instance at the time of sample reception.

Indicates how many times the instance_state of the corresponding instance changed from DDS::InstanceStateKind::NOT_ALIVE_NO_WRITERS_INSTANCE_STATE to DDS::InstanceStateKind::ALIVE_INSTANCE_STATE. The counter is reset when the instance resource is reclaimed (removed from the DataReader cache).

See also
Interpretation of the SampleInfo disposed_generation_count and no_writers_generation_count Interpretation of the SampleInfo counters and ranks

◆ sample_rank

System:: Int32 DDS::SampleInfo::sample_rank
getset

The sample rank of the sample.

Indicates the number of samples related to the same instance that follow in the collection returned by read or take.

See also
Interpretation of the SampleInfo sample_rank, generation_rank and absolute_generation_rank Interpretation of the SampleInfo counters and ranks

◆ generation_rank

System:: Int32 DDS::SampleInfo::generation_rank
getset

The generation rank of the sample.

Indicates the generation difference (number of times the instance was NOT_ALIVE and become alive again) between the time the sample was received and the time the most recent sample in the collection related to the same instance was received.

See also
Interpretation of the SampleInfo sample_rank, generation_rank and absolute_generation_rank Interpretation of the SampleInfo counters and ranks

◆ absolute_generation_rank

System:: Int32 DDS::SampleInfo::absolute_generation_rank
getset

The absolute generation rank of the sample.

Indicates the generation difference (number of times the instance was disposed and become alive again) between the time the sample was received, and the time the most recent sample (which may not be in the returned collection) related to the same instance was received.

See also
Interpretation of the SampleInfo sample_rank, generation_rank and absolute_generation_rank Interpretation of the SampleInfo counters and ranks

◆ valid_data

System:: Boolean DDS::SampleInfo::valid_data
getset

Indicates whether the DataSample contains data or else it is only used to communicate a change in the instance_state of the instance.

Normally each DataSample contains both a DDS::SampleInfo and some Data. However there are situations where a DataSample contains only the DDS::SampleInfo and does not have any associated data. This occurs when the RTI Connext notifies the application of a change of state for an instance that was caused by some internal mechanism (such as a timeout) for which there is no associated data. An example of this situation is when the RTI Connext detects that an instance has no writers and changes the corresponding instance_state to DDS::InstanceStateKind::NOT_ALIVE_NO_WRITERS_INSTANCE_STATE.

The application can distinguish whether a particular DataSample has data by examining the value of the DDS::SampleInfo::valid_data. If this flag is set to true, then the DataSample contains valid Data. If the flag is set to false, the DataSample contains no Data.

To ensure correctness and portability, the valid_data flag must be examined by the application prior to accessing the Data associated with the DataSample and if the flag is set to false, the application should not access the Data associated with the DataSample, that is, the application should access only the DDS::SampleInfo.

◆ reception_timestamp

Time_t DDS::SampleInfo::reception_timestamp
getset

<<extension>> The timestamp when the sample was committed by a DataReader.

◆ publication_sequence_number

SequenceNumber_t DDS::SampleInfo::publication_sequence_number
getset

<<extension>> The publication sequence number.

◆ reception_sequence_number

SequenceNumber_t DDS::SampleInfo::reception_sequence_number
getset

<<extension>> The reception sequence number when sample was committed by a DataReader

◆ original_publication_virtual_guid

GUID_t DDS::SampleInfo::original_publication_virtual_guid
getset

<<extension>> The original publication virtual GUID.

If the DDS::PresentationQosPolicy::access_scope of the DDS::Publisher is GROUP_PRESENTATION_QOS, this field contains the DDS::Publisher virtual GUID that uniquely identifies the DataWriter group.

See also
RTI::Connext::Infrastructure::Sample<T>::Identity

◆ original_publication_virtual_sequence_number

SequenceNumber_t DDS::SampleInfo::original_publication_virtual_sequence_number
getset

<<extension>> The original publication virtual sequence number.

If the DDS::PresentationQosPolicy::access_scope of the DDS::Publisher is GROUP_PRESENTATION_QOS, this field contains the DDS::Publisher virtual sequence number that uniquely identifies a sample within the DataWriter group.

See also
RTI::Connext::Infrastructure::Sample<T>::Identity

◆ related_original_publication_virtual_guid

GUID_t DDS::SampleInfo::related_original_publication_virtual_guid
getset

<<extension>> The original publication virtual GUID of a related sample.

See also
RTI::Connext::Infrastructure::Sample<T>::RelatedIdentity

◆ related_original_publication_virtual_sequence_number

SequenceNumber_t DDS::SampleInfo::related_original_publication_virtual_sequence_number
getset

<<extension>> The original publication virtual sequence number of a related sample.

See also
RTI::Connext::Infrastructure::Sample<T>::RelatedIdentity

◆ flag

System:: Int32 DDS::SampleInfo::flag
getset

<<extension>> Flags associated with the sample.

The flags can be set by using the field DDS::WriteParams_t::flag when writing a sample using the method DDS::TypedDataWriter::write_w_params.

◆ source_guid

GUID_t DDS::SampleInfo::source_guid
getset

<<extension>> The application logical data source that is related to the sample.

The related_source_guid can be set by using the field DDS::WriteParams_t::related_source_guid when writing a sample using the method DDS::TypedDataWriter::write_w_params.

◆ related_source_guid

GUID_t DDS::SampleInfo::related_source_guid
getset

<<extension>> The application logical data source that is related to the sample.

The related_source_guid can be set by using the field DDS::WriteParams_t::related_source_guid when writing a sample using the method DDS::TypedDataWriter::write_w_params.

◆ related_subscription_guid

GUID_t DDS::SampleInfo::related_subscription_guid
getset

<<extension>> The related_reader_guid associated with the sample.

The related_reader_guid can be set by using the field DDS::WriteParams_t::related_reader_guid when writing a sample using the method DDS::TypedDataWriter::write_w_params.

◆ topic_query_guid

GUID_t DDS::SampleInfo::topic_query_guid
getset

<<extension>> The GUID of the DDS::TopicQuery that is related to the sample.

This GUID indicates whether a sample is part of the response to a DDS::TopicQuery or a regular ("live") sample:

◆ coherent_set_info

Nullable< CoherentSetInfo_t> DDS::SampleInfo::coherent_set_info
get

<<extension>> The information about the coherent set that this sample is a part of.

This field is set for all samples that are part of a coherent set. Coherent sets are initiated using the operation DDS::Publisher::begin_coherent_changes and finalized using the operation DDS::Publisher::end_coherent_changes.

See also
DDS::Publisher::begin_coherent_changes for additional information on coherent sets.