RTC Toolkit  0.1.0-alpha
ddsPub.hpp
Go to the documentation of this file.
1 
8 #ifndef RTCTK_REUSABLECOMPONENT_TELREPUB_DDSPUB_HPP_
9 #define RTCTK_REUSABLECOMPONENT_TELREPUB_DDSPUB_HPP_
10 
11 #pragma GCC diagnostic push
12 #pragma GCC diagnostic ignored "-Wregister"
13 
14 #include "agnostictopicifSupport.h"
15 #include "agnostictopicif.h"
16 #include <ndds/ndds_cpp.h>
17 #include <ndds/ndds_namespace_cpp.h>
18 
19 #pragma GCC diagnostic pop
20 
21 #include <string>
22 #include <iostream>
23 #include <list>
24 #include <vector>
25 
26 using namespace std;
27 
28 namespace rtctk::telRepub {
29 
35 class DdsPub
36 {
37  DDSDomainParticipantFactory *m_factory;
38  DDS::DomainParticipant* m_participant;
39  DDS::Publisher *m_publisher;
40 
41  string m_qosLibrary;
42  string m_qosProfile;
43 
44  // list of DDS topics
45  std::list<DDS::Topic*> m_topics;
46  std::list<rtctk::AgnosticTopic::DataWriter*> m_dataWriters;
47 
48  int printDDSParticipantQoSProperty(DDS::DomainParticipantQos &participant_qos, const char *prop, const char *sf = "");
49  int setDDSParticipantQoSProperty(DDS::DomainParticipantQos &participant_qos, const char *prop, const char *value, const char *sf = "");
50 
51 public:
56  DdsPub(string qos_library="RtcTk_Default_Library", string qos_profile="RtcTk_Default_Profile");
57  ~DdsPub(){};
58 
63  void SetQosLibrary(string &qos_library){ m_qosLibrary=qos_library; }
64 
69  void SetQosProfile(string &qos_profile){ m_qosProfile=qos_profile; }
70 
74  void createParticipant();
79  void createPublisher();
80 
88  DDS::Topic* createTopic(const std::string& topicName);
89 
95  void destroyDDSTopic(DDS::Topic *topic, bool toBeRemoved=true);
96 
102  rtctk::AgnosticTopic::DataWriter* createDataWriter(DDS::Topic *topic);
103 
109  void destroyDDSWriter (rtctk::AgnosticTopic::DataWriter* dw,bool toBeRemoved=true);
110 
116  void createManyTopics(std::vector<string> &topicNames);
117 
122  void destroyAllTopics();
123 
128  void createDataWriters();
129 
134  void destroyAllDataWriters();
135 
140  void createManyDataWriters(std::vector<string> &topicNames);
141 
145  void dumpDDSstatistics();
146 
150  std::list<rtctk::AgnosticTopic::DataWriter*> &getDataWriters(){ return m_dataWriters; }
151 
152 };
153 
154 } // closing namespace
155 
156 #endif //RTCTK_REUSABLECOMPONENT_TELREPUB_DDSPUB_HPP_
rtctk::telRepub::DdsPub::SetQosProfile
void SetQosProfile(string &qos_profile)
Definition: ddsPub.hpp:69
rtctk::telRepub
Definition: ddsPub.cpp:12
rtctk::telRepub::DdsPub
Definition: ddsPub.hpp:36
rtctk::telRepub::DdsPub::getDataWriters
std::list< rtctk::AgnosticTopic::DataWriter * > & getDataWriters()
Definition: ddsPub.hpp:150
setDDSParticipantQoSProperty
int setDDSParticipantQoSProperty(DDS::DomainParticipantQos &participant_qos, const char *prop, const char *value, const char *sf="")
Definition: main.cpp:42
rtctk::telRepub::DdsPub::~DdsPub
~DdsPub()
Definition: ddsPub.hpp:57
std
Definition: mudpiProcessingError.hpp:109
rtctk::telRepub::DdsPub::SetQosLibrary
void SetQosLibrary(string &qos_library)
Definition: ddsPub.hpp:63
printDDSParticipantQoSProperty
int printDDSParticipantQoSProperty(DDS::DomainParticipantQos &participant_qos, const char *prop, const char *sf="")
Definition: main.cpp:26