RTC Toolkit  2.0.0
dds.hpp
Go to the documentation of this file.
1 
12 #ifndef RTCTK_COMPONENTFRAMEWORK_DATAPATH_DDS_HPP_
13 #define RTCTK_COMPONENTFRAMEWORK_DATAPATH_DDS_HPP_
14 
15 #include <string>
16 #include <vector>
17 
19 #include <log4cplus/logger.h>
20 
21 namespace rtctk::componentFramework {
22 
31 class Dds {
32 protected:
33  DomainParticipantFactory *m_factory;
34  DomainParticipant *m_participant;
35 
36  std::string m_qos_profile;
37 
38  DomainId_t m_domain_id=0;
39 
40  std::vector<std::string> m_interfaceWhiteList;
41 
42  // list of DDS topics
43  std::vector<Topic *> m_topics;
44  log4cplus::Logger m_logger;
45 
46 public:
55  Dds(std::string qos_file,
56  std::string qos_profile = DEFAULT_QOS_PROFILE,
57  DomainId_t domain_id = DEFAULT_DOMAIN_ID);
58  virtual ~Dds() noexcept;
59 
60  Dds(Dds &&rhs) = delete;
61  Dds &operator=(Dds &&rhs) = delete;
62 
63 
68  void SetQosProfile(std::string &qos_profile) {
69  m_qos_profile = qos_profile;
70  }
71 
82  void SetInterfaceWhiteList(const std::vector<std::string> &iwl);
83 
88  void CreateParticipant();
89 
90 
95  void DestroyParticipant();
96 
104  Topic *CreateTopic(const std::string &topic_name);
105 
112  void DestroyTopic(Topic *topic, bool to_be_removed = true);
113 
119  void CreateManyTopics(std::vector<std::string> &topic_names);
120 
125  void DestroyAllTopics();
126 
130  virtual void DumpDDSstatistics();
131 
132  size_t GetNumberOfTopics() const noexcept;
133 
134  const std::string GetTopicName(size_t index) const noexcept;
135 
136 
141  inline static const std::string TELEM_DP_QOS_FILE = "telemDataPathDdsQos.xml";
142 
147  inline static const std::string DEFAULT_QOS_PROFILE = "RtcTk_Default_Profile";
148 
153  inline static const DomainId_t DEFAULT_DOMAIN_ID = 0;
154 };
155 
156 } // namespace rtctk::componentFramework
157 
158 #endif //#ifndef RTCTK_COMPONENTFRAMEWORK_dataPATH_DDS_HPP_
rtctk::componentFramework::Dds::GetNumberOfTopics
size_t GetNumberOfTopics() const noexcept
Definition: dds.cpp:332
rtctk::componentFramework::Dds::DEFAULT_QOS_PROFILE
static const std::string DEFAULT_QOS_PROFILE
default profile name for different DDS QoSs
Definition: dds.hpp:147
rtctk::componentFramework::Dds::DestroyTopic
void DestroyTopic(Topic *topic, bool to_be_removed=true)
Destroys DDS topic.
Definition: dds.cpp:288
rtctk::componentFramework::Dds::SetQosProfile
void SetQosProfile(std::string &qos_profile)
Set FastDDS QoS profile after creation.
Definition: dds.hpp:68
rtctk::componentFramework::Dds::CreateParticipant
void CreateParticipant()
Creates DDS participant.
Definition: dds.cpp:119
rtctk::componentFramework::Dds::m_qos_profile
std::string m_qos_profile
Definition: dds.hpp:36
rtctk::componentFramework::Dds::m_logger
log4cplus::Logger m_logger
Definition: dds.hpp:44
rtctk::componentFramework
Definition: commandReplier.cpp:20
rtctk::componentFramework::Dds::Dds
Dds(std::string qos_file, std::string qos_profile=DEFAULT_QOS_PROFILE, DomainId_t domain_id=DEFAULT_DOMAIN_ID)
Constructor for Base class for both DDS Publisher and DDS Subscriber.
Definition: dds.cpp:25
rtctk::componentFramework::Dds::DestroyAllTopics
void DestroyAllTopics()
Destroys all DDS topics from internal map.
Definition: dds.cpp:317
rtctk::componentFramework::Dds::SetInterfaceWhiteList
void SetInterfaceWhiteList(const std::vector< std::string > &iwl)
Sets the interfaces that can be used for DDS sample traffic.
Definition: dds.cpp:107
rtctk::componentFramework::Dds::m_interfaceWhiteList
std::vector< std::string > m_interfaceWhiteList
Definition: dds.hpp:40
rtctk::componentFramework::Dds::m_domain_id
DomainId_t m_domain_id
Definition: dds.hpp:38
rtctk::componentFramework::Dds::GetTopicName
const std::string GetTopicName(size_t index) const noexcept
Definition: dds.cpp:337
rtctk::componentFramework::Dds::DestroyParticipant
void DestroyParticipant()
Destroys DDS participant created in CreateParticipant.
Definition: dds.cpp:215
rtctk::componentFramework::Dds::DEFAULT_DOMAIN_ID
static const DomainId_t DEFAULT_DOMAIN_ID
default Domain Id for different DDS
Definition: dds.hpp:153
rtctk_config_tool.delete
def delete(repo, path, recursive)
Definition: rtctk_config_tool.py:216
ddsCommon.hpp
Declares some common DDS functionality.
rtctk::componentFramework::Dds::CreateTopic
Topic * CreateTopic(const std::string &topic_name)
Creates DDS topic.
Definition: dds.cpp:235
rtctk::componentFramework::Dds::CreateManyTopics
void CreateManyTopics(std::vector< std::string > &topic_names)
Creates many DDS topics.
Definition: dds.cpp:305
std
Definition: mudpiProcessingError.hpp:119
rtctk::componentFramework::Dds::m_participant
DomainParticipant * m_participant
Definition: dds.hpp:34
rtctk::componentFramework::Dds::m_factory
DomainParticipantFactory * m_factory
Definition: dds.hpp:33
rtctk::componentFramework::Dds::TELEM_DP_QOS_FILE
static const std::string TELEM_DP_QOS_FILE
default file name for different DDS QoSs
Definition: dds.hpp:141
rtctk::componentFramework::Dds
Common functionallty needed to create DDS entities like participant and topic that can be later used ...
Definition: dds.hpp:31
rtctk::componentFramework::Dds::~Dds
virtual ~Dds() noexcept
Definition: dds.cpp:97
rtctk::componentFramework::Dds::DumpDDSstatistics
virtual void DumpDDSstatistics()
Dumps / logs varios DDS statistic like NACks, ACKs, ...
Definition: dds.cpp:346
rtctk::componentFramework::Dds::m_topics
std::vector< Topic * > m_topics
Definition: dds.hpp:43