pflib v3.9.4-7-gb2e7f4f
Pretty Fine HGCROC Interaction Library
Loading...
Searching...
No Matches
econ_links.h
1#pragma once
2
3#include "./pftool.h"
4#include "pflib/Target.h"
5#include "pflib/packing/Hex.h"
6
8
9// Detect number of ECON links active
10// use of inline, so that only one copy of the function exists
11inline int determine_n_links(pflib::Target* tgt) {
12 auto econ = tgt->econ(pftool::state.iecon);
13 int n_links = 0;
14
15 for (int ch = 0; ch < 12; ch++) {
16 std::string name = std::to_string(ch) + "_ENABLE";
17 auto val = econ.readParameter("ERX", name);
18 std::cout << "Channel enabled " << ch << " = " << val << ", " << hex(val)
19 << std::endl;
20
21 if (val == 1) {
22 n_links += 1;
23 }
24 }
25 return n_links;
26}
encapulating a given setup's access rules
Definition Target.h:24
virtual ECON & econ(int which)
get a ECON interface for the given econ board
Definition Target.h:53
static State state
actual instance of the state
Definition pftool.h:93
static void econ(const std::string &cmd, Target *pft)
ECON menu commands.
Definition econ.cxx:147
T endl(T... args)
Shared declarations for all pftool menu commands.
A very simple wrapper enabling us to more easily tell the output stream to style the input word in he...
Definition Hex.h:16
T to_string(T... args)