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
44 void init(const appmodel::DataRecorderModule* conf) override;
45 // void get_info(opmonlib::InfoCollector& ci, int /* level */) override;
46 void do_conf(const appfwk::DAQModule::CommandData_t& /*args*/) override;
47 void do_scrap(const appfwk::DAQModule::CommandData_t& /*args*/) override { m_buffered_writer.close(); }
48 void do_start(const appfwk::DAQModule::CommandData_t& /* args */) override;
49 void do_stop(const appfwk::DAQModule::CommandData_t& /* args */) override;
50
51protected:
52 virtual void generate_opmon_data() override;
53
54private:
55 // The work that the worker thread does
56 void do_work();
57
58 // Queue
60 std::shared_ptr<source_t> m_data_receiver;
61
62 // Internal
63 // recorderconfig::Conf m_conf;
64 std::string m_output_file;
68
70
71 // Threading
73 std::atomic<bool> m_run_marker;
74
75 // Stats
76 std::atomic<int> m_bytes_processed{ 0 };
77 std::atomic<int> m_packets_processed{ 0 };
78 std::chrono::steady_clock::time_point m_time_point_last_info;
79
80 std::string m_name;
81};
82
83} // namespace datahandlinglibs
84} // namespace dunedaq
85
86// Declarations
88
89#endif // DATAHANDLINGLIBS_INCLUDE_DATAHANDLINGLIBS_MODELS_RECORDERMODEL_HPP_
void do_start(const appfwk::DAQModule::CommandData_t &) override
std::shared_ptr< source_t > m_data_receiver
virtual void generate_opmon_data() override
dunedaq::iomanager::ReceiverConcept< ReadoutType > source_t
void do_stop(const appfwk::DAQModule::CommandData_t &) override
void do_scrap(const appfwk::DAQModule::CommandData_t &) override
void do_conf(const appfwk::DAQModule::CommandData_t &) override
std::chrono::steady_clock::time_point m_time_point_last_info
utilities::ReusableThread m_work_thread
void init(unordered_map< std::string, std::string > params)
The DUNE-DAQ namespace.