RTC Toolkit 4.0.2
Loading...
Searching...
No Matches
mudpiPublisher.hpp
Go to the documentation of this file.
1
13#ifndef RTCTK_REUSABLECOMPONENT_MUDPIGENPUB_MUDPI_PUBLISHER_HPP
14#define RTCTK_REUSABLECOMPONENT_MUDPIGENPUB_MUDPI_PUBLISHER_HPP
15
16#include <atomic>
17#include <string>
18#include <thread>
19#include <vector>
20
23
24namespace rtctk::mudpiPub {
25
26class Publisher {
27public:
28 Publisher(const std::string& pub_id, const PubCfg& cfg);
29 virtual ~Publisher();
30 void SendSample();
32
33private:
34 void Run();
35
36 // Helper function to load data from file.
37 void LoadDataFromFile(const std::string& filename, const std::string& colname);
38
39 // Helper function to fill a sample buffer with a pattern.
40 void FillSample(std::vector<char>& sample_data, std::uint32_t sample_id);
41
42 log4cplus::Logger& m_logger;
43
44 std::string m_id;
45
46 PubCfg m_cfg;
47
48 // Buffers of sample data loaded from the data file.
49 std::vector<std::vector<char>> m_sample_data_from_file;
50
51 std::atomic<bool> m_send_sample;
52 std::atomic<bool> m_stop;
53
54 std::thread m_thread;
55};
56
57} // namespace rtctk::mudpiPub
58
59#endif // RTCTK_REUSABLECOMPONENT_MUDPIGENPUB_PUBLISHER_HPP
Definition: mudpiPublisher.hpp:26
void WaitUntilSendingDone()
Definition: mudpiPublisher.cpp:134
void SendSample()
Definition: mudpiPublisher.cpp:130
virtual ~Publisher()
Definition: mudpiPublisher.cpp:123
Logging Support Library based on log4cplus.
RTC toolkit MUDPI publisher configuration class declaration.
Definition: businessLogic.cpp:20
Configuration of a single MUDPI Publisher object.
Definition: mudpiPubCfg.hpp:28