RTC Toolkit  2.0.0
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
rtctk::componentFramework::Dds Class Reference

Common functionallty needed to create DDS entities like participant and topic that can be later used (extent) for DDS data publishing and subscribing . More...

#include <dds.hpp>

Inheritance diagram for rtctk::componentFramework::Dds:
rtctk::componentFramework::DdsPub rtctk::componentFramework::DdsSub

Public Member Functions

 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. More...
 
virtual ~Dds () noexcept
 
 Dds (Dds &&rhs)=delete
 
Ddsoperator= (Dds &&rhs)=delete
 
void SetQosProfile (std::string &qos_profile)
 Set FastDDS QoS profile after creation. More...
 
void SetInterfaceWhiteList (const std::vector< std::string > &iwl)
 Sets the interfaces that can be used for DDS sample traffic. More...
 
void CreateParticipant ()
 Creates DDS participant. More...
 
void DestroyParticipant ()
 Destroys DDS participant created in CreateParticipant. More...
 
Topic * CreateTopic (const std::string &topic_name)
 Creates DDS topic. More...
 
void DestroyTopic (Topic *topic, bool to_be_removed=true)
 Destroys DDS topic. More...
 
void CreateManyTopics (std::vector< std::string > &topic_names)
 Creates many DDS topics. More...
 
void DestroyAllTopics ()
 Destroys all DDS topics from internal map. More...
 
virtual void DumpDDSstatistics ()
 Dumps / logs varios DDS statistic like NACks, ACKs, ... More...
 
size_t GetNumberOfTopics () const noexcept
 
const std::string GetTopicName (size_t index) const noexcept
 

Static Public Attributes

static const std::string TELEM_DP_QOS_FILE = "telemDataPathDdsQos.xml"
 default file name for different DDS QoSs More...
 
static const std::string DEFAULT_QOS_PROFILE = "RtcTk_Default_Profile"
 default profile name for different DDS QoSs More...
 
static const DomainId_t DEFAULT_DOMAIN_ID = 0
 default Domain Id for different DDS More...
 

Protected Attributes

DomainParticipantFactory * m_factory
 
DomainParticipant * m_participant
 
std::string m_qos_profile
 
DomainId_t m_domain_id =0
 
std::vector< std::string > m_interfaceWhiteList
 
std::vector< Topic * > m_topics
 
log4cplus::Logger m_logger
 

Detailed Description

Common functionallty needed to create DDS entities like participant and topic that can be later used (extent) for DDS data publishing and subscribing .

Note
Please refer to FastDDS documentation for details of DDS
when this DDS class is used together with other MAL PS FastDDS things like Event channel service which is based in MAL PS FastDDS it is important that MAL things (Event Channel) is created/initialized before the DDS using this class.

Constructor & Destructor Documentation

◆ Dds() [1/2]

rtctk::componentFramework::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.

Parameters
qos_filename of QoS XML file. That needs to be located in subfolder: resource/config/rtctk/dds of $CFGPATH.
qos_profileFastDDS QoS profile (please refer to FastDDS documentation for details)
domain_idDDS domain Id (see FastDDS documentation for details)
Note
The class is intended to be used just RTC Toolkit internal.

◆ ~Dds()

rtctk::componentFramework::Dds::~Dds ( )
virtualnoexcept

◆ Dds() [2/2]

rtctk::componentFramework::Dds::Dds ( Dds &&  rhs)
delete

Member Function Documentation

◆ CreateManyTopics()

void rtctk::componentFramework::Dds::CreateManyTopics ( std::vector< std::string > &  topic_names)

Creates many DDS topics.

Internal it calls CreateTopic, and add created topic to internal map.

Parameters
topic_namesvector of names for topic to be created.

◆ CreateParticipant()

void rtctk::componentFramework::Dds::CreateParticipant ( )

Creates DDS participant.

It is enough to have one particpant, so this shall be called just once.

◆ CreateTopic()

Topic * rtctk::componentFramework::Dds::CreateTopic ( const std::string &  topic_name)

Creates DDS topic.

It has to be called after DDS publisher has been created. It checks if the topic with the provided name already exists, and if exists returns it.

Parameters
topic_namename of the DDS topic to be created.
Returns
created or already existing DDS topic

◆ DestroyAllTopics()

void rtctk::componentFramework::Dds::DestroyAllTopics ( )

Destroys all DDS topics from internal map.

Internal it calls DestroyTopic.

◆ DestroyParticipant()

void rtctk::componentFramework::Dds::DestroyParticipant ( )

Destroys DDS participant created in CreateParticipant.

As there should be just one participant this method should be called at most once.

◆ DestroyTopic()

void rtctk::componentFramework::Dds::DestroyTopic ( Topic *  topic,
bool  to_be_removed = true 
)

Destroys DDS topic.

Parameters
topicDDS topic to be destroyed
to_be_removedflag that indicates if the topic should be also removed from internal map. Default is to be removed.

◆ DumpDDSstatistics()

void rtctk::componentFramework::Dds::DumpDDSstatistics ( )
virtual

Dumps / logs varios DDS statistic like NACks, ACKs, ...

for each DDS writer

Reimplemented in rtctk::componentFramework::DdsSub, and rtctk::componentFramework::DdsPub.

◆ GetNumberOfTopics()

size_t rtctk::componentFramework::Dds::GetNumberOfTopics ( ) const
noexcept

◆ GetTopicName()

const std::string rtctk::componentFramework::Dds::GetTopicName ( size_t  index) const
noexcept

◆ operator=()

Dds& rtctk::componentFramework::Dds::operator= ( Dds &&  rhs)
delete

◆ SetInterfaceWhiteList()

void rtctk::componentFramework::Dds::SetInterfaceWhiteList ( const std::vector< std::string > &  iwl)

Sets the interfaces that can be used for DDS sample traffic.

This allows to specify the interfaces, e.g. IP numbers, on the local machine that are allowed to be used for DDS traffic, i.e. this is the interface white list for allowed interfaces.

Note
This method needs to be called before calling CreateParticipant, otherwise the white list will not be used.
Parameters
iwlList of interfaces that can be used.

◆ SetQosProfile()

void rtctk::componentFramework::Dds::SetQosProfile ( std::string &  qos_profile)
inline

Set FastDDS QoS profile after creation.

Parameters
qos_profileDDS QoS profile (please refer to FastDDS documentation for details)

Member Data Documentation

◆ DEFAULT_DOMAIN_ID

const DomainId_t rtctk::componentFramework::Dds::DEFAULT_DOMAIN_ID = 0
inlinestatic

default Domain Id for different DDS

◆ DEFAULT_QOS_PROFILE

const std::string rtctk::componentFramework::Dds::DEFAULT_QOS_PROFILE = "RtcTk_Default_Profile"
inlinestatic

default profile name for different DDS QoSs

◆ m_domain_id

DomainId_t rtctk::componentFramework::Dds::m_domain_id =0
protected

◆ m_factory

DomainParticipantFactory* rtctk::componentFramework::Dds::m_factory
protected

◆ m_interfaceWhiteList

std::vector<std::string> rtctk::componentFramework::Dds::m_interfaceWhiteList
protected

◆ m_logger

log4cplus::Logger rtctk::componentFramework::Dds::m_logger
protected

◆ m_participant

DomainParticipant* rtctk::componentFramework::Dds::m_participant
protected

◆ m_qos_profile

std::string rtctk::componentFramework::Dds::m_qos_profile
protected

◆ m_topics

std::vector<Topic *> rtctk::componentFramework::Dds::m_topics
protected

◆ TELEM_DP_QOS_FILE

const std::string rtctk::componentFramework::Dds::TELEM_DP_QOS_FILE = "telemDataPathDdsQos.xml"
inlinestatic

default file name for different DDS QoSs


The documentation for this class was generated from the following files: