This commit is contained in:
Erik Frojdh 2020-04-27 17:21:22 +02:00
parent b90f9b046f
commit c4c2866905
3 changed files with 11 additions and 24 deletions

View File

@ -757,17 +757,7 @@ Result<bool> Detector::getUseReceiverFlag(Positions pos) const {
} }
Result<std::string> Detector::getRxHostname(const int udpInterface, Positions pos) const { Result<std::string> Detector::getRxHostname(const int udpInterface, Positions pos) const {
// switch (udpInterface) { return pimpl->getRxHostname(pos, udpInterface);
// case 1:
// return pimpl->Parallel1(&Receiver::getHostname, pos, {});
// case 2:
// return pimpl->Parallel2(&Receiver::getHostname, pos, {});
// default:
// throw RuntimeError("Invalid udp interface number " +
// std::to_string(udpInterface));
// }
return pimpl->getHostname(pos, udpInterface);
// return experimental::Parallel(&Receiver::getHostname, receivers, MaskGenerator(){receivers});
} }
void Detector::setRxHostname(const int udpInterface, const std::string &hostname, Positions pos) { void Detector::setRxHostname(const int udpInterface, const std::string &hostname, Positions pos) {
@ -783,21 +773,14 @@ void Detector::setRxHostname(const int udpInterface, const std::string &hostname
} }
Result<int> Detector::getRxPort(const int udpInterface, Positions pos) const { Result<int> Detector::getRxPort(const int udpInterface, Positions pos) const {
switch (udpInterface) { return pimpl->getRxPort(pos, udpInterface);
case 1:
return pimpl->Parallel1(&Receiver::getTCPPort, pos, {});
case 2:
return pimpl->Parallel2(&Receiver::getTCPPort, pos, {});
default:
throw RuntimeError("Invalid udp interface number " +
std::to_string(udpInterface));
}
} }
void Detector::setRxPort(const int udpInterface, int port, int module_id) { void Detector::setRxPort(const int udpInterface, int port, int module_id) {
if (!pimpl->isReceiverInitialized(udpInterface)) { if (!pimpl->isReceiverInitialized(udpInterface)) {
pimpl->initReceiver(udpInterface); pimpl->initReceiver(udpInterface);
} }
// return pimpl->setRxPort();
if (udpInterface == 1) { if (udpInterface == 1) {
if (module_id == -1) { if (module_id == -1) {
for (int idet = 0; idet < size(); ++idet) { for (int idet = 0; idet < size(); ++idet) {

View File

@ -315,9 +315,12 @@ void DetectorImpl::setHostname(const std::vector<std::string> &name) {
updateDetectorSize(); updateDetectorSize();
} }
Result<std::string> DetectorImpl::getHostname(Positions pos, int udp_interface){ Result<std::string> DetectorImpl::getRxHostname(Positions pos, int udpInterface){
LOG(logWARNING) << ToString(pos) << ": " << udp_interface; return experimental::Parallel(&Receiver::getHostname, receivers, MaskGenerator(pos, udpInterface).mask(receivers));
return experimental::Parallel(&Receiver::getHostname, receivers, MaskGenerator(pos, udp_interface).mask(receivers)); }
Result<int> DetectorImpl::getRxPort(Positions pos, int udpInterface){
return experimental::Parallel(&Receiver::getTCPPort, receivers, MaskGenerator(pos, udpInterface).mask(receivers));
} }
void DetectorImpl::setHostname(const std::vector<std::string> &name, void DetectorImpl::setHostname(const std::vector<std::string> &name,

View File

@ -304,7 +304,8 @@ class DetectorImpl : public virtual slsDetectorDefs {
void setHostname(const std::vector<std::string> &name, void setHostname(const std::vector<std::string> &name,
const std::vector<int> &port); const std::vector<int> &port);
Result<std::string> getHostname(Positions pos, int udp_interface); Result<std::string> getRxHostname(Positions pos, int udpInterface);
Result<int> getRxPort(Positions pos, int udpInterface);
int getNumberofReceiversPerModule() const; int getNumberofReceiversPerModule() const;
void initReceiver(const int udpInterface); void initReceiver(const int udpInterface);