Merge branch 'refactor' of github.com:slsdetectorgroup/slsDetectorPackage into refactor

This commit is contained in:
2018-10-11 15:53:42 +02:00
4 changed files with 18 additions and 18 deletions

View File

@ -14,6 +14,9 @@ else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
endif () endif ()
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
find_package(Qt4) find_package(Qt4)
find_package(Qwt 6) find_package(Qwt 6)
find_package(CBF) find_package(CBF)

View File

@ -936,7 +936,7 @@ int multiSlsDetector::execCommand(std::string cmd, int detPos) {
} }
int multiSlsDetector::readConfigurationFile(std::string const fname) { int multiSlsDetector::readConfigurationFile(const std::string& fname) {
freeSharedMemory(); freeSharedMemory();
setupMultiDetector(); setupMultiDetector();
@ -1019,27 +1019,24 @@ int multiSlsDetector::readConfigurationFile(std::string const fname) {
} }
int multiSlsDetector::writeConfigurationFile(std::string const fname) { int multiSlsDetector::writeConfigurationFile(const std::string& fname) {
std::string names[] = { const std::vector<std::string> names = {
"detsizechan", "detsizechan",
"hostname", "hostname",
"outdir", "outdir",
"threaded" "threaded"
}; };
int nvar = 15;
char* args[100]; char* args[100];
for (int ia = 0; ia < 100; ++ia) { for (int ia = 0; ia < 100; ++ia) {
args[ia] = new char[1000]; args[ia] = new char[1000];
} }
int ret = OK, ret1 = OK; int ret = OK, ret1 = OK;
std::ofstream outfile; std::ofstream outfile;
int iline = 0; int iline = 0;
outfile.open(fname.c_str(), std::ios_base::out); outfile.open(fname.c_str(), std::ios_base::out);
if (outfile.is_open()) { if (outfile.is_open()) {
auto cmd = slsDetectorCommand(this); auto cmd = slsDetectorCommand(this);
// complete size of detector // complete size of detector
@ -1066,7 +1063,7 @@ int multiSlsDetector::writeConfigurationFile(std::string const fname) {
outfile << std::endl; outfile << std::endl;
//other configurations //other configurations
while (iline < nvar) { while (iline < names.size()) {
std::cout << iline << " " << names[iline] << std::endl; std::cout << iline << " " << names[iline] << std::endl;
strcpy(args[0], names[iline].c_str()); strcpy(args[0], names[iline].c_str());
outfile << names[iline] << " " << cmd.executeLine(1, args, GET_ACTION) << std::endl; outfile << names[iline] << " " << cmd.executeLine(1, args, GET_ACTION) << std::endl;
@ -1905,7 +1902,7 @@ int multiSlsDetector::digitalTest(digitalTestMode mode, int ival, int detPos) {
} }
int multiSlsDetector::loadImageToDetector(imageType index, std::string const fname, int detPos) { int multiSlsDetector::loadImageToDetector(imageType index, const std::string& fname, int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->loadImageToDetector(index, fname); return detectors[detPos]->loadImageToDetector(index, fname);
@ -1933,7 +1930,7 @@ int multiSlsDetector::loadImageToDetector(imageType index, std::string const fna
} }
int multiSlsDetector::writeCounterBlockFile(std::string const fname, int startACQ, int detPos) { int multiSlsDetector::writeCounterBlockFile(const std::string& fname, int startACQ, int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->writeCounterBlockFile(fname, startACQ); return detectors[detPos]->writeCounterBlockFile(fname, startACQ);
@ -3514,7 +3511,7 @@ int multiSlsDetector::setCTBPatWaitTime(int level, uint64_t t, int detPos) {
} }
int multiSlsDetector::retrieveDetectorSetup(std::string const fname1, int level){ int multiSlsDetector::retrieveDetectorSetup(const std::string& fname1, int level){
int skip=0; int skip=0;
std::string fname; std::string fname;
@ -3597,7 +3594,7 @@ int multiSlsDetector::retrieveDetectorSetup(std::string const fname1, int level)
} }
int multiSlsDetector::dumpDetectorSetup(std::string const fname, int level){ int multiSlsDetector::dumpDetectorSetup(const std::string& fname, int level){
detectorType type = getDetectorsType(); detectorType type = getDetectorsType();
std::string names[100]; std::string names[100];
int nvar=0; int nvar=0;

View File

@ -468,14 +468,14 @@ public:
* @param fname configuration file name * @param fname configuration file name
* @return OK or FAIL * @return OK or FAIL
*/ */
int readConfigurationFile(std::string const fname); int readConfigurationFile(const std::string& fname);
/** /**
* Write current configuration to a file * Write current configuration to a file
* @param fname configuration file name * @param fname configuration file name
* @returns OK or FAIL * @returns OK or FAIL
*/ */
int writeConfigurationFile(std::string const fname); int writeConfigurationFile(const std::string& fname);
/** /**
* Returns the trimfile or settings file name (Useless??) * Returns the trimfile or settings file name (Useless??)
@ -929,7 +929,7 @@ public:
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns OK or FAIL * @returns OK or FAIL
*/ */
int loadImageToDetector(imageType index,std::string const fname, int detPos = -1); int loadImageToDetector(imageType index, const std::string& fname, int detPos = -1);
/** /**
* Writes the counter memory block from the detector (Gotthard) * Writes the counter memory block from the detector (Gotthard)
@ -938,7 +938,7 @@ public:
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns OK or FAIL * @returns OK or FAIL
*/ */
int writeCounterBlockFile(std::string const fname,int startACQ=0, int detPos = -1); int writeCounterBlockFile(const std::string& fname,int startACQ=0, int detPos = -1);
/** /**
* Resets counter in detector (Gotthard) * Resets counter in detector (Gotthard)
@ -1516,7 +1516,7 @@ public:
* from files with default extensions as generated by dumpDetectorSetup * from files with default extensions as generated by dumpDetectorSetup
* @returns OK or FAIL * @returns OK or FAIL
*/ */
int retrieveDetectorSetup(std::string const fname, int level=0); int retrieveDetectorSetup(const std::string& fname, int level=0);
/** /**
* Saves the detector setup to file * Saves the detector setup to file
@ -1525,7 +1525,7 @@ public:
* and writes them to files with automatically added extension * and writes them to files with automatically added extension
* @returns OK or FAIL * @returns OK or FAIL
*/ */
int dumpDetectorSetup(std::string const fname, int level=0); int dumpDetectorSetup(const std::string& fname, int level=0);
/** /**
* register callback for accessing acquisition final data * register callback for accessing acquisition final data

View File

@ -1076,7 +1076,7 @@ int slsDetector::setOnline(int off) {
std::string slsDetector::checkOnline() { std::string slsDetector::checkOnline() {
std::string retval=""; std::string retval;
if(!controlSocket){ if(!controlSocket){
//this already sets the online/offline flag //this already sets the online/offline flag
setTCPSocket(); setTCPSocket();