mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +02:00
shadowing variables
This commit is contained in:
parent
cbacf471d6
commit
33f726ff7e
@ -2293,7 +2293,7 @@ const slsDetectorDefs::ROI *multiSlsDetector::getROI(int &n, int detPos) {
|
||||
|
||||
// multi
|
||||
n = 0;
|
||||
int num = 0, i, j;
|
||||
int num = 0;
|
||||
int ndet = detectors.size();
|
||||
int maxroi = ndet * MAX_ROIS;
|
||||
ROI temproi;
|
||||
@ -2309,7 +2309,7 @@ const slsDetectorDefs::ROI *multiSlsDetector::getROI(int &n, int detPos) {
|
||||
if (index) {
|
||||
FILE_LOG(logINFO) << "detector " << idet << ":";
|
||||
}
|
||||
for (j = 0; j < index; ++j) {
|
||||
for (int j = 0; j < index; ++j) {
|
||||
FILE_LOG(logINFO) << temp[j].xmin << "\t" << temp[j].xmax << "\t" << temp[j].ymin
|
||||
<< "\t" << temp[j].ymax;
|
||||
int x = detectors[idet]->getDetectorOffset(X);
|
||||
@ -2335,12 +2335,12 @@ const slsDetectorDefs::ROI *multiSlsDetector::getROI(int &n, int detPos) {
|
||||
}
|
||||
|
||||
// combine all the adjacent rois in x direction
|
||||
for (i = 0; i < n; ++i) {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
// since the ones combined are replaced by -1
|
||||
if ((roiLimits[i].xmin) == -1) {
|
||||
continue;
|
||||
}
|
||||
for (j = i + 1; j < n; ++j) {
|
||||
for (int j = i + 1; j < n; ++j) {
|
||||
// since the ones combined are replaced by -1
|
||||
if ((roiLimits[j].xmin) == -1) {
|
||||
continue;
|
||||
@ -2368,19 +2368,19 @@ const slsDetectorDefs::ROI *multiSlsDetector::getROI(int &n, int detPos) {
|
||||
}
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1) << "Combined along x axis Getting ROI :\ndetector " << i;
|
||||
FILE_LOG(logDEBUG1) << "Combined along x axis Getting ROI :\ndetector " << n;
|
||||
for (int j = 0; j < n; ++j) {
|
||||
FILE_LOG(logDEBUG1) << roiLimits[j].xmin << "\t" << roiLimits[j].xmax << "\t"
|
||||
<< roiLimits[j].ymin << "\t" << roiLimits[j].ymax;
|
||||
}
|
||||
|
||||
// combine all the adjacent rois in y direction
|
||||
for (i = 0; i < n; ++i) {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
// since the ones combined are replaced by -1
|
||||
if ((roiLimits[i].ymin) == -1) {
|
||||
continue;
|
||||
}
|
||||
for (j = i + 1; j < n; ++j) {
|
||||
for (int j = i + 1; j < n; ++j) {
|
||||
// since the ones combined are replaced by -1
|
||||
if ((roiLimits[j].ymin) == -1) {
|
||||
continue;
|
||||
@ -2409,15 +2409,15 @@ const slsDetectorDefs::ROI *multiSlsDetector::getROI(int &n, int detPos) {
|
||||
}
|
||||
|
||||
// get rid of -1s
|
||||
for (i = 0; i < n; ++i) {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if ((roiLimits[i].xmin) != -1) {
|
||||
retval[num] = roiLimits[i];
|
||||
++num;
|
||||
}
|
||||
}
|
||||
// sort final roi
|
||||
for (i = 0; i < num; ++i) {
|
||||
for (j = i + 1; j < num; ++j) {
|
||||
for (int i = 0; i < num; ++i) {
|
||||
for (int j = i + 1; j < num; ++j) {
|
||||
if (retval[j].xmin < retval[i].xmin) {
|
||||
temproi = retval[i];
|
||||
retval[i] = retval[j];
|
||||
@ -2428,7 +2428,7 @@ const slsDetectorDefs::ROI *multiSlsDetector::getROI(int &n, int detPos) {
|
||||
n = num;
|
||||
|
||||
FILE_LOG(logDEBUG1) << "\nxmin\txmax\tymin\tymax";
|
||||
for (i = 0; i < n; ++i) {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
FILE_LOG(logDEBUG1) << retval[i].xmin << "\t" << retval[i].xmax << "\t" << retval[i].ymin
|
||||
<< "\t" << retval[i].ymax;
|
||||
}
|
||||
@ -2525,8 +2525,8 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
|
||||
|
||||
// update data bytes incl gap pixels
|
||||
if (val != -1) {
|
||||
auto r = serialCall(&slsDetector::getDataBytesInclGapPixels);
|
||||
multi_shm()->dataBytesInclGapPixels = sls::sum(r);
|
||||
auto r2 = serialCall(&slsDetector::getDataBytesInclGapPixels);
|
||||
multi_shm()->dataBytesInclGapPixels = sls::sum(r2);
|
||||
|
||||
// update
|
||||
updateOffsets();
|
||||
|
@ -2553,7 +2553,7 @@ std::string slsDetector::setAdditionalJsonParameter(const std::string &key,
|
||||
std::string slsDetector::getAdditionalJsonParameter(const std::string &key) {
|
||||
// additional json header is empty
|
||||
if (!strlen(detector_shm()->receiver_additionalJsonHeader))
|
||||
return std::string("");
|
||||
return std::string();
|
||||
|
||||
// add quotations before and after the key value
|
||||
std::string keyLiteral = key;
|
||||
@ -2575,7 +2575,7 @@ std::string slsDetector::getAdditionalJsonParameter(const std::string &key) {
|
||||
}
|
||||
|
||||
// return empty string as no match found with key
|
||||
return std::string("");
|
||||
return std::string();
|
||||
}
|
||||
|
||||
int64_t slsDetector::setReceiverUDPSocketBufferSize(int64_t udpsockbufsize) {
|
||||
|
@ -106,8 +106,8 @@ TEST_CASE("Set ROI", "[detector]") {
|
||||
slsDetector d(slsDetectorDefs::detectorType::EIGER, 0, 0);
|
||||
|
||||
int n{0};
|
||||
auto res = d.getROI(n);
|
||||
// CHECK(n == 0);
|
||||
d.getROI(n);
|
||||
CHECK(n == 0);
|
||||
CHECK(d.getNRoi() == 0);
|
||||
|
||||
// set one ROI
|
||||
|
@ -472,38 +472,38 @@ class slsReceiverImplementation: private virtual slsDetectorDefs {
|
||||
* @param i ROI
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setROI(const std::vector<ROI> i);
|
||||
int setROI(const std::vector<ROI> new_roi);
|
||||
|
||||
/**
|
||||
* Set the streaming frequency
|
||||
* @param freq 0 for timer, n for nth frame frequency
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setStreamingFrequency(const uint32_t freq);
|
||||
/**
|
||||
* Set the streaming frequency
|
||||
* @param freq 0 for timer, n for nth frame frequency
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setStreamingFrequency(const uint32_t freq);
|
||||
|
||||
/**
|
||||
* Sets the timer between frames streamed when frequency is set to 0
|
||||
* @param time_in_ms timer between frames streamed
|
||||
*/
|
||||
void setStreamingTimer(const uint32_t time_in_ms);
|
||||
/**
|
||||
* Set the data stream enable
|
||||
* @param enable data stream enable
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setDataStreamEnable(const bool enable);
|
||||
/**
|
||||
* Sets the timer between frames streamed when frequency is set to 0
|
||||
* @param time_in_ms timer between frames streamed
|
||||
*/
|
||||
void setStreamingTimer(const uint32_t time_in_ms);
|
||||
/**
|
||||
* Set the data stream enable
|
||||
* @param enable data stream enable
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int setDataStreamEnable(const bool enable);
|
||||
|
||||
/**
|
||||
* Set streaming port
|
||||
* @param i streaming port
|
||||
*/
|
||||
void setStreamingPort(const uint32_t i);
|
||||
/**
|
||||
* Set streaming port
|
||||
* @param i streaming port
|
||||
*/
|
||||
void setStreamingPort(const uint32_t i);
|
||||
|
||||
/**
|
||||
* Set streaming source ip
|
||||
* @param c streaming source ip
|
||||
*/
|
||||
void setStreamingSourceIP(const char* c);
|
||||
/**
|
||||
* Set streaming source ip
|
||||
* @param c streaming source ip
|
||||
*/
|
||||
void setStreamingSourceIP(const char *c);
|
||||
|
||||
/**
|
||||
* Set additional json header
|
||||
|
@ -737,40 +737,38 @@ int slsReceiverImplementation::setUDPSocketBufferSize(const int64_t s) {
|
||||
|
||||
|
||||
/***acquisition parameters***/
|
||||
int slsReceiverImplementation::setROI(const std::vector<slsDetectorDefs::ROI> i) {
|
||||
int slsReceiverImplementation::setROI(const std::vector<slsDetectorDefs::ROI> new_roi) {
|
||||
bool change = false;
|
||||
if (roi.size() != i.size())
|
||||
change = true;
|
||||
if (roi.size() != new_roi.size())
|
||||
change = true;
|
||||
else {
|
||||
for (unsigned int iloop = 0; iloop < i.size(); ++iloop) {
|
||||
if (
|
||||
(roi[iloop].xmin != i[iloop].xmin) ||
|
||||
(roi[iloop].xmax != i[iloop].xmax) ||
|
||||
(roi[iloop].ymin != i[iloop].ymin) ||
|
||||
(roi[iloop].xmax != i[iloop].xmax)) {
|
||||
change = true;
|
||||
break;
|
||||
}
|
||||
for (size_t i = 0; i != new_roi.size(); ++i) {
|
||||
if ((roi[i].xmin != new_roi[i].xmin) ||
|
||||
(roi[i].xmax != new_roi[i].xmax) ||
|
||||
(roi[i].ymin != new_roi[i].ymin) ||
|
||||
(roi[i].xmax != new_roi[i].xmax)) {
|
||||
change = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (change) {
|
||||
|
||||
roi = i;
|
||||
|
||||
switch(myDetectorType) {
|
||||
case GOTTHARD:
|
||||
generalData->SetROI(i);
|
||||
framesPerFile = generalData->maxFramesPerFile;
|
||||
break;
|
||||
case MOENCH:
|
||||
generalData->setImageSize(roi, numberOfSamples, tengigaEnable);
|
||||
break;
|
||||
case CHIPTESTBOARD:
|
||||
generalData->setImageSize(roi, numberOfSamples, tengigaEnable, readoutFlags);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
roi = new_roi;
|
||||
switch (myDetectorType) {
|
||||
case GOTTHARD:
|
||||
generalData->SetROI(new_roi);
|
||||
framesPerFile = generalData->maxFramesPerFile;
|
||||
break;
|
||||
case MOENCH:
|
||||
generalData->setImageSize(roi, numberOfSamples, tengigaEnable);
|
||||
break;
|
||||
case CHIPTESTBOARD:
|
||||
generalData->setImageSize(roi, numberOfSamples, tengigaEnable,
|
||||
readoutFlags);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
for (const auto& it : dataProcessor)
|
||||
it->SetPixelDimension();
|
||||
@ -784,7 +782,7 @@ int slsReceiverImplementation::setROI(const std::vector<slsDetectorDefs::ROI> i)
|
||||
if (!roi.size())
|
||||
sstm << "0";
|
||||
else {
|
||||
for (unsigned int i = 0; i < roi.size(); ++i) {
|
||||
for (size_t i = 0; i < roi.size(); ++i) {
|
||||
sstm << "( " <<
|
||||
roi[i].xmin << ", " <<
|
||||
roi[i].xmax << ", " <<
|
||||
|
@ -789,7 +789,7 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
||||
receiver->setUDPPortNumber2(port2);
|
||||
FILE_LOG(logINFO) << "Receiver UDP IP 2: " << ip2;
|
||||
// get eth
|
||||
std::string temp = genericSocket::ipToName(ip2);
|
||||
temp = genericSocket::ipToName(ip2);
|
||||
if (temp == "none"){
|
||||
ret = FAIL;
|
||||
strcpy(mess, "Failed to get 2nd ethernet interface or IP \n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user