diff --git a/slsDetectorSoftware/include/multiSlsDetector.h b/slsDetectorSoftware/include/multiSlsDetector.h index 13e2ae1e2..084450ede 100644 --- a/slsDetectorSoftware/include/multiSlsDetector.h +++ b/slsDetectorSoftware/include/multiSlsDetector.h @@ -168,6 +168,14 @@ class multiSlsDetector : public virtual slsDetectorDefs { std::vector parallelCall(RT (slsDetector::*somefunc)(CT...) const, typename NonDeduced::type... Args) const; + + template + void parallelCall(void (slsDetector::*somefunc)(CT...), typename NonDeduced::type... Args); + + template + void parallelCall(void (slsDetector::*somefunc)(CT...) const, typename NonDeduced::type... Args) const; + + /** * Decodes which detector and the corresponding channel numbers for it * Mainly useful in a multi detector setROI (Gotthard, Mythen?) diff --git a/slsDetectorSoftware/src/multiSlsDetector.cpp b/slsDetectorSoftware/src/multiSlsDetector.cpp index 927dfa180..10021a1c3 100644 --- a/slsDetectorSoftware/src/multiSlsDetector.cpp +++ b/slsDetectorSoftware/src/multiSlsDetector.cpp @@ -98,6 +98,33 @@ std::vector multiSlsDetector::parallelCall(RT (slsDetector::*somefunc)(CT... return result; } +template +void multiSlsDetector::parallelCall(void (slsDetector::*somefunc)(CT...), + typename NonDeduced::type... Args) { + std::vector> futures; + for (auto &d : detectors) { + futures.push_back(std::async(std::launch::async, somefunc, d.get(), Args...)); + } + for (auto &i : futures) { + i.get(); + } + return; +} + +template +void multiSlsDetector::parallelCall(void (slsDetector::*somefunc)(CT...) const, + typename NonDeduced::type... Args) const{ + std::vector> futures; + for (auto &d : detectors) { + futures.push_back(std::async(std::launch::async, somefunc, d.get(), Args...)); + } + for (auto &i : futures) { + i.get(); + } + return; +} + + int multiSlsDetector::decodeNChannel(int offsetX, int offsetY, int &channelX, int &channelY) { channelX = -1; channelY = -1;