diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 76c2bbc9a..520034748 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -1277,9 +1277,9 @@ void Detector::setExptime(int gateIndex, ns t, Positions pos) { Result> Detector::getExptimeForAllGates(Positions pos) const { auto t = pimpl->Parallel(&Module::getExptimeForAllGates, pos); Result> res(t.size()); - for (unsigned int i = 0; i < t.size(); ++i) { - for (unsigned int j = 0; j != 3; ++j) { - res[i][j] = static_cast(t[i][j]); + for (size_t i = 0; i < t.size(); ++i) { + for (size_t j = 0; j != 3; ++j) { + res[i][j] = ns(t[i][j]); } } return res; diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 6a2e06e51..20a812f63 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -151,7 +151,7 @@ template Ret Module::sendToDetector(int fnum) { << sizeof(Ret) << "]"; Ret retval{}; sendToDetector(fnum, nullptr, 0, &retval, sizeof(retval)); - LOG(logDEBUG1) << "Got back: " << retval; + LOG(logDEBUG1) << "Got back: " << ToString(retval); return retval; } @@ -163,7 +163,7 @@ Ret Module::sendToDetector(int fnum, const Arg &args) { << typeid(Ret).name() << ", " << sizeof(Ret) << "]"; Ret retval{}; sendToDetector(fnum, &args, sizeof(args), &retval, sizeof(retval)); - LOG(logDEBUG1) << "Got back: " << retval; + LOG(logDEBUG1) << "Got back: " << ToString(retval); return retval; } @@ -1057,9 +1057,8 @@ void Module::setExptime(int gateIndex, int64_t value) { } std::array Module::getExptimeForAllGates() { - std::array retval; - sendToDetector(F_GET_EXPTIME_ALL_GATES, nullptr, retval); - return retval; + return sendToDetector>(F_GET_EXPTIME_ALL_GATES); + } int64_t Module::getGateDelay(int gateIndex) { diff --git a/slsSupportLib/include/ToString.h b/slsSupportLib/include/ToString.h index 6e20f69dc..267221516 100644 --- a/slsSupportLib/include/ToString.h +++ b/slsSupportLib/include/ToString.h @@ -12,6 +12,7 @@ #include "sls_detector_defs.h" #include "sls_detector_exceptions.h" #include "string_utils.h" +#include #include #include #include @@ -38,9 +39,6 @@ std::string ToString(const defs::timingSourceType s); std::string ToString(const slsDetectorDefs::ROI &roi); std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::ROI &roi); - - - const std::string &ToString(const std::string &s); /** Convert std::chrono::duration with specified output unit */ diff --git a/slsSupportLib/tests/test-ToString.cpp b/slsSupportLib/tests/test-ToString.cpp index 70151bf73..952f71182 100644 --- a/slsSupportLib/tests/test-ToString.cpp +++ b/slsSupportLib/tests/test-ToString.cpp @@ -232,3 +232,9 @@ TEST_CASE("Streaming of slsDetectorDefs::ROI") { REQUIRE(oss.str() == "[-10, 1]"); } +TEST_CASE("std::array"){ + std::array arr{4,6,7}; + REQUIRE(ToString(arr) == "[4, 6, 7]"); +} + +