DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
RecorderModel.hpp
Go to the documentation of this file.
1
8#ifndef DATAHANDLINGLIBS_INCLUDE_DATAHANDLINGLIBS_MODELS_RECORDERMODEL_HPP_
9#define DATAHANDLINGLIBS_INCLUDE_DATAHANDLINGLIBS_MODELS_RECORDERMODEL_HPP_
10
18
20
25#include <atomic>
26#include <fstream>
27#include <iostream>
28#include <memory>
29#include <string>
30
31namespace dunedaq {
32namespace datahandlinglibs {
33
34template<class ReadoutType>
36{
37public:
38 explicit RecorderModel(std::string name)
39 : m_work_thread(0)
40 , m_name(name)
41 {}
42
43 void init(const appmodel::DataRecorderModule* conf) override;
44 // void get_info(opmonlib::InfoCollector& ci, int /* level */) override;
45 void do_conf(const nlohmann::json& /*args*/) override;
46 void do_scrap(const nlohmann::json& /*args*/) override { m_buffered_writer.close(); }
47 void do_start(const nlohmann::json& /* args */) override;
48 void do_stop(const nlohmann::json& /* args */) override;
49
50protected:
51 virtual void generate_opmon_data() override;
52
53private:
54 // The work that the worker thread does
55 void do_work();
56
57 // Queue
59 std::shared_ptr<source_t> m_data_receiver;
60
61 // Internal
62 //recorderconfig::Conf m_conf;
63 std::string m_output_file;
67
69
70 // Threading
72 std::atomic<bool> m_run_marker;
73
74 // Stats
75 std::atomic<int> m_bytes_processed{ 0 };
76 std::atomic<int> m_packets_processed{ 0 };
77 std::chrono::steady_clock::time_point m_time_point_last_info;
78
79 std::string m_name;
80};
81
82} // namespace datahandlinglibs
83} // namespace dunedaq
84
85// Declarations
87
88#endif // DATAHANDLINGLIBS_INCLUDE_DATAHANDLINGLIBS_MODELS_RECORDERMODEL_HPP_
void init(const appmodel::DataRecorderModule *conf) override
void do_start(const nlohmann::json &) override
std::shared_ptr< source_t > m_data_receiver
virtual void generate_opmon_data() override
void do_conf(const nlohmann::json &) override
void do_scrap(const nlohmann::json &) override
void do_stop(const nlohmann::json &) override
std::chrono::steady_clock::time_point m_time_point_last_info
utilities::ReusableThread m_work_thread
Including Qt Headers.