Cyclone ISO C++ API Reference Guide
dds::pub::DataWriterListener< T > Class Template Referenceabstract

DataWriter events Listener. More...

#include "DataWriterListener.hpp"

Inherited by dds::pub::NoOpDataWriterListener< T > [virtual].

Public Member Functions

virtual void on_liveliness_lost (dds::pub::DataWriter< T > &writer, const dds::core::status::LivelinessLostStatus &status)=0
 
virtual void on_offered_deadline_missed (dds::pub::DataWriter< T > &writer, const dds::core::status::OfferedDeadlineMissedStatus &status)=0
 
virtual void on_offered_incompatible_qos (dds::pub::DataWriter< T > &writer, const dds::core::status::OfferedIncompatibleQosStatus &status)=0
 
virtual void on_publication_matched (dds::pub::DataWriter< T > &writer, const dds::core::status::PublicationMatchedStatus &status)=0
 

Detailed Description

template<typename T>
class dds::pub::DataWriterListener< T >

DataWriter events Listener.

*Since a DataWriter is an Entity, it has the ability to have a Listener associated with it. In this case, the associated Listener should be of type DataWriterListener. This interface must be implemented by the application. A user-defined class must be provided by the application which must extend from the DataWriterListener class.

All operations for this interface must be implemented in the user-defined class, it is up to the application whether an operation is empty or contains some functionality.

The DataWriterListener provides a generic mechanism (actually a callback function) for the Data Distribution Service to notify the application of relevant asynchronous status change events, such as a missed deadline, violation of a QosPolicy setting, etc. The DataWriterListener is related to changes in communication status StatusConditions.

// Application example listener
class ExampleListener :
public virtual dds::pub::DataWriterListener<Foo::Bar>
{
public:
{
std::cout << "on_offered_deadline_missed" << std::endl;
}
{
std::cout << "on_offered_incompatible_qos" << std::endl;
}
virtual void on_liveliness_lost (
{
std::cout << "on_liveliness_lost" << std::endl;
}
virtual void on_publication_matched (
{
std::cout << "on_publication_matched" << std::endl;
}
};
// Create DataWriter with the listener
dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id());
dds::topic::Topic<Foo::Bar> topic(participant, "TopicName");
dds::pub::Publisher publisher(participant);
topic,
publisher.default_datawriter_qos(),
new ExampleListener(),
See also
Data Writer
Listener information

Definition at line 102 of file DataWriterListener.hpp.

Member Function Documentation

◆ on_liveliness_lost()

template<typename T>
virtual void dds::pub::DataWriterListener< T >::on_liveliness_lost ( dds::pub::DataWriter< T > &  writer,
const dds::core::status::LivelinessLostStatus status 
)
pure virtual

This operation is called by the Data Distribution Service when the LivelinessLostStatus changes.

This operation will only be called when the relevant DataWriterListener is installed and enabled for the liveliness lost status (StatusMask::liveliness_lost()). The liveliness lost status will change when the liveliness that the DataWriter has committed through its LivelinessQosPolicy was not respected. In other words, the DataWriter failed to actively signal its liveliness within the offered liveliness period. As a result, the DataReader objects will consider the DataWriter as no longer “alive”.

Parameters
writercontains a pointer to the DataWriter on which the LivelinessLostStatus has changed (this is an input to the application).
statuscontains the LivelinessLostStatus object (this is an input to the application).

◆ on_offered_deadline_missed()

template<typename T>
virtual void dds::pub::DataWriterListener< T >::on_offered_deadline_missed ( dds::pub::DataWriter< T > &  writer,
const dds::core::status::OfferedDeadlineMissedStatus status 
)
pure virtual

This operation is called by the Data Distribution Service when the OfferedDeadlineMissedStatus changes.

This operation will only be called when the relevant DataWriterListener is installed and enabled for the offered deadline missed status (StatusMask::offered_deadline_missed()). The offered deadline missed status will change when the deadline that the DataWriter has committed through its DeadlineQosPolicy was not respected for a specific instance.

Parameters
writercontain a pointer to the DataWriter on which the OfferedDeadlineMissedStatus has changed (this is an input to the application)
statuscontain the OfferedDeadlineMissedStatus object (this is an input to the application).

◆ on_offered_incompatible_qos()

template<typename T>
virtual void dds::pub::DataWriterListener< T >::on_offered_incompatible_qos ( dds::pub::DataWriter< T > &  writer,
const dds::core::status::OfferedIncompatibleQosStatus status 
)
pure virtual

This operation called by the Data Distribution Service when the OfferedIncompatibleQosStatus changes.

This operation will only be called when the relevant DataWriterListener is installed and enabled for the StatusMask::offered_incompatible_qos(). The incompatible Qos status will change when 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.

Parameters
writercontain a pointer to the DataWriter on which the OfferedIncompatibleQosStatus has changed (this is an input to the application).
statuscontain the OfferedIncompatibleQosStatus object (this is an input to the application).

◆ on_publication_matched()

template<typename T>
virtual void dds::pub::DataWriterListener< T >::on_publication_matched ( dds::pub::DataWriter< T > &  writer,
const dds::core::status::PublicationMatchedStatus status 
)
pure virtual

This operation is called by the Data Distribution Service when a new match has been discovered for the current publication, or when an existing match has ceased to exist.

Usually this means that a new DataReader that matches the Topic and that has compatible Qos as the current DataWriter has either been discovered, 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.

it will only be called when the relevant DataWriterListener is installed and enabled for the StatusMask::publication_matched().

Parameters
writercontains a pointer to the DataWriter for which a match has been discovered (this is an input to the application provided by the Data Distribution Service).
statuscontains the PublicationMatchedStatus object (this is an input to the application provided by the Data Distribution Service).

The documentation for this class was generated from the following file:
dds::core::status::OfferedDeadlineMissedStatus
Definition: Status.hpp:195
dds::pub::DataWriterListener::on_liveliness_lost
virtual void on_liveliness_lost(dds::pub::DataWriter< T > &writer, const dds::core::status::LivelinessLostStatus &status)=0
dds::pub::DataWriterListener
DataWriter events Listener.
Definition: DataWriterListener.hpp:102
dds::core::status::LivelinessLostStatus
Definition: Status.hpp:119
dds::pub::DataWriterListener::on_publication_matched
virtual void on_publication_matched(dds::pub::DataWriter< T > &writer, const dds::core::status::PublicationMatchedStatus &status)=0
dds::pub::Publisher
The Publisher acts on the behalf of one or several DataWriter objects that belong to it.
Definition: Publisher.hpp:55
dds::pub::DataWriter
DataWriter allows the application to set the value of the sample to be published under a given Topic.
Definition: DataWriter.hpp:89
dds::pub::DataWriterListener::on_offered_deadline_missed
virtual void on_offered_deadline_missed(dds::pub::DataWriter< T > &writer, const dds::core::status::OfferedDeadlineMissedStatus &status)=0
dds::core::status::StatusMask::all
static StatusMask all()
Definition: State.hpp:195
dds::core::status::OfferedIncompatibleQosStatus
Definition: Status.hpp:258
dds::pub::DataWriterListener::on_offered_incompatible_qos
virtual void on_offered_incompatible_qos(dds::pub::DataWriter< T > &writer, const dds::core::status::OfferedIncompatibleQosStatus &status)=0
dds::core::status::PublicationMatchedStatus
Definition: Status.hpp:356
dds::topic::Topic
Topic is the most basic description of the data to be published and subscribed.
Definition: Topic.hpp:36
dds::domain::DomainParticipant
A DomainParticipant represents the local membership of the application in a Domain.
Definition: DomainParticipant.hpp:65