Line data Source code
1 : /**
2 : * @file TDEAMCModule.hpp
3 : *
4 : * Developer(s) of this DAQModule have yet to replace this line with a brief description of the DAQModule.
5 : *
6 : * This is part of the DUNE DAQ Software Suite, copyright 2020.
7 : * Licensing/copyright details are in the COPYING file that you should have
8 : * received with this code.
9 : */
10 :
11 : #ifndef TDEMODULES_PLUGINS_TDEAMCMODULE_HPP_
12 : #define TDEMODULES_PLUGINS_TDEAMCMODULE_HPP_
13 :
14 : #include "appmodel/TDEAMCModule.hpp"
15 : #include "appfwk/DAQModule.hpp"
16 : #include "tdemodules/AMCController.hpp"
17 :
18 : #include <atomic>
19 : #include <limits>
20 : #include <string>
21 :
22 : namespace dunedaq::tdemodules {
23 :
24 : class TDEAMCModule : public dunedaq::appfwk::DAQModule
25 : {
26 : public:
27 : explicit TDEAMCModule(const std::string& name);
28 :
29 : void init(std::shared_ptr<appfwk::ConfigurationManager>) override;
30 :
31 : TDEAMCModule(const TDEAMCModule&) = delete;
32 : TDEAMCModule& operator=(const TDEAMCModule&) = delete;
33 : TDEAMCModule(TDEAMCModule&&) = delete;
34 : TDEAMCModule& operator=(TDEAMCModule&&) = delete;
35 :
36 0 : ~TDEAMCModule() = default;
37 :
38 : protected:
39 : void generate_opmon_data() override;
40 :
41 : private:
42 : // Commands TDEAMCModule can receive
43 :
44 : // TO tdemodules DEVELOPERS: PLEASE DELETE THIS FOLLOWING COMMENT AFTER READING IT
45 : // For any run control command it is possible for a DAQModule to
46 : // register an action that will be executed upon reception of the
47 : // command. do_conf is a very common example of this; in
48 : // TDEAMCModule.cpp you would implement do_conf so that members of
49 : // TDEAMCModule get assigned values from a configuration passed as
50 : // an argument and originating from the CCM system.
51 :
52 : void do_conf(const CommandData_t&);
53 : void do_start(const CommandData_t&);
54 : void do_stop(const CommandData_t&);
55 :
56 : // TO tdemodules DEVELOPERS: PLEASE DELETE THIS FOLLOWING COMMENT AFTER READING IT
57 : // m_total_amount and m_amount_since_last_get_info_call are examples
58 : // of variables whose values get reported to OpMon
59 : // (https://github.com/mozilla/opmon) each time get_info() is
60 : // called. "amount" represents a (discrete) value which changes as TDEAMCModule
61 : // runs and whose value we'd like to keep track of during running;
62 : // obviously you'd want to replace this "in real life"
63 :
64 : std::unique_ptr<AMCController> m_ctrl;
65 : std::atomic<int64_t> m_total_amount {0};
66 : std::atomic<int> m_amount_since_last_call {0};
67 :
68 : const appmodel::TDEAMCModule* m_dal;
69 : };
70 :
71 : } // namespace dunedaq::tdemodules
72 :
73 : #endif // TDEMODULES_PLUGINS_TDEAMCMODULE_HPP_
|