Fast RTPS  Version 1.6.0
Fast RTPS
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PublisherListener Class Reference

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...
 

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();
}
void onPublicationMatched(Publisher* pub,MatchingInfo& info)
{
if(info.status == MATCHED_MATCHING)
{
cout << "Discovery!"<<endl;
}
else if(info.status == REMOVED_MATCHING)
{
cout << "Subscription removed"<<endl;
}
}
};

Constructor & Destructor Documentation

PublisherListener ( )
inline
virtual ~PublisherListener ( )
inlinevirtual

Member Function Documentation

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: