Merge branch 'refactor' into address

This commit is contained in:
Erik Frojdh 2019-04-02 15:44:57 +02:00
commit 45fd35b243
2 changed files with 35 additions and 0 deletions

View File

@ -168,6 +168,14 @@ class multiSlsDetector : public virtual slsDetectorDefs {
std::vector<RT> parallelCall(RT (slsDetector::*somefunc)(CT...) const,
typename NonDeduced<CT>::type... Args) const;
template <typename... CT>
void parallelCall(void (slsDetector::*somefunc)(CT...), typename NonDeduced<CT>::type... Args);
template <typename... CT>
void parallelCall(void (slsDetector::*somefunc)(CT...) const, typename NonDeduced<CT>::type... Args) const;
/**
* Decodes which detector and the corresponding channel numbers for it
* Mainly useful in a multi detector setROI (Gotthard, Mythen?)

View File

@ -98,6 +98,33 @@ std::vector<RT> multiSlsDetector::parallelCall(RT (slsDetector::*somefunc)(CT...
return result;
}
template <typename... CT>
void multiSlsDetector::parallelCall(void (slsDetector::*somefunc)(CT...),
typename NonDeduced<CT>::type... Args) {
std::vector<std::future<void>> 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 <typename... CT>
void multiSlsDetector::parallelCall(void (slsDetector::*somefunc)(CT...) const,
typename NonDeduced<CT>::type... Args) const{
std::vector<std::future<void>> 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;