hacky version compiles

This commit is contained in:
2021-09-13 15:45:46 +02:00
parent 9d4d667df1
commit 7d4e2470a3
4 changed files with 577 additions and 323 deletions

View File

@ -680,48 +680,60 @@ class Detector {
/**[Jungfrau] Options 0-31 (or number of udp destinations) */
void setFirstUDPDestination(const int value, Positions pos = {});
Result<IpAddr> getDestinationUDPIP(Positions pos = {}) const;
Result<IpAddr> getDestinationUDPIP(Positions pos = {},
const int rx_index = 0) const;
/** IP of the interface in receiver that the detector sends data to */
void setDestinationUDPIP(const IpAddr ip, Positions pos = {});
void setDestinationUDPIP(const IpAddr ip, Positions pos = {},
const int rx_index = 0);
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
Result<IpAddr> getDestinationUDPIP2(Positions pos = {}) const;
Result<IpAddr> getDestinationUDPIP2(Positions pos = {},
const int rx_index = 0) const;
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
void setDestinationUDPIP2(const IpAddr ip, Positions pos = {});
void setDestinationUDPIP2(const IpAddr ip, Positions pos = {},
const int rx_index = 0);
Result<MacAddr> getDestinationUDPMAC(Positions pos = {}) const;
Result<MacAddr> getDestinationUDPMAC(Positions pos = {},
const int rxIndex = 0) const;
/** Mac address of the receiver (destination) udp interface. Not mandatory
* to set as setDestinationUDPIP (udp_dstip) retrieves it from slsReceiver
* process but must be set if you use a custom receiver (not slsReceiver).
*/
void setDestinationUDPMAC(const MacAddr mac, Positions pos = {});
void setDestinationUDPMAC(const MacAddr mac, Positions pos = {},
const int rx_index = 0);
/** [Jungfrau] bottom half \n [Gotthard2] veto debugging */
Result<MacAddr> getDestinationUDPMAC2(Positions pos = {}) const;
Result<MacAddr> getDestinationUDPMAC2(Positions pos = {},
const int rx_index = 0) const;
/* [Jungfrau][Gotthard2] Mac address of the receiver (destination) udp
interface 2. \n Not mandatory to set as udp_dstip2 retrieves it from
slsReceiver process but must be set if you use a custom receiver (not
slsReceiver). \n [Jungfrau] bottom half \n [Gotthard2] veto debugging \n
*/
void setDestinationUDPMAC2(const MacAddr mac, Positions pos = {});
void setDestinationUDPMAC2(const MacAddr mac, Positions pos = {},
const int rx_index = 0);
Result<int> getDestinationUDPPort(Positions pos = {}) const;
Result<int> getDestinationUDPPort(Positions pos = {},
const int rx_index = 0) const;
/** Default is 50001. \n If module_id is -1, ports for each module is
* calculated (incremented by 1 if no 2nd interface) */
void setDestinationUDPPort(int port, int module_id = -1);
void setDestinationUDPPort(int port, int module_id = -1,
const int rxIndex = 0);
/** [Eiger] right port[Jungfrau] bottom half [Gotthard2] veto debugging */
Result<int> getDestinationUDPPort2(Positions pos = {}) const;
Result<int> getDestinationUDPPort2(Positions pos = {},
const int rx_index = 0) const;
/** [Eiger] right port[Jungfrau] bottom half [Gotthard2] veto debugging \n
* Default is 50002. \n If module_id is -1, ports for each module is
* calculated (incremented by 1 if no 2nd interface)*/
void setDestinationUDPPort2(int port, int module_id = -1);
void setDestinationUDPPort2(int port, int module_id = -1,
const int rxIndex = 0);
/** Reconfigures Detector with UDP destination. More for debugging as the
* configuration is done automatically when the detector has sufficient UDP
@ -733,7 +745,8 @@ class Detector {
* information */
void validateUDPConfiguration(Positions pos = {});
Result<std::string> printRxConfiguration(Positions pos = {}) const;
Result<std::string> printRxConfiguration(Positions pos = {},
const int rx_index = 0) const;
/** [Eiger][CTB][Moench][Mythen3] */
Result<bool> getTenGiga(Positions pos = {}) const;
@ -792,7 +805,8 @@ class Detector {
/** true when slsReceiver is used */
Result<bool> getUseReceiverFlag(Positions pos = {}) const;
Result<std::string> getRxHostname(Positions pos = {}) const;
Result<std::string> getRxHostname(Positions pos = {},
const int rx_index = 0) const;
/**
* Sets receiver hostname or IP address for each module. \n Used for TCP
@ -801,19 +815,21 @@ class Detector {
* receiver property (not on detector). \n receiver is receiver hostname or
* IP address, can include tcp port eg. hostname:port
*/
void setRxHostname(const std::string &receiver, Positions pos = {});
void setRxHostname(const std::string &receiver, Positions pos = {},
const int rx_index = 0);
/** multiple rx hostnames. Single element will set it for all */
void setRxHostname(const std::vector<std::string> &name);
void setRxHostname(const std::vector<std::string> &name,
const int rx_index = 0);
Result<int> getRxPort(Positions pos = {}) const;
Result<int> getRxPort(Positions pos = {}, const int rx_index = 0) const;
/** TCP port for client-receiver communication. \n
* Default is 1954. \n Must be different if multiple receivers on same pc.
* \n Must be first command to set a receiver parameter to be able to
* communicate. \n Multi command will automatically increment port for
* individual modules.*/
void setRxPort(int port, int module_id = -1);
void setRxPort(int port, int module_id = -1, const int rx_index = 0);
Result<int> getRxFifoDepth(Positions pos = {}) const;
@ -989,7 +1005,8 @@ class Detector {
* Also restarts receiver zmq streaming if enabled. \n Default is from
* rx_hostname. \n Modified only when using an intermediate process between
* receiver. */
void setRxZmqIP(const IpAddr ip, Positions pos = {});
void setRxZmqIP(const IpAddr ip, Positions pos = {},
const int rx_index = 0);
Result<int> getClientZmqPort(Positions pos = {}) const;

View File

@ -933,67 +933,81 @@ void Detector::setFirstUDPDestination(const int value, Positions pos) {
pimpl->Parallel(&Module::setFirstUDPDestination, pos, value);
}
Result<IpAddr> Detector::getDestinationUDPIP(Positions pos) const {
return pimpl->Parallel(&Module::getDestinationUDPIP, pos);
Result<IpAddr> Detector::getDestinationUDPIP(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getDestinationUDPIP, pos, rx_index);
}
void Detector::setDestinationUDPIP(const IpAddr ip, Positions pos) {
pimpl->Parallel(&Module::setDestinationUDPIP, pos, ip);
void Detector::setDestinationUDPIP(const IpAddr ip, Positions pos,
const int rx_index) {
pimpl->Parallel(&Module::setDestinationUDPIP, pos, ip, rx_index);
}
Result<IpAddr> Detector::getDestinationUDPIP2(Positions pos) const {
return pimpl->Parallel(&Module::getDestinationUDPIP2, pos);
Result<IpAddr> Detector::getDestinationUDPIP2(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getDestinationUDPIP2, pos, rx_index);
}
void Detector::setDestinationUDPIP2(const IpAddr ip, Positions pos) {
pimpl->Parallel(&Module::setDestinationUDPIP2, pos, ip);
void Detector::setDestinationUDPIP2(const IpAddr ip, Positions pos,
const int rx_index) {
pimpl->Parallel(&Module::setDestinationUDPIP2, pos, ip, rx_index);
}
Result<MacAddr> Detector::getDestinationUDPMAC(Positions pos) const {
return pimpl->Parallel(&Module::getDestinationUDPMAC, pos);
Result<MacAddr> Detector::getDestinationUDPMAC(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getDestinationUDPMAC, pos, rx_index);
}
void Detector::setDestinationUDPMAC(const MacAddr mac, Positions pos) {
pimpl->Parallel(&Module::setDestinationUDPMAC, pos, mac);
void Detector::setDestinationUDPMAC(const MacAddr mac, Positions pos,
const int rx_index) {
pimpl->Parallel(&Module::setDestinationUDPMAC, pos, mac, rx_index);
}
Result<MacAddr> Detector::getDestinationUDPMAC2(Positions pos) const {
return pimpl->Parallel(&Module::getDestinationUDPMAC2, pos);
Result<MacAddr> Detector::getDestinationUDPMAC2(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getDestinationUDPMAC2, pos, rx_index);
}
void Detector::setDestinationUDPMAC2(const MacAddr mac, Positions pos) {
pimpl->Parallel(&Module::setDestinationUDPMAC2, pos, mac);
void Detector::setDestinationUDPMAC2(const MacAddr mac, Positions pos,
const int rx_index) {
pimpl->Parallel(&Module::setDestinationUDPMAC2, pos, mac, rx_index);
}
Result<int> Detector::getDestinationUDPPort(Positions pos) const {
return pimpl->Parallel(&Module::getDestinationUDPPort, pos);
Result<int> Detector::getDestinationUDPPort(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getDestinationUDPPort, pos, rx_index);
}
void Detector::setDestinationUDPPort(int port, int module_id) {
void Detector::setDestinationUDPPort(int port, int module_id,
const int rx_index) {
if (module_id == -1) {
std::vector<int> port_list = getPortNumbers(port);
for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&Module::setDestinationUDPPort, {idet},
port_list[idet]);
port_list[idet], rx_index);
}
} else {
pimpl->Parallel(&Module::setDestinationUDPPort, {module_id}, port);
pimpl->Parallel(&Module::setDestinationUDPPort, {module_id}, port,
rx_index);
}
}
Result<int> Detector::getDestinationUDPPort2(Positions pos) const {
return pimpl->Parallel(&Module::getDestinationUDPPort2, pos);
Result<int> Detector::getDestinationUDPPort2(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getDestinationUDPPort2, pos, rx_index);
}
void Detector::setDestinationUDPPort2(int port, int module_id) {
void Detector::setDestinationUDPPort2(int port, int module_id,
const int rx_index) {
if (module_id == -1) {
std::vector<int> port_list = getPortNumbers(port);
for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&Module::setDestinationUDPPort2, {idet},
port_list[idet]);
port_list[idet], rx_index);
}
} else {
pimpl->Parallel(&Module::setDestinationUDPPort2, {module_id}, port);
pimpl->Parallel(&Module::setDestinationUDPPort2, {module_id}, port,
rx_index);
}
}
@ -1005,8 +1019,9 @@ void Detector::validateUDPConfiguration(Positions pos) {
pimpl->Parallel(&Module::validateUDPConfiguration, pos);
}
Result<std::string> Detector::printRxConfiguration(Positions pos) const {
return pimpl->Parallel(&Module::printReceiverConfiguration, pos);
Result<std::string> Detector::printRxConfiguration(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::printReceiverConfiguration, pos, rx_index);
}
Result<bool> Detector::getTenGiga(Positions pos) const {
@ -1055,19 +1070,22 @@ Result<bool> Detector::getUseReceiverFlag(Positions pos) const {
return pimpl->Parallel(&Module::getUseReceiverFlag, pos);
}
Result<std::string> Detector::getRxHostname(Positions pos) const {
return pimpl->Parallel(&Module::getReceiverHostname, pos);
Result<std::string> Detector::getRxHostname(Positions pos,
const int rx_index) const {
return pimpl->Parallel(&Module::getReceiverHostname, pos, rx_index);
}
void Detector::setRxHostname(const std::string &receiver, Positions pos) {
pimpl->Parallel(&Module::setReceiverHostname, pos, receiver);
void Detector::setRxHostname(const std::string &receiver, Positions pos,
const int rx_index) {
pimpl->Parallel(&Module::setReceiverHostname, pos, receiver, rx_index);
updateRxRateCorrections();
}
void Detector::setRxHostname(const std::vector<std::string> &name) {
void Detector::setRxHostname(const std::vector<std::string> &name,
const int rx_index) {
// set all to same rx_hostname
if (name.size() == 1) {
pimpl->Parallel(&Module::setReceiverHostname, {}, name[0]);
pimpl->Parallel(&Module::setReceiverHostname, {}, name[0], rx_index);
} else {
if ((int)name.size() != size()) {
throw RuntimeError(
@ -1076,27 +1094,29 @@ void Detector::setRxHostname(const std::vector<std::string> &name) {
}
// set each rx_hostname
for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&Module::setReceiverHostname, {idet}, name[idet]);
pimpl->Parallel(&Module::setReceiverHostname, {idet}, name[idet],
rx_index);
}
}
updateRxRateCorrections();
}
Result<int> Detector::getRxPort(Positions pos) const {
return pimpl->Parallel(&Module::getReceiverPort, pos);
Result<int> Detector::getRxPort(Positions pos, const int rx_index) const {
return pimpl->Parallel(&Module::getReceiverPort, pos, rx_index);
}
void Detector::setRxPort(int port, int module_id) {
void Detector::setRxPort(int port, int module_id, const int rx_index) {
if (module_id == -1) {
std::vector<int> port_list(size());
for (auto &it : port_list) {
it = port++;
}
for (int idet = 0; idet < size(); ++idet) {
pimpl->Parallel(&Module::setReceiverPort, {idet}, port_list[idet]);
pimpl->Parallel(&Module::setReceiverPort, {idet}, port_list[idet],
rx_index);
}
} else {
pimpl->Parallel(&Module::setReceiverPort, {module_id}, port);
pimpl->Parallel(&Module::setReceiverPort, {module_id}, port, rx_index);
}
}
@ -1290,9 +1310,9 @@ Result<IpAddr> Detector::getRxZmqIP(Positions pos) const {
return pimpl->Parallel(&Module::getReceiverStreamingIP, pos);
}
void Detector::setRxZmqIP(const IpAddr ip, Positions pos) {
void Detector::setRxZmqIP(const IpAddr ip, Positions pos, const int rx_index) {
bool previouslyReceiverStreaming = getRxZmqDataStream(pos).squash(false);
pimpl->Parallel(&Module::setReceiverStreamingIP, pos, ip);
pimpl->Parallel(&Module::setReceiverStreamingIP, pos, ip, rx_index);
if (previouslyReceiverStreaming) {
setRxZmqDataStream(false, pos);
setRxZmqDataStream(true, pos);

File diff suppressed because it is too large Load Diff

View File

@ -15,10 +15,15 @@
class ServerInterface;
#define SLS_SHMAPIVERSION 0x190726
#define SLS_SHMVERSION 0x200402
#define SLS_SHMVERSION 0x210913
namespace sls {
struct sharedReceiver {
char hostname[MAX_STR_LENGTH]{};
int tcpPort{};
};
/**
* @short structure allocated in shared memory to store detector settings for
* IPC and cache
@ -43,8 +48,11 @@ struct sharedSlsDetector {
slsDetectorDefs::xy nChan;
slsDetectorDefs::xy nChip;
int nDacs;
char rxHostname[MAX_STR_LENGTH];
int rxTCPPort;
/** receiver details for each module */
int numReceivers;
sharedReceiver receivers[MAX_UDP_DESTINATION];
/** if rxHostname and rxTCPPort can be connected to */
bool useReceiverFlag;
/** Listening tcp port from gui (only data) */
@ -227,21 +235,21 @@ class Module : public virtual slsDetectorDefs {
void setNumberofUDPDestinations(const int value);
int getFirstUDPDestination() const;
void setFirstUDPDestination(const int value);
sls::IpAddr getDestinationUDPIP() const;
void setDestinationUDPIP(const sls::IpAddr ip);
sls::IpAddr getDestinationUDPIP2() const;
void setDestinationUDPIP2(const sls::IpAddr ip);
sls::MacAddr getDestinationUDPMAC() const;
void setDestinationUDPMAC(const sls::MacAddr mac);
sls::MacAddr getDestinationUDPMAC2() const;
void setDestinationUDPMAC2(const sls::MacAddr mac);
int getDestinationUDPPort() const;
void setDestinationUDPPort(int udpport);
int getDestinationUDPPort2() const;
void setDestinationUDPPort2(int udpport);
sls::IpAddr getDestinationUDPIP(const int rxIndex) const;
void setDestinationUDPIP(const sls::IpAddr ip, const int rxIndex);
sls::IpAddr getDestinationUDPIP2(const int rxIndex) const;
void setDestinationUDPIP2(const sls::IpAddr ip, const int rxIndex);
sls::MacAddr getDestinationUDPMAC(const int rxIndex) const;
void setDestinationUDPMAC(const sls::MacAddr mac, const int rxIndex);
sls::MacAddr getDestinationUDPMAC2(const int rxIndex) const;
void setDestinationUDPMAC2(const sls::MacAddr mac, const int rxIndex);
int getDestinationUDPPort(const int rxIndex) const;
void setDestinationUDPPort(int udpport, const int rxIndex);
int getDestinationUDPPort2(const int rxIndex) const;
void setDestinationUDPPort2(int udpport, const int rxIndex);
void reconfigureUDPDestination();
void validateUDPConfiguration();
std::string printReceiverConfiguration();
std::string printReceiverConfiguration(const int rxIndex);
bool getTenGiga() const;
void setTenGiga(bool value);
bool getTenGigaFlowControl() const;
@ -259,10 +267,10 @@ class Module : public virtual slsDetectorDefs {
* *
* ************************************************/
bool getUseReceiverFlag() const;
std::string getReceiverHostname() const;
void setReceiverHostname(const std::string &receiver);
int getReceiverPort() const;
int setReceiverPort(int port_number);
std::string getReceiverHostname(const int rxIndex) const;
void setReceiverHostname(const std::string &receiver, const int rxIndex);
int getReceiverPort(const int rxIndex) const;
int setReceiverPort(int port_number, const int rxIndex);
int getReceiverFifoDepth() const;
void setReceiverFifoDepth(int n_frames);
bool getReceiverSilentMode() const;
@ -320,7 +328,7 @@ class Module : public virtual slsDetectorDefs {
int getReceiverStreamingPort() const;
void setReceiverStreamingPort(int port);
sls::IpAddr getReceiverStreamingIP() const;
void setReceiverStreamingIP(const sls::IpAddr ip);
void setReceiverStreamingIP(const sls::IpAddr ip, const int rxIndex);
int getClientStreamingPort() const;
void setClientStreamingPort(int port);
sls::IpAddr getClientStreamingIP() const;
@ -656,43 +664,51 @@ class Module : public virtual slsDetectorDefs {
Ret sendToDetectorStop(int fnum, const Arg &args) const;
/** Send function parameters to receiver */
void sendToReceiver(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size);
void sendToReceiver(const int rxIndex, int fnum, const void *args,
size_t args_size, void *retval, size_t retval_size);
void sendToReceiver(int fnum, const void *args, size_t args_size,
void *retval, size_t retval_size) const;
void sendToReceiver(const int rxIndex, int fnum, const void *args,
size_t args_size, void *retval,
size_t retval_size) const;
template <typename Arg, typename Ret>
void sendToReceiver(int fnum, const Arg &args, Ret &retval);
void sendToReceiver(const int rxIndex, int fnum, const Arg &args,
Ret &retval);
template <typename Arg, typename Ret>
void sendToReceiver(int fnum, const Arg &args, Ret &retval) const;
void sendToReceiver(const int rxIndex, int fnum, const Arg &args,
Ret &retval) const;
template <typename Arg>
void sendToReceiver(int fnum, const Arg &args, std::nullptr_t);
void sendToReceiver(const int rxIndex, int fnum, const Arg &args,
std::nullptr_t);
template <typename Arg>
void sendToReceiver(int fnum, const Arg &args, std::nullptr_t) const;
void sendToReceiver(const int rxIndex, int fnum, const Arg &args,
std::nullptr_t) const;
template <typename Ret>
void sendToReceiver(int fnum, std::nullptr_t, Ret &retval);
void sendToReceiver(const int rxIndex, int fnum, std::nullptr_t,
Ret &retval);
template <typename Ret>
void sendToReceiver(int fnum, std::nullptr_t, Ret &retval) const;
void sendToReceiver(const int rxIndex, int fnum, std::nullptr_t,
Ret &retval) const;
template <typename Ret> Ret sendToReceiver(int fnum);
template <typename Ret> Ret sendToReceiver(const int rxIndex, int fnum);
template <typename Ret> Ret sendToReceiver(int fnum) const;
template <typename Ret>
Ret sendToReceiver(const int rxIndex, int fnum) const;
void sendToReceiver(int fnum);
void sendToReceiver(const int rxIndex, int fnum);
void sendToReceiver(int fnum) const;
void sendToReceiver(const int rxIndex, int fnum) const;
template <typename Ret, typename Arg>
Ret sendToReceiver(int fnum, const Arg &args);
Ret sendToReceiver(const int rxIndex, int fnum, const Arg &args);
template <typename Ret, typename Arg>
Ret sendToReceiver(int fnum, const Arg &args) const;
Ret sendToReceiver(const int rxIndex, int fnum, const Arg &args) const;
/** Get Detector Type from Shared Memory
verify is if shm size matches existing one */
@ -710,7 +726,7 @@ class Module : public virtual slsDetectorDefs {
void checkReceiverVersionCompatibility();
void setModule(sls_detector_module &module, bool trimbits = true);
int sendModule(sls_detector_module *myMod, sls::ClientSocket &client);
void updateReceiverStreamingIP();
void updateReceiverStreamingIP(const int rxIndex);
void updateRateCorrection();
/** Template function to do linear interpolation between two points (Eiger