mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-07-31 01:13:37 +02:00
added counters
This commit is contained in:
@@ -1014,15 +1014,16 @@ std::string Caller::counters(int action) {
|
||||
if (args.empty()) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
if (std::any_of(args.cbegin(), args.cend(), [](std::string s) {
|
||||
return (StringTo<int>(s) < 0 || StringTo<int>(s) > 2);
|
||||
//convert args to string and then to a vector of ints
|
||||
auto counters = StringTo<std::vector<int>>( ToString(args));
|
||||
if (std::any_of(counters.cbegin(), counters.cend(), [](int val) {
|
||||
return (val < 0 || val > 2);
|
||||
})) {
|
||||
throw RuntimeError("Invalid counter indices list. Example: 0 1 2");
|
||||
}
|
||||
// convert vector to counter enable mask
|
||||
uint32_t mask = 0;
|
||||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
int val = StringTo<int>(args[i]);
|
||||
for (auto val : counters) {
|
||||
// already enabled earlier
|
||||
if (mask & (1 << val)) {
|
||||
std::ostringstream oss;
|
||||
|
||||
Reference in New Issue
Block a user