Line data Source code
1 : /**
2 : * @file TimingNode.cpp
3 : *
4 : * This is part of the DUNE DAQ Software Suite, copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 :
9 : #include "timing/TimingNode.hpp"
10 :
11 : #include <map>
12 : #include <string>
13 :
14 : namespace dunedaq {
15 : namespace timing {
16 :
17 : //-----------------------------------------------------------------------------
18 0 : TimingNode::TimingNode(const uhal::Node& node)
19 0 : : uhal::Node(node)
20 0 : {}
21 : //-----------------------------------------------------------------------------
22 :
23 : //-----------------------------------------------------------------------------
24 0 : TimingNode::~TimingNode() {}
25 : //-----------------------------------------------------------------------------
26 :
27 : //-----------------------------------------------------------------------------
28 : std::map<std::string, uhal::ValWord<uint32_t>> // NOLINT(build/unsigned)
29 0 : TimingNode::read_sub_nodes(const uhal::Node& node, bool dispatch) const
30 : {
31 0 : auto node_names = node.getNodes();
32 :
33 0 : std::map<std::string, uhal::ValWord<uint32_t>> node_name_value_pairs; // NOLINT(build/unsigned)
34 :
35 0 : for (auto it = node_names.begin(); it != node_names.end(); ++it)
36 0 : node_name_value_pairs[*it] = node.getNode(*it).read();
37 0 : if (dispatch)
38 0 : getClient().dispatch();
39 0 : return node_name_value_pairs;
40 0 : }
41 : //-----------------------------------------------------------------------------
42 :
43 : //-----------------------------------------------------------------------------
44 : void
45 0 : TimingNode::reset_sub_nodes(const uhal::Node& node, uint32_t aValue, bool dispatch) const // NOLINT(build/unsigned)
46 : {
47 :
48 0 : auto node_names = node.getNodes();
49 :
50 0 : for (auto it = node_names.begin(); it != node_names.end(); ++it)
51 0 : node.getNode(*it).write(aValue);
52 :
53 0 : if (dispatch)
54 0 : getClient().dispatch();
55 0 : }
56 : //-----------------------------------------------------------------------------
57 :
58 : } // namespace timing
59 : } // namespace dunedaq
|