RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rtctk::componentFramework::DdsPub Class Reference

All functionallty needed to create DDS entities for DDS data publishing is concentrated in this class. More...

#include <rtctk/componentFramework/ddsPub.hpp>

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

Public Member Functions

 DdsPub (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="")
 DDS Publsiher class that takes care for handling all DDS entities to publish samples.
 
 ~DdsPub () override
 
void CreatePublisher ()
 Creates DDS publisher.
 
void DestroyPublisher ()
 Destroys DDS publisher.
 
DataWriterCreateDataWriter (Topic *topic, DataWriterListener *listener=nullptr)
 Creates DDS writer for particular topic for topic of type: rtctk::AgnosticTopic.
 
void DestroyDataWriter (DataWriter *dw, bool to_be_removed=true, std::chrono::milliseconds wait_acks_timeout=5000ms)
 Destroys DDS data writer, and also its listener.
 
void CreateDataWriters ()
 Creates DDS Data Writer for all DDS topics.
 
void DestroyAllDataWriters (std::chrono::milliseconds wait_acks_timeout=5000ms)
 Destroys DDS Data Writer for all DDS topics.
 
void CreateManyDataWriters (const std::vector< DdsWriterParams > &)
 create DDS topics and DDS writers for the given list (vector) of topic names and rtctk::componentFramework::DdsWriterListener Internally it calls for each topic name CreateTopic, and on the created topic CreateDataWriter.
 
void CreateManyDataWriters (const std::vector< std::string > &topic_names)
 create DDS topics and DDS writers for the given list of topic names Internally it calls for each topic name CreateTopic, and on the created topic CreateDataWriter.
 
void DumpDDSstatistics ()
 Dumps / logs varios DDS statistic like NACks, ACKs, ... for each DDS writer.
 
std::vector< DataWriter * > & GetDataWriters ()
 returns vector of all DDS Data writers
 
void WaitForAcks (DataWriter *dw, std::chrono::milliseconds wait_acks_timeout=5000ms)
 Wait for ACKs for the given DDS Data Writer.
 
- Public Member Functions inherited from 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="")
 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
 

Additional Inherited Members

- Static Public Attributes inherited from rtctk::componentFramework::Dds
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 inherited from rtctk::componentFramework::Dds
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

All functionallty needed to create DDS entities for DDS data publishing is concentrated in this class.

Note
Please refer to FastDDS documentation for details of DDS

Constructor & Destructor Documentation

◆ DdsPub()

rtctk::componentFramework::DdsPub::DdsPub ( 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

DDS Publsiher class that takes care for handling all DDS entities to publish samples.

Parameters
qos_filename of QoS XML file. That needs to be located in subfolder: resource/config/rtctk/dds of $CFGPATH.
qos_profileDDS QoS profile (please refer to DDS documentation for details)
domain_idDDS domain Id (see FastDDS documentation for details)
participant_namename of participant
Note
Intended to be used just internally by RTC Toolkit.

◆ ~DdsPub()

rtctk::componentFramework::DdsPub::~DdsPub ( )
override

Member Function Documentation

◆ CreateDataWriter()

DataWriter * rtctk::componentFramework::DdsPub::CreateDataWriter ( Topic * topic,
DataWriterListener * listener = nullptr )

Creates DDS writer for particular topic for topic of type: rtctk::AgnosticTopic.

Parameters
topicDDS topic for which DDS writer shall be created
listenerpointer to DDS Writer Listener (optional). If not specified a default one is created/used: rtctk::componentFramework::DdsWriterListener
Returns
created DDS data writer

◆ CreateDataWriters()

void rtctk::componentFramework::DdsPub::CreateDataWriters ( )

Creates DDS Data Writer for all DDS topics.

Internal it calls CreateDataWriter for each topic from the internal topic map.

◆ CreateManyDataWriters() [1/2]

void rtctk::componentFramework::DdsPub::CreateManyDataWriters ( const std::vector< DdsWriterParams > & topics_listeners)

create DDS topics and DDS writers for the given list (vector) of topic names and rtctk::componentFramework::DdsWriterListener Internally it calls for each topic name CreateTopic, and on the created topic CreateDataWriter.

◆ CreateManyDataWriters() [2/2]

void rtctk::componentFramework::DdsPub::CreateManyDataWriters ( const std::vector< std::string > & topic_names)

create DDS topics and DDS writers for the given list of topic names Internally it calls for each topic name CreateTopic, and on the created topic CreateDataWriter.

◆ CreatePublisher()

void rtctk::componentFramework::DdsPub::CreatePublisher ( )

Creates DDS publisher.

It is enough to have one publisher, so this shall be called just once. It has to be called after DS particpant has been created.

◆ DestroyAllDataWriters()

void rtctk::componentFramework::DdsPub::DestroyAllDataWriters ( std::chrono::milliseconds wait_acks_timeout = 5000ms)

Destroys DDS Data Writer for all DDS topics.

Internal it calls DestroyDataWriter for each data write for each topic from the internal topic map.

Parameters
wait_acks_timeouttimeout for wait_for_acknowledgments in milliseconds - it makes sure that all reliable subscribers ACKs samples before deleting each DataWriter. Default is 5000ms. Parameter is passed to DestroyDataWriter method.

◆ DestroyDataWriter()

void rtctk::componentFramework::DdsPub::DestroyDataWriter ( DataWriter * dw,
bool to_be_removed = true,
std::chrono::milliseconds wait_acks_timeout = 5000ms )

Destroys DDS data writer, and also its listener.

Parameters
dwDDS Data writter to be destroyed
to_be_removedflag that indicates if the data writer should be also removed from internal vector. Default is to be removed.
wait_acks_timeouttimeout for wait_for_acknowledgments in miliseconds - it makes sure that all reliable subscribers ACKs samples before deleting each DAtaWriter. Default is 5000ms. If 0 wait_for_acknowledgments is not called.

◆ DestroyPublisher()

void rtctk::componentFramework::DdsPub::DestroyPublisher ( )

Destroys DDS publisher.

As there is just one publisher is should be called at most once.

◆ DumpDDSstatistics()

void rtctk::componentFramework::DdsPub::DumpDDSstatistics ( )

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

◆ GetDataWriters()

std::vector< DataWriter * > & rtctk::componentFramework::DdsPub::GetDataWriters ( )
inline

returns vector of all DDS Data writers

◆ WaitForAcks()

void rtctk::componentFramework::DdsPub::WaitForAcks ( DataWriter * dw,
std::chrono::milliseconds wait_acks_timeout = 5000ms )

Wait for ACKs for the given DDS Data Writer.

Parameters
dwDDS Data writer where wait for ACKs is perfromed.
wait_acks_timeouttimeout in ms

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