mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
link and format
This commit is contained in:
@ -49,10 +49,13 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|||||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
||||||
message(FATAL_ERROR "GCC version must be at least 4.8!")
|
message(FATAL_ERROR "GCC version must be at least 4.8!")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-misleading-indentation -Wno-stringop-truncation -Wno-class-memaccess")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Suppressed warnings in GCC
|
||||||
|
# -Wno-stringop-truncation happens when we do sls::strcpy_safe truncates string instead of overwrite buffer
|
||||||
|
# -Wno-class-memaccess - on memcpy in rapidjson should be investigated upgrade implementation?
|
||||||
|
# -Wno-misleading-indentation - until clang format
|
||||||
|
|
||||||
#set (CMAKE_CXX_STANDARD 11)
|
#set (CMAKE_CXX_STANDARD 11)
|
||||||
#set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
#set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
@ -23,7 +23,6 @@ target_include_directories(slsDetectorShared PUBLIC
|
|||||||
target_link_libraries(slsDetectorShared PUBLIC
|
target_link_libraries(slsDetectorShared PUBLIC
|
||||||
slsSupportLib
|
slsSupportLib
|
||||||
${ZeroMQ_LIBRARIES}
|
${ZeroMQ_LIBRARIES}
|
||||||
zmq
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PUBLICHEADERS
|
set(PUBLICHEADERS
|
||||||
|
@ -512,7 +512,6 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
|
|||||||
|
|
||||||
detectors[pos]->setHostname(hostname);
|
detectors[pos]->setHostname(hostname);
|
||||||
detectors[pos]->setOnline(true);
|
detectors[pos]->setOnline(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum(int detPos) {
|
slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum(int detPos) {
|
||||||
@ -1934,7 +1933,7 @@ std::string multiSlsDetector::getAdditionalJsonHeader(int detPos) {
|
|||||||
return sls::concatenateIfDifferent(r);
|
return sls::concatenateIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string multiSlsDetector::setAdditionalJsonParameter(const std::string& key, const std::string& value, int detPos) {
|
std::string multiSlsDetector::setAdditionalJsonParameter(const std::string &key, const std::string &value, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->setAdditionalJsonParameter(key, value);
|
return detectors[detPos]->setAdditionalJsonParameter(key, value);
|
||||||
@ -1945,7 +1944,7 @@ std::string multiSlsDetector::setAdditionalJsonParameter(const std::string& key,
|
|||||||
return sls::concatenateIfDifferent(r);
|
return sls::concatenateIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string multiSlsDetector::getAdditionalJsonParameter(const std::string& key, int detPos) {
|
std::string multiSlsDetector::getAdditionalJsonParameter(const std::string &key, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->getAdditionalJsonParameter(key);
|
return detectors[detPos]->getAdditionalJsonParameter(key);
|
||||||
@ -2116,8 +2115,8 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
int xmin, xmax, ymin, ymax, channelX, channelY, idet, lastChannelX,
|
int xmin = 0, xmax = 0, ymin = 0, ymax = 0, channelX = 0, channelY = 0, idet = 0, lastChannelX = 0,
|
||||||
lastChannelY, index, offsetX, offsetY;
|
lastChannelY = 0, index = 0, offsetX = 0, offsetY = 0;
|
||||||
|
|
||||||
bool invalidroi = false;
|
bool invalidroi = false;
|
||||||
int ndet = detectors.size();
|
int ndet = detectors.size();
|
||||||
@ -2149,7 +2148,7 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
|
|||||||
// check roi max values
|
// check roi max values
|
||||||
idet = decodeNChannel(xmax, ymax, channelX, channelY);
|
idet = decodeNChannel(xmax, ymax, channelX, channelY);
|
||||||
FILE_LOG(logDEBUG1) << "Decoded Channel max vals: " << std::endl
|
FILE_LOG(logDEBUG1) << "Decoded Channel max vals: " << std::endl
|
||||||
<< "det:" << idet << "\t" << xmax << "\t" << ymax << "\t" << channelX << "\t" << channelY;
|
<< "det:" << idet << "\t" << xmax << "\t" << ymax << "\t" << channelX << "\t" << channelY;
|
||||||
if (idet == -1) {
|
if (idet == -1) {
|
||||||
FILE_LOG(logERROR) << "invalid roi";
|
FILE_LOG(logERROR) << "invalid roi";
|
||||||
continue;
|
continue;
|
||||||
@ -2164,7 +2163,7 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
|
|||||||
// get offset for each detector
|
// get offset for each detector
|
||||||
idet = decodeNChannel(xmin, ymin, channelX, channelY);
|
idet = decodeNChannel(xmin, ymin, channelX, channelY);
|
||||||
FILE_LOG(logDEBUG1) << "Decoded Channel min vals: " << std::endl
|
FILE_LOG(logDEBUG1) << "Decoded Channel min vals: " << std::endl
|
||||||
<< "det:" << idet << "\t" << xmin << "\t" << ymin << "\t" << channelX << "\t" << channelY;
|
<< "det:" << idet << "\t" << xmin << "\t" << ymin << "\t" << channelX << "\t" << channelY;
|
||||||
if (idet < 0 || idet >= (int)detectors.size()) {
|
if (idet < 0 || idet >= (int)detectors.size()) {
|
||||||
FILE_LOG(logDEBUG1) << "invalid roi";
|
FILE_LOG(logDEBUG1) << "invalid roi";
|
||||||
invalidroi = true;
|
invalidroi = true;
|
||||||
@ -2172,13 +2171,13 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
|
|||||||
}
|
}
|
||||||
// get last channel for each det in x and y dir
|
// get last channel for each det in x and y dir
|
||||||
lastChannelX =
|
lastChannelX =
|
||||||
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
|
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
|
||||||
X)) -
|
X)) -
|
||||||
1;
|
1;
|
||||||
lastChannelY =
|
lastChannelY =
|
||||||
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
|
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
|
||||||
Y)) -
|
Y)) -
|
||||||
1;
|
1;
|
||||||
|
|
||||||
offsetX = detectors[idet]->getDetectorOffset(X);
|
offsetX = detectors[idet]->getDetectorOffset(X);
|
||||||
offsetY = detectors[idet]->getDetectorOffset(Y);
|
offsetY = detectors[idet]->getDetectorOffset(Y);
|
||||||
@ -2192,7 +2191,7 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1) << "lastChannelX:" << lastChannelX << "\t"
|
FILE_LOG(logDEBUG1) << "lastChannelX:" << lastChannelX << "\t"
|
||||||
<< "lastChannelY:" << lastChannelY;
|
<< "lastChannelY:" << lastChannelY;
|
||||||
|
|
||||||
// creating the list of roi for corresponding detector
|
// creating the list of roi for corresponding detector
|
||||||
index = nroi[idet];
|
index = nroi[idet];
|
||||||
@ -2218,16 +2217,15 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
|
|||||||
xmin = xmax + 1;
|
xmin = xmax + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {// FIXME: check if xmax is greater? or reduce logic above?
|
} else { // FIXME: check if xmax is greater? or reduce logic above?
|
||||||
idet=0;
|
idet = 0;
|
||||||
nroi[idet]=n;
|
nroi[idet] = n;
|
||||||
index = 0;
|
index = 0;
|
||||||
allroi[idet][index].xmin = xmin;
|
allroi[idet][index].xmin = xmin;
|
||||||
allroi[idet][index].xmax = xmax;
|
allroi[idet][index].xmax = xmax;
|
||||||
allroi[idet][index].ymin = ymin;
|
allroi[idet][index].ymin = ymin;
|
||||||
allroi[idet][index].ymax = ymax;
|
allroi[idet][index].ymax = ymax;
|
||||||
// nroi[idet] = nroi[idet] + 1;
|
// nroi[idet] = nroi[idet] + 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ Still this is better than strcpy and a buffer overflow...
|
|||||||
*/
|
*/
|
||||||
template <size_t array_size>
|
template <size_t array_size>
|
||||||
void strcpy_safe(char (&destination)[array_size], const char *source) {
|
void strcpy_safe(char (&destination)[array_size], const char *source) {
|
||||||
strncpy(destination, source, array_size);
|
strncpy(destination, source, array_size-1);
|
||||||
destination[array_size - 1] = '\0';
|
destination[array_size - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user