12#ifndef RTCTK_REUSABLECOMPONENT_TELREPUB_DDS_PUB_THREAD_HPP
13#define RTCTK_REUSABLECOMPONENT_TELREPUB_DDS_PUB_THREAD_HPP
15#include "agnostictopicif.h"
19#include <fastdds/dds/publisher/DataWriter.hpp>
21#include <fmt/printf.h>
29#include <tbb/concurrent_queue.h>
31#include <numapp/thread.hpp>
63 DataWriter &data_writer,
66 std::uint32_t queue_size,
67 numapp::NumaPolicies
const &thread_policies,
68 std::uint16_t sim_freq,
69 std::uint32_t sim_payload_size,
70 std::uint32_t expected_sample_id_increment,
110 void ProcessingLoop();
117 void SimProcessingLoop();
119 std::string MakeThreadDpName(
bool is_sim_thread =
true);
120 std::string MakeThreadName(
bool is_sim_thread =
false);
122 enum class State { Idle, Run, Exit };
124 std::shared_ptr<Queue> m_frame_queue;
126 std::string m_topic_name;
128 log4cplus::Logger m_logger;
130 std::atomic<State> m_requested_state;
131 std::thread m_thread;
132 std::string m_thread_name;
136 AgnosticTopic m_sim_msg;
137 DataWriter &m_data_writer;
141 std::uint16_t m_sim_freq;
142 std::uint32_t m_sim_payload_size;
143 std::uint32_t m_expected_sample_id_increment;
149 perfc::CounterI64 m_pc_published_samples;
150 perfc::ScopedRegistration m_pc_published_samples_reg;
152 perfc::CounterI64 m_pc_publication_errors;
153 perfc::ScopedRegistration m_pc_publication_errors_reg;
155 perfc::CounterI64 m_pc_last_sample_id_published;
156 perfc::ScopedRegistration m_pc_last_sample_id_published_reg;
158 std::unique_ptr<DurationMonitor<>> m_dur_mon;
Component metrics interface.
Definition: componentMetricsIf.hpp:184
Processing MUDPI data received by UDP receiver: rtctk::telRepub::UdpReceiver.
Definition: mudpiProcessor.hpp:44
DDS publisher thread class that supports production and simulation mode.
Definition: ddsPubThread.hpp:46
void IdleAsync()
Disable publishing data.
Definition: ddsPubThread.cpp:126
std::string GetTopicName()
Definition: ddsPubThread.cpp:138
void RunAsync()
Enable publishing data.
Definition: ddsPubThread.cpp:117
bool InSimMode()
Check whether simulation mode is active.
Definition: ddsPubThread.cpp:130
std::shared_ptr< Queue > GetQueue()
Definition: ddsPubThread.cpp:142
~PubThread()
Joins publisher thread and prints some statistics information.
Definition: ddsPubThread.cpp:93
MudpiProcessor & GetMudpiProcessor()
Get MudpiProcessor.
Definition: ddsPubThread.cpp:134
Header file for ComponentMetricsIf.
Declares some common DDS functionality.
Header file for Duration Monitor.
Logging Support Library based on log4cplus.
MUDPI processor: check and aggregate MUDPI payload to a single topic and put to the queue for publish...
Definition: commandReplier.cpp:22
Definition: ddsPubThread.cpp:17
std::function< std::error_code(const gsl::span< const gsl::span< const uint8_t > >, std::vector< uint8_t > &)> WranglerFunction
The wrangler function that is called with a span of spans containing the payload and an vector where ...
Definition: wrangler.hpp:29
Wrangler: User extension point.