exptime of gates

This commit is contained in:
Erik Frojdh 2020-05-20 09:36:43 +02:00
parent 6d71d6cf9f
commit 761f93d753
4 changed files with 14 additions and 11 deletions

View File

@ -1277,9 +1277,9 @@ void Detector::setExptime(int gateIndex, ns t, Positions pos) {
Result<std::array<ns, 3>> Detector::getExptimeForAllGates(Positions pos) const { Result<std::array<ns, 3>> Detector::getExptimeForAllGates(Positions pos) const {
auto t = pimpl->Parallel(&Module::getExptimeForAllGates, pos); auto t = pimpl->Parallel(&Module::getExptimeForAllGates, pos);
Result<std::array<ns, 3>> res(t.size()); Result<std::array<ns, 3>> res(t.size());
for (unsigned int i = 0; i < t.size(); ++i) { for (size_t i = 0; i < t.size(); ++i) {
for (unsigned int j = 0; j != 3; ++j) { for (size_t j = 0; j != 3; ++j) {
res[i][j] = static_cast<ns>(t[i][j]); res[i][j] = ns(t[i][j]);
} }
} }
return res; return res;

View File

@ -151,7 +151,7 @@ template <typename Ret> Ret Module::sendToDetector(int fnum) {
<< sizeof(Ret) << "]"; << sizeof(Ret) << "]";
Ret retval{}; Ret retval{};
sendToDetector(fnum, nullptr, 0, &retval, sizeof(retval)); sendToDetector(fnum, nullptr, 0, &retval, sizeof(retval));
LOG(logDEBUG1) << "Got back: " << retval; LOG(logDEBUG1) << "Got back: " << ToString(retval);
return retval; return retval;
} }
@ -163,7 +163,7 @@ Ret Module::sendToDetector(int fnum, const Arg &args) {
<< typeid(Ret).name() << ", " << sizeof(Ret) << "]"; << typeid(Ret).name() << ", " << sizeof(Ret) << "]";
Ret retval{}; Ret retval{};
sendToDetector(fnum, &args, sizeof(args), &retval, sizeof(retval)); sendToDetector(fnum, &args, sizeof(args), &retval, sizeof(retval));
LOG(logDEBUG1) << "Got back: " << retval; LOG(logDEBUG1) << "Got back: " << ToString(retval);
return retval; return retval;
} }
@ -1057,9 +1057,8 @@ void Module::setExptime(int gateIndex, int64_t value) {
} }
std::array<int64_t, 3> Module::getExptimeForAllGates() { std::array<int64_t, 3> Module::getExptimeForAllGates() {
std::array<int64_t, 3> retval; return sendToDetector<std::array<int64_t, 3>>(F_GET_EXPTIME_ALL_GATES);
sendToDetector(F_GET_EXPTIME_ALL_GATES, nullptr, retval);
return retval;
} }
int64_t Module::getGateDelay(int gateIndex) { int64_t Module::getGateDelay(int gateIndex) {

View File

@ -12,6 +12,7 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include "sls_detector_exceptions.h" #include "sls_detector_exceptions.h"
#include "string_utils.h" #include "string_utils.h"
#include <array>
#include <chrono> #include <chrono>
#include <iomanip> #include <iomanip>
#include <map> #include <map>
@ -38,9 +39,6 @@ std::string ToString(const defs::timingSourceType s);
std::string ToString(const slsDetectorDefs::ROI &roi); std::string ToString(const slsDetectorDefs::ROI &roi);
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::ROI &roi); std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::ROI &roi);
const std::string &ToString(const std::string &s); const std::string &ToString(const std::string &s);
/** Convert std::chrono::duration with specified output unit */ /** Convert std::chrono::duration with specified output unit */

View File

@ -232,3 +232,9 @@ TEST_CASE("Streaming of slsDetectorDefs::ROI") {
REQUIRE(oss.str() == "[-10, 1]"); REQUIRE(oss.str() == "[-10, 1]");
} }
TEST_CASE("std::array"){
std::array<int, 3> arr{4,6,7};
REQUIRE(ToString(arr) == "[4, 6, 7]");
}