RTC Toolkit  2.0.0
mudpiProcessor.hpp
Go to the documentation of this file.
1 
12 #ifndef RTCTK_REUSABLECOMPONENT_TELREPUB_MUDPIPROCESSOR_HPP_
13 #define RTCTK_REUSABLECOMPONENT_TELREPUB_MUDPIPROCESSOR_HPP_
14 
15 #include <atomic>
16 #include <boost/asio.hpp>
17 #include <thread>
18 
20 
21 #include "mudpi.h"
22 #include "mudpiProcessingError.hpp"
23 
24 #include "ddsPubThread.hpp"
25 
26 namespace rtctk::telRepub {
27 
28 uint32_t const MAX_TOPIC_SIZE = 2560000; // Large increase for Pixel topics
29 
42  uint32_t m_statistic_msg_update_rate;
43  uint32_t m_statistic_msg_counter = 0;
44 
45  bool m_in_synch = true;
46 
50  PubThreadBase<>& m_pub;
51 
53  rtctk::componentFramework::AgnosticTopic* m_dds_topic;
54 
56 
61  // @note: OLDB does not support uint64_t which we really want, so we have to use signed 64.
62  perfc::CounterI64 m_pc_recvd;
63  perfc::ScopedRegistration m_pc_recvd_reg;
64  perfc::CounterI64 m_pc_frame_errors;
65  perfc::ScopedRegistration m_pc_frame_errors_reg;
66  perfc::CounterI64 m_pc_sample_errors;
67  perfc::ScopedRegistration m_pc_sample_errors_reg;
68  perfc::CounterDouble m_pc_frequency_estimate;
69  perfc::ScopedRegistration m_pc_frequency_estimate_reg;
70 
71  uint32_t m_total_buf_len;
72 
73  mudpi::uint32_t m_last_sample_id = -1; // TBC!!!
74  mudpi::uint32_t m_freq_est_samples = 0;
75  mudpi::timestamp_t m_last_timestamp = 0.0;
76 
77  mudpi::uint16_t m_last_frame_id = 0;
78  mudpi::uint16_t m_num_frames = -1; // TBC !!!
79 
83  std::chrono::steady_clock::time_point m_start_time;
84  std::chrono::steady_clock::time_point m_now_time;
85  std::chrono::duration<double, std::ratio<1>> m_elapsed_time;
86 
87  mudpi::uint16_t m_topic_id = 0;
88  mudpi::uint32_t m_sample_id = 0;
89  mudpi::uint16_t m_frame_id = 0;
90 
91 
96  log4cplus::Logger m_logger;
97 
98 public:
107  explicit MudpiProcessor(mudpi::uint16_t mudpi_topic_id, PubThreadBase<>& pub,
109  uint32_t statistic_msg_update_rate = 60);
110 
114  MudpiProcessor(MudpiProcessor const& rhs) = delete;
115 
116  MudpiProcessor& operator=(MudpiProcessor const& rhs) = delete;
117 
118  virtual ~MudpiProcessor();
119 
126  std::error_code ProcessMudpi(mudpi::mudpiHeader* packet);
127 
131  void Statistics();
132 }; // MudpiProcessor
133 
134 } // namespace rtctk::telRepub
135 
136 #endif // RTCTK_REUSABLECOMPONENT_TELREPUB_MUDPIPROCESSOR_HPP_
rtctk::telRepub::MudpiProcessor::~MudpiProcessor
virtual ~MudpiProcessor()
Definition: mudpiProcessor.cpp:104
rtctk::telRepub::MudpiProcessor::operator=
MudpiProcessor & operator=(MudpiProcessor const &rhs)=delete
ddsPubThread.hpp
DDS agnostic topic publioshing thread.
componentMetricsIf.hpp
Header file for ComponentMetricsIf.
rtctk::telRepub
Definition: ddsPubThread.hpp:26
mudpi::mudpiHeader
MUDPI header definition.
Definition: mudpi.h:27
mudpi::uint16_t
unsigned short uint16_t
Definition: mudpi.h:15
mudpi::timestamp_t
double timestamp_t
Definition: mudpi.h:18
rtctk::componentFramework::ComponentMetricsIf
Component metrics interface.
Definition: componentMetricsIf.hpp:177
rtctk::telRepub::MudpiProcessor::MudpiProcessor
MudpiProcessor(MudpiProcessor const &rhs)=delete
Copy construction.
rtctk::telRepub::RepubBuf< rtctk::componentFramework::AgnosticTopic >
rtctk::telRepub::MudpiProcessor::Statistics
void Statistics()
Dump statistics.
Definition: mudpiProcessor.cpp:321
rtctk::telRepub::MudpiProcessor
Processing MUDPI data received by UDP receiver: rtctk::telRepub::UdpReceiver.
Definition: mudpiProcessor.hpp:38
rtctk::telRepub::MAX_TOPIC_SIZE
uint32_t const MAX_TOPIC_SIZE
Definition: mudpiProcessor.hpp:28
mudpi::uint32_t
unsigned int uint32_t
Definition: mudpi.h:16
rtctk::telRepub::MudpiProcessor::ProcessMudpi
std::error_code ProcessMudpi(mudpi::mudpiHeader *packet)
Here the actual processing is done (frame by frame (MUDPI datagram)).
Definition: mudpiProcessor.cpp:110
mudpiProcessingError.hpp
MUDPI processor error codes.
rtctk::telRepub::MudpiProcessor::MudpiProcessor
MudpiProcessor(mudpi::uint16_t mudpi_topic_id, PubThreadBase<> &pub, componentFramework::ComponentMetricsIf &metrics, uint32_t statistic_msg_update_rate=60)
MUDPI Processor constructor.
Definition: mudpiProcessor.cpp:23
rtctk::telRepub::PubThreadBase
DDS publisher thread class that provides queue with aggregated topic to be published by DDS.
Definition: ddsPubThread.hpp:36