11#ifndef RTCTK_COMPONENTFRAMEWORK_DATAPATH_DDSSUB_HPP
12#define RTCTK_COMPONENTFRAMEWORK_DATAPATH_DDSSUB_HPP
31 std::shared_ptr<DataReaderListener> l,
32 const std::string& mc)
54 Subscriber* m_subscriber =
nullptr;
55 std::vector<DataReader*> m_data_readers;
56 std::vector<std::shared_ptr<DataReaderListener>> m_listeners;
72 explicit DdsSub(
const std::string& qos_file,
75 const std::string& participant_name =
"");
98 std::shared_ptr<DataReaderListener> listener =
nullptr,
99 const std::string& multicast_address =
"");
149 return m_data_readers;
158struct formatter<eprosima::fastdds::dds::SampleRejectedStatusKind> : formatter<string_view> {
159 template <
typename FormatContext>
160 auto format(eprosima::fastdds::dds::SampleRejectedStatusKind c, FormatContext& ctx)
const {
161 using eprosima::fastdds::dds::SampleRejectedStatusKind;
162 string_view name =
"unknown";
164 case SampleRejectedStatusKind::NOT_REJECTED:
165 name =
"NOT_REJECTED";
167 case SampleRejectedStatusKind::REJECTED_BY_INSTANCES_LIMIT:
168 name =
"REJECTED_BY_INSTANCES_LIMIT";
170 case SampleRejectedStatusKind::REJECTED_BY_SAMPLES_LIMIT:
171 name =
"REJECTED_BY_SAMPLES_LIMIT";
173 case SampleRejectedStatusKind::REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT:
174 name =
"REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT";
176#if (FASTDDS_VERSION_MAJOR >= 4) || ((FASTDDS_VERSION_MAJOR == 3) && (FASTDDS_VERSION_MINOR >= 5))
177 case SampleRejectedStatusKind::REJECTED_BY_UNKNOWN_INSTANCE:
178 name =
"REJECTED_BY_UNKNOWN_INSTANCE";
183 return formatter<string_view>::format(name, ctx);
DdsSub(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="")
Definition ddsSub.cpp:29
DdsSub(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="")
Definition ddsSub.cpp:29
DataReader * CreateDataReader(Topic *topic, std::shared_ptr< DataReaderListener > listener=nullptr, const std::string &multicast_address="")
Creates DDS data reader for particular topic for topic of type: rtctk::AgnosticTopic.
Definition ddsSub.cpp:108
void DumpDDSstatistics()
Dumps / logs varios DDS statistic like NACks, ACKs, ... for each DDS writer.
Definition ddsSub.cpp:278
void DestroySubscriber()
Destroys DDS subscriber.
Definition ddsSub.cpp:91
void DestroyAllDataReaders()
Destroys DDS Data Reader for all DDS topics.
Definition ddsSub.cpp:254
void EnableAllDataReaders()
Definition ddsSub.cpp:179
void CreateManyDataReaders(const std::vector< DdsReaderParams > &reader_params)
create DDS topics and DDS readers for the given list (vector) of topic names and rtctk::componentFram...
Definition ddsSub.cpp:227
std::vector< DataReader * > & GetDataReaders()
returns vector of all DDS Data writers
Definition ddsSub.hpp:148
~DdsSub() override
Definition ddsSub.cpp:38
void CreateDataReaders()
Creates DDS Data Reader for all DDS topics.
Definition ddsSub.cpp:265
void CreateSubscriber()
Creates DDS subscriber.
Definition ddsSub.cpp:47
void DestroyDataReader(DataReader *dr, bool to_be_removed=true)
Destroys DDS data reader.
Definition ddsSub.cpp:192
static const DomainId_t DEFAULT_DOMAIN_ID
default Domain Id for different DDS
Definition dds.hpp:173
static const std::string DEFAULT_QOS_PROFILE
default profile name for different DDS QoSs
Definition dds.hpp:167
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.
Definition dds.cpp:24
Declares common DDS class.
Definition commandReplier.cpp:21
Definition ddsSub.hpp:155
DdsReaderParams(const std::string &tn, std::shared_ptr< DataReaderListener > l, const std::string &mc)
Definition ddsSub.hpp:30
std::string topic_name
Definition ddsSub.hpp:26
std::string multicast_address
Definition ddsSub.hpp:28
DdsReaderParams(const std::string &tn)
Definition ddsSub.hpp:40
DdsReaderParams(const std::string &tn, std::shared_ptr< DataReaderListener > l)
Definition ddsSub.hpp:36
std::shared_ptr< DataReaderListener > listener
Definition ddsSub.hpp:27
DdsReaderParams(const std::string &tn, std::shared_ptr< DataReaderListener > l, const std::string &mc)
Definition ddsSub.hpp:30