RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
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 <rtctk/componentFramework/dds.hpp>

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

Public Member Functions

 Dds (const std::string &qos_file, const std::string &qos_profile=DEFAULT_QOS_PROFILE, DomainId_t domain_id=DEFAULT_DOMAIN_ID, const std::string &participant_name="")
 Constructor for Base class for both DDS Publisher and DDS Subscriber.
 
virtual ~Dds () noexcept
 
 Dds (Dds &&rhs)=delete
 
Ddsoperator= (Dds &&rhs)=delete
 
void SetQosProfile (const std::string &qos_profile)
 Set FastDDS QoS profile after creation.
 
void SetInterfaceWhiteList (const std::vector< std::string > &iwl)
 Sets the interfaces that can be used for DDS sample traffic.
 
void SetParticipantName (const std::string &name)
 Sets the name of the DDS Participant.
 
void CreateParticipant ()
 Creates DDS participant.
 
void DestroyParticipant ()
 Destroys DDS participant created in CreateParticipant.
 
Topic * CreateTopic (const std::string &topic_name)
 Creates DDS topic.
 
void DestroyTopic (Topic *topic, bool to_be_removed=true)
 Destroys DDS topic.
 
void CreateManyTopics (std::vector< std::string > &topic_names)
 Creates many DDS topics.
 
void DestroyAllTopics ()
 Destroys all DDS topics from internal map.
 
void DumpDDSstatistics ()
 Dumps / logs varios DDS statistic like NACks, ACKs, ... for each DDS writer.
 
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
 
static const std::string DEFAULT_QOS_PROFILE = "RtcTk_Default_Profile"
 default profile name for different DDS QoSs
 
static const DomainId_t DEFAULT_DOMAIN_ID = 0
 default Domain Id for different DDS
 

Protected Attributes

DomainParticipantFactorym_factory
 
DomainParticipantm_participant
 
std::string m_qos_profile
 
DomainId_t m_domain_id = 0
 
std::vector< std::string > m_interface_white_list
 
std::string m_participant_name
 
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 ( const std::string & qos_file,
const std::string & qos_profile = DEFAULT_QOS_PROFILE,
DomainId_t domain_id = DEFAULT_DOMAIN_ID,
const std::string & participant_name = "" )
explicit

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)
participant_namename of participant
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 ( )

Dumps / logs varios DDS statistic like NACks, ACKs, ... for each DDS writer.

◆ 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.

◆ SetParticipantName()

void rtctk::componentFramework::Dds::SetParticipantName ( const std::string & name)
inline

Sets the name of the DDS Participant.

Note
This method needs to be called before calling CreateParticipant, otherwise the white list will not be used.
Parameters
nameparticipant name

◆ SetQosProfile()

void rtctk::componentFramework::Dds::SetQosProfile ( const 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_interface_white_list

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

◆ m_logger

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

◆ m_participant

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

◆ m_participant_name

std::string rtctk::componentFramework::Dds::m_participant_name
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: