CoreDX DDS Modern C++ API
Public Member Functions | List of all members
dds::pub::AnyDataWriter Class Reference

Typeless base class for the typed DataWriter. More...

Inheritance diagram for dds::pub::AnyDataWriter:
Inheritance graph
[legend]

Public Member Functions

const dds::pub::Publisherpublisher () const
 Get the Publisher that owns this DataWriter. More...
 
const dds::topic::TopicDescriptiontopic_description () const
 Get the TopicDescription associated with this DataWriter. More...
 
dds::pub::qos::DataWriterQos qos () const
 Gets the DataWriterQos setting for this instance. More...
 
void qos (const dds::pub::qos::DataWriterQos &qos)
 This operation replaces the existing set of QosPolicy settings for a DataWriter. More...
 
AnyDataWriteroperator<< (const dds::pub::qos::DataWriterQos &qos)
 This operation replaces the existing set of QosPolicy settings for a DataWriter. More...
 
const AnyDataWriteroperator>> (dds::pub::qos::DataWriterQos &qos) const
 Gets the DataWriterQos setting for this instance. More...
 
void wait_for_acknowledgments (const dds::core::Duration &timeout)
 This operation blocks the calling thread until either all data written by the DataWriter is acknowledged by the local infrastructure, or until the duration specified by the timeout parameter elapses, whichever happens first. More...
 
const dds::core::status::LivelinessLostStatus liveliness_lost_status ()
 This operation obtains the LivelinessLostStatus object of the DataWriter. More...
 
const dds::core::status::OfferedDeadlineMissedStatus offered_deadline_missed_status ()
 This operation obtains the OfferedDeadlineMissedStatus object of the DataWriter. More...
 
const dds::core::status::OfferedIncompatibleQosStatus offered_incompatible_qos_status ()
 This operation obtains the OfferedIncompatibleQosStatus object of the DataWriter. More...
 
const dds::core::status::PublicationMatchedStatus publication_matched_status ()
 This operation obtains the PublicationMatchedStatus object of the DataWriter. More...
 
void assert_liveliness ()
 This operation asserts the liveliness for the DataWriter. More...
 

Detailed Description

Typeless base class for the typed DataWriter.

DataWriters are created type specific (fi DataWriter<Foo::Bar> writer). However, there are many places in the API (and possibly application) where the type can not be known while still some DataWriter has to be passed around, stored or even typeless functionality called.
Main examples in the API that need typeless DataWriter are: Publisher, PublisherListener and DomainParticipantListener.

Member Function Documentation

◆ assert_liveliness()

void dds::pub::AnyDataWriter::assert_liveliness ( )

This operation asserts the liveliness for the DataWriter.

This operation will manually assert the liveliness for the DataWriter. This way, the Data Distribution Service is informed that the corresponding DataWriter is still alive. This operation is used in combination with the Liveliness QosPolicy set to Liveliness::ManualByParticipant or Liveliness::ManualByTopic.

Writing data via the write operation of a DataWriter will assert the liveliness on the DataWriter itself and its containing DomainParticipant. Therefore, assert_liveliness is only needed when not writing regularly.

The liveliness should be asserted by the application, depending on the LivelinessQosPolicy. Asserting the liveliness for this DataWriter can also be achieved by asserting the liveliness to the DomainParticipant.

Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.
dds::core::NotEnabledErrorThe entity has not yet been enabled.

◆ liveliness_lost_status()

const dds::core::status::LivelinessLostStatus dds::pub::AnyDataWriter::liveliness_lost_status ( )

This operation obtains the LivelinessLostStatus object of the DataWriter.

The LivelinessLostStatus contains the information whether the liveliness (that the DataWriter has committed through its Liveliness QosPolicy) was respected. This means that the status represents whether the DataWriter failed to actively signal its liveliness within the offered liveliness period. If the liveliness is lost, the DataReader objects will consider the DataWriter as no longer “alive”.

The LivelinessLostStatus can also be monitored using a DataWriterListener or by using the associated StatusCondition.

Returns
the LivelinessLostStatus
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.

◆ offered_deadline_missed_status()

const dds::core::status::OfferedDeadlineMissedStatus dds::pub::AnyDataWriter::offered_deadline_missed_status ( )

This operation obtains the OfferedDeadlineMissedStatus object of the DataWriter.

The OfferedDeadlineMissedStatus contains the information whether the deadline (that the DataWriter has committed through its Deadline QosPolicy) was respected for each instance.

The OfferedDeadlineMissedStatus can also be monitored using a DataWriterListener or by using the associated StatusCondition.

Returns
the OfferedDeadlineMissedStatus
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.

◆ offered_incompatible_qos_status()

const dds::core::status::OfferedIncompatibleQosStatus dds::pub::AnyDataWriter::offered_incompatible_qos_status ( )

This operation obtains the OfferedIncompatibleQosStatus object of the DataWriter.

The OfferedIncompatibleQosStatus contains the information whether a QosPolicy setting was incompatible with the requested QosPolicy setting.

This means that the status represents whether a DataReader object has been discovered by the DataWriter with the same Topic and a requested DataReaderQos that was incompatible with the one offered by the DataWriter.

The OfferedIncompatibleQosStatus can also be monitored using a DataWriterListener or by using the associated StatusCondition.

Returns
the OfferedIncompatibleQosStatus
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.

◆ operator<<()

AnyDataWriter& dds::pub::AnyDataWriter::operator<< ( const dds::pub::qos::DataWriterQos qos)

This operation replaces the existing set of QosPolicy settings for a DataWriter.

The parameter qos contains the object with the QosPolicy settings which is checked for self-consistency and mutability.

When the application tries to change a QosPolicy setting for an enabled DataWriter, which can only be set before the DataWriter is enabled, the operation will fail and a ImmutablePolicyError is thrown. In other words, the application must provide the presently set QosPolicy settings in case of the immutable QosPolicy settings. Only the mutable QosPolicy settings can be changed.

When the qos contains conflicting QosPolicy settings (not self-consistent), the operation will fail and an InconsistentPolicyError is thrown.

Parameters
qosthe qos
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.
dds::core::ImmutablePolicyErrorThe parameter qos contains an immutable QosPolicy setting with a different value than set during enabling of the DataWriter.
dds::core::InconsistentPolicyErrorThe parameter qos contains conflicting QosPolicy settings,

◆ operator>>()

const AnyDataWriter& dds::pub::AnyDataWriter::operator>> ( dds::pub::qos::DataWriterQos qos) const

Gets the DataWriterQos setting for this instance.

Returns
the qos
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.

◆ publication_matched_status()

const dds::core::status::PublicationMatchedStatus dds::pub::AnyDataWriter::publication_matched_status ( )

This operation obtains the PublicationMatchedStatus object of the DataWriter.

The PublicationMatchedStatus contains the information whether a new match has been discovered for the current publication, or whether an existing match has ceased to exist.

This means that the status represents that either a DataReader object has been discovered by the DataWriter with the same Topic and a compatible Qos, or that a previously discovered DataReader has ceased to be matched to the current DataWriter. A DataReader may cease to match when it gets deleted, when it changes its Qos to a value that is incompatible with the current DataWriter or when either the DataWriter or the DataReader has chosen to put its matching counterpart on its ignore-list using the dds::sub::ignore or dds::pub::ignore operations.

The PublicationMatchedStatus can also be monitored using a DataWriterListener or by using the associated StatusCondition.

Returns
the PublicationMatchedStatus
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.

◆ publisher()

const dds::pub::Publisher& dds::pub::AnyDataWriter::publisher ( ) const

Get the Publisher that owns this DataWriter.

Returns
the Publisher
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.

◆ qos() [1/2]

dds::pub::qos::DataWriterQos dds::pub::AnyDataWriter::qos ( ) const

Gets the DataWriterQos setting for this instance.

Returns
the qos
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.

◆ qos() [2/2]

void dds::pub::AnyDataWriter::qos ( const dds::pub::qos::DataWriterQos qos)

This operation replaces the existing set of QosPolicy settings for a DataWriter.

The parameter qos contains the object with the QosPolicy settings which is checked for self-consistency and mutability.

When the application tries to change a QosPolicy setting for an enabled DataWriter, which can only be set before the DataWriter is enabled, the operation will fail and a ImmutablePolicyError is thrown. In other words, the application must provide the presently set QosPolicy settings in case of the immutable QosPolicy settings. Only the mutable QosPolicy settings can be changed.

When the qos contains conflicting QosPolicy settings (not self-consistent), the operation will fail and an InconsistentPolicyError is thrown.

Parameters
qosthe qos
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.
dds::core::ImmutablePolicyErrorThe parameter qos contains an immutable QosPolicy setting with a different value than set during enabling of the DataWriter.
dds::core::InconsistentPolicyErrorThe parameter qos contains conflicting QosPolicy settings,

◆ topic_description()

const dds::topic::TopicDescription& dds::pub::AnyDataWriter::topic_description ( ) const

Get the TopicDescription associated with this DataWriter.

Returns
the TopicDescription
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.

◆ wait_for_acknowledgments()

void dds::pub::AnyDataWriter::wait_for_acknowledgments ( const dds::core::Duration timeout)

This operation blocks the calling thread until either all data written by the DataWriter is acknowledged by the local infrastructure, or until the duration specified by the timeout parameter elapses, whichever happens first.

Data is acknowledged by the local infrastructure when it does not need to be stored in its DataWriter’s local history. When a locally-connected subscription (including the networking service) has no more resources to store incoming samples it will start to reject these samples, resulting in their source DataWriters to store them temporarily in their own local history to be retransmitted at a later moment in time.
In such scenarios, the wait_for_acknowledgments operation will block until the DataWriter has retransmitted its entire history, which is therefore effectively empty, or until the timeout expires, whichever happens first. In the latter case, this operation will throw a TimeoutError.

Be aware that in case the operation returns normally, the data has only been acknowledged by the local infrastructure: it does not mean all remote subscriptions have already received the data. However, delivering the data to remote nodes is then the sole responsibility of the networking service: even when the publishing application would terminate, all data that has not yet been received may be considered ‘on-route’ and will therefore eventually arrive (unless the networking service itself will crash). In contrast, if a DataWriter would still have data in it’s local history buffer when it terminates, this data is considered ‘lost’.

This operation is intended to be used only if one or more of the contained DataWriters has its ReliabilityQosPolicyKind set to RELIABLE. Otherwise the operation will return immediately, since best-effort DataWriters will never store rejected samples in their local history: they will just drop them and continue business as usual.

Parameters
timeoutthe time out duration
Exceptions
dds::core::ErrorAn internal error has occurred.
dds::core::NullReferenceErrorThe entity was not properly created and references to dds::core::null.
dds::core::AlreadyClosedErrorThe entity has already been closed.
dds::core::TimeoutErrorNot all data is acknowledged before timeout elapsed.
dds::core::OutOfResourcesErrorThe Data Distribution Service ran out of resources to complete this operation.

© 2009-2020 Twin Oaks Computing, Inc
Castle Rock, CO 80104
All rights reserved.