12345678910111213141516171819202122232425262728293031323334353637 |
- #ifndef PUBLISHER_H_
- #define PUBLISHER_H_
- #include "idl/TopicsTypeSupportImpl.h"
- #include <dds/DCPS/Service_Participant.h>
- #include <string>
- class Publisher {
- public:
- Publisher(int argc, char* argv[],const char * strtopic);
- ~Publisher();
- void sendMessage(const std::string& message, const char * strdata, int nlen );
- private:
- void createParticipant(int argc, char* argv[]);
- void createPublisher();
- void registerTopic();
- void createDataWriter();
- private:
- DDS::DomainParticipantFactory_var m_participantFactory;
- DDS::DomainParticipant_var m_participant;
- DDS::Publisher_var m_publisher;
- TopicSample::MessageTypeSupport_var m_topicSupport;
- DDS::Topic_var m_messageTopic;
- TopicSample::MessageDataWriter_var m_dataWriter;
- DDS::InstanceHandle_t m_topicHandler;
- int m_counter = 1;
- char mstrtopic[255];
- };
- #endif // !PUBLISHER_H_
|