Fast RTPS  Version 2.14.1
Fast RTPS
Loading...
Searching...
No Matches

Class PublisherListener, allows the end user to implement callbacks triggered by certain events. More...

#include <PublisherListener.h>

Public Member Functions

 PublisherListener ()
 
virtual ~PublisherListener ()
 
virtual void onPublicationMatched (Publisher *pub, rtps::MatchingInfo &info)
 This method is called when the Publisher is matched (or unmatched) against an endpoint.
 
virtual void on_offered_deadline_missed (Publisher *pub, const OfferedDeadlineMissedStatus &status)
 A method called when a deadline is missed.
 
virtual void on_liveliness_lost (Publisher *pub, const LivelinessLostStatus &status)
 Method called when the liveliness of a publisher is lost.
 

Detailed Description

Class PublisherListener, allows the end user to implement callbacks triggered by certain events.

using namespace eprosima::pubsub;
using namespace eprosima::rtps;
//Create a class that inherits from PublisherListener and implement the methods you need.
class TestTypeListener : public PublisherListener
{
public:
RTPSParticipant* p;
RTPSParticipantAttributes Pparam;
eprosima::dds::Publisher* pub;
TestTypeListener()
{
//The RTPSParticipant should have been created and accessible to this method.
p = DomainRTPSParticipant::createRTPSParticipant(Pparam);
//PublisherAttributes must be set to the user preferences.
pub = DomainRTPSParticipant::createPublisher(p, Pubparam, (PublisherListener*)this);
}
~TestTypeListener()
{
}
void onHistoryFull()
{
pub->removeMinSeqCache();
}
void onPublicationMatched(
Publisher* pub,
MatchingInfo& info)
{
if (info.status == MATCHED_MATCHING)
{
cout << "Discovery!" << endl;
}
else if (info.status == REMOVED_MATCHING)
{
cout << "Subscription removed" << endl;
}
}
};
Class PublisherAttributes, used by the user to define the attributes of a Publisher.
Definition PublisherAttributes.h:41
Class PublisherListener, allows the end user to implement callbacks triggered by certain events.
Definition PublisherListener.h:37

Constructor & Destructor Documentation

◆ PublisherListener()

PublisherListener ( )
inline

◆ ~PublisherListener()

virtual ~PublisherListener ( )
inlinevirtual

Member Function Documentation

◆ on_liveliness_lost()

virtual void on_liveliness_lost ( Publisher pub,
const LivelinessLostStatus &  status 
)
inlinevirtual

Method called when the liveliness of a publisher is lost.

Parameters
pubThe publisher
statusThe liveliness lost status

◆ on_offered_deadline_missed()

virtual void on_offered_deadline_missed ( Publisher pub,
const OfferedDeadlineMissedStatus status 
)
inlinevirtual

A method called when a deadline is missed.

Parameters
pubPointer to the associated Publisher
statusThe deadline missed status

◆ onPublicationMatched()

virtual void onPublicationMatched ( Publisher pub,
rtps::MatchingInfo &  info 
)
inlinevirtual

This method is called when the Publisher is matched (or unmatched) against an endpoint.

Parameters
pubPointer to the associated Publisher
infoInformation regarding the matched subscriber

The documentation for this class was generated from the following file: