1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #ifndef _TOPICSAMPLE_TOPICS_PUBLISHER_H_
- #define _TOPICSAMPLE_TOPICS_PUBLISHER_H_
- #include <fastrtps/fastrtps_fwd.h>
- #include <fastrtps/publisher/PublisherListener.h>
- #include "TopicsPubSubTypes.h"
- class TopicsPublisher
- {
- public:
- TopicsPublisher();
- virtual ~TopicsPublisher();
- bool init(const char * strtopic,const unsigned short nListenPort = 5100,const int ntype = 0);
- void run();
- void senddata(const char *str, int nsize);
- private:
- eprosima::fastrtps::Participant *mp_participant;
- eprosima::fastrtps::Publisher *mp_publisher;
- char mstrtopic[256];
- class PubListener : public eprosima::fastrtps::PublisherListener
- {
- public:
- PubListener() : n_matched(0){};
- ~PubListener(){};
- void onPublicationMatched(eprosima::fastrtps::Publisher* pub,eprosima::fastrtps::rtps::MatchingInfo& info);
- int n_matched;
- } m_listener;
- TopicSample::MessagePubSubType myType;
- };
- #endif
|