28 : callback_(callback) {}
33 eprosima::fastdds::dds::DataReader* reader) {
38 auto channel_id =
common::Hash(reader->get_topicdescription()->get_name());
39 eprosima::fastdds::dds::SampleInfo m_info;
42 while (reader->take_next_sample(
reinterpret_cast<void*
>(&m), &m_info) ==
43 eprosima::fastrtps::types::ReturnCode_t::RETCODE_OK) {
44 if (m_info.valid_data) {
45 char* ptr =
reinterpret_cast<char*
>(
46 &m_info.related_sample_identity.writer_guid());
58 callback_(std::make_shared<std::string>(m.
data()), channel_id, msg_info_);
60 AERROR <<
"Remote writer for topic "
61 << reader->get_topicdescription()->get_name() <<
" is dead";
67 eprosima::fastdds::dds::DataReader* reader,
68 const eprosima::fastdds::dds::SubscriptionMatchedStatus& info) {
void set_data(const char *data)
void set_seq_num(uint64_t seq_num)
void set_spare_id(const Identity &spare_id)
void set_send_time(uint64_t send_time)
void set_sender_id(const Identity &sender_id)
This class represents the structure UnderlayMessage defined by the user in the IDL file.
void seq(uint64_t _seq)
This function sets a value in member seq
void timestamp(uint64_t _timestamp)
This function sets a value in member timestamp
void data(const std::string &_data)
This function copies the value in member data
void on_subscription_matched(eprosima::fastdds::dds::DataReader *reader, const eprosima::fastdds::dds::SubscriptionMatchedStatus &info) override
void on_data_available(eprosima::fastdds::dds::DataReader *reader) override
SubscriberListener(const rtps::subsciber_callback &callback)
virtual ~SubscriberListener()
#define RETURN_IF_NULL(ptr)
std::size_t Hash(const std::string &key)
std::function< void(const std::shared_ptr< std::string > &msg_str, uint64_t channel_id, const MessageInfo &msg_info)> subsciber_callback
constexpr uint8_t ID_SIZE