RTC Toolkit  1.0.0
dds.hpp
Go to the documentation of this file.
1 
11 #ifndef RTCTK_COMPONENTFRAMEWORK_DATAPATH_DDS_HPP_
12 #define RTCTK_COMPONENTFRAMEWORK_DATAPATH_DDS_HPP_
13 
14 #include <string>
15 #include <vector>
16 
18 namespace rtctk::componentFramework {
19 
26 class Dds {
27 protected:
28  DomainParticipantFactory *m_factory;
29  DomainParticipant *m_participant;
30 
31  std::string m_qos_library;
32  std::string m_qos_profile;
33 
34  std::vector<std::string> m_interfaceWhiteList;
35 
36  // list of DDS topics
37  std::vector<Topic *> m_topics;
38 
39  int PrintDDSParticipantQoSProperty(DomainParticipantQos &participant_qos,
40  const char *prop,
41  const char *sf = "");
42  int SetDDSParticipantQoSProperty(DomainParticipantQos &participant_qos,
43  const char *prop,
44  const char *value,
45  const char *sf = "");
46 
47 public:
52  Dds(std::string qos_library = "RtcTk_Default_Library",
53  std::string qos_profile = "RtcTk_Default_Profile");
54  virtual ~Dds() noexcept;
55 
56  Dds(Dds &&rhs) = delete;
57  Dds &operator=(Dds &&rhs) = delete;
58 
63  void SetQosLibrary(std::string &qos_library) {
64  m_qos_library = qos_library;
65  }
66 
71  void SetQosProfile(std::string &qos_profile) {
72  m_qos_profile = qos_profile;
73  }
74 
80  void SetInterfaceWhiteList(const std::vector<std::string> &iwl);
81 
86  void CreateParticipant();
87 
88 
93  void DestroyParticipant();
94 
102  Topic *CreateTopic(const std::string &topic_name);
103 
110  void DestroyTopic(Topic *topic, bool to_be_removed = true);
111 
117  void CreateManyTopics(std::vector<std::string> &topic_names);
118 
123  void DestroyAllTopics();
124 
128  virtual void DumpDDSstatistics();
129 
130  size_t GetNumberOfTopics() const noexcept;
131 
132  const std::string GetTopicName(size_t index) const noexcept;
133 };
134 
135 } // namespace rtctk::componentFramework
136 
137 #endif //#ifndef RTCTK_COMPONENTFRAMEWORK_dataPATH_DDS_HPP_
rtctk::componentFramework::Dds::Dds
Dds(std::string qos_library="RtcTk_Default_Library", std::string qos_profile="RtcTk_Default_Profile")
Definition: dds.cpp:22
rtctk::componentFramework::Dds::GetNumberOfTopics
size_t GetNumberOfTopics() const noexcept
Definition: dds.cpp:356
rtctk::componentFramework::Dds::DestroyTopic
void DestroyTopic(Topic *topic, bool to_be_removed=true)
Destroys DDS topic.
Definition: dds.cpp:308
rtctk::componentFramework::Dds::SetQosProfile
void SetQosProfile(std::string &qos_profile)
Set RTI DDS QoS profile after creation.
Definition: dds.hpp:71
rtctk::componentFramework::Dds::CreateParticipant
void CreateParticipant()
Creates DDS participant.
Definition: dds.cpp:139
rtctk::componentFramework::Dds::m_qos_profile
std::string m_qos_profile
Definition: dds.hpp:32
rtctk::componentFramework
Definition: commandReplier.cpp:20
rtctk::componentFramework::Dds::DestroyAllTopics
void DestroyAllTopics()
Destroys all DDS topics from internal map.
Definition: dds.cpp:337
rtctk::componentFramework::Dds::m_qos_library
std::string m_qos_library
Definition: dds.hpp:31
rtctk::componentFramework::Dds::SetInterfaceWhiteList
void SetInterfaceWhiteList(const std::vector< std::string > &iwl)
Sets the interfaces that can be used for DDS sample traffic i.e.
Definition: dds.cpp:125
rtctk::componentFramework::Dds::SetDDSParticipantQoSProperty
int SetDDSParticipantQoSProperty(DomainParticipantQos &participant_qos, const char *prop, const char *value, const char *sf="")
rtctk::componentFramework::Dds::m_interfaceWhiteList
std::vector< std::string > m_interfaceWhiteList
Definition: dds.hpp:34
rtctk::componentFramework::Dds::SetQosLibrary
void SetQosLibrary(std::string &qos_library)
Set RTI DDS QoS library after creation.
Definition: dds.hpp:63
rtctk::componentFramework::Dds::GetTopicName
const std::string GetTopicName(size_t index) const noexcept
Definition: dds.cpp:361
rtctk::componentFramework::Dds::DestroyParticipant
void DestroyParticipant()
Destroys DDS participant created in CreateParticipant.
Definition: dds.cpp:213
ddsCommon.hpp
Declares common DDS types.
rtctk::componentFramework::Dds::CreateTopic
Topic * CreateTopic(const std::string &topic_name)
Creates DDS topic.
Definition: dds.cpp:233
rtctk::componentFramework::Dds::CreateManyTopics
void CreateManyTopics(std::vector< std::string > &topic_names)
Creates many DDS topics.
Definition: dds.cpp:325
std
Definition: mudpiProcessingError.hpp:119
rtctk::componentFramework::Dds::m_participant
DomainParticipant * m_participant
Definition: dds.hpp:29
rtctk::componentFramework::Dds::m_factory
DomainParticipantFactory * m_factory
Definition: dds.hpp:28
rtctk::componentFramework::Dds
Common functionallty needed to create DDS entities like participant and topic that can be later used ...
Definition: dds.hpp:26
rtctk::componentFramework::Dds::~Dds
virtual ~Dds() noexcept
Definition: dds.cpp:89
rtctk::componentFramework::Dds::DumpDDSstatistics
virtual void DumpDDSstatistics()
Dumps / logs varios DDS statistic like NACks, ACKs, ...
Definition: dds.cpp:370
rtctk::componentFramework::Dds::PrintDDSParticipantQoSProperty
int PrintDDSParticipantQoSProperty(DomainParticipantQos &participant_qos, const char *prop, const char *sf="")
rtctk::componentFramework::Dds::m_topics
std::vector< Topic * > m_topics
Definition: dds.hpp:37