Fast RTPS  Version 2.4.1
Fast RTPS

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. More...
 
virtual void on_offered_deadline_missed (Publisher *pub, const OfferedDeadlineMissedStatus &status)
 A method called when a deadline is missed. More...
 
virtual void on_liveliness_lost (Publisher *pub, const LivelinessLostStatus &status)
 Method called when the liveliness of a publisher is lost. More...
 

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;
PublisherAttributes Pubparam;
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();
}
Publisher* pub,
MatchingInfo& info)
{
if (info.status == MATCHED_MATCHING)
{
cout << "Discovery!" << endl;
}
else if (info.status == REMOVED_MATCHING)
{
cout << "Subscription removed" << endl;
}
}
};
virtual void onPublicationMatched(Publisher *pub, rtps::MatchingInfo &info)
This method is called when the Publisher is matched (or unmatched) against an endpoint.
Definition: PublisherListener.h:53
PublisherListener()
Definition: PublisherListener.h:40

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: