diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index e28a30e04..c2f6013a3 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -603,7 +603,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ #ifdef VERBOSE cout << "Loading Calibration Data" << endl; #endif - QString fName = QString(myDet->getCalDir()); + QString fName = QString( (myDet->getCalDir()).c_str() ); qDefs::checkErrorMessage(myDet); //so that even nonexisting files can be selected @@ -626,7 +626,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action){ #ifdef VERBOSE cout << "Saving Calibration Data" << endl; #endif//different output directory so as not to overwrite - QString fName = QString(myDet->getCalDir()); + QString fName = QString( (myDet->getCalDir()).c_str() ); qDefs::checkErrorMessage(myDet); fName = QFileDialog::getSaveFileName(this, tr("Save Current Detector Calibration Data"),fName, diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 936e18cf9..f20188409 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -3552,38 +3552,39 @@ int multiSlsDetector::getTrimEn(int* ene) returns the location of the calibration files \sa sharedSlsDetector */ -char* multiSlsDetector::getCalDir() +string multiSlsDetector::getCalDir() { - string s0 = "", s1 = "", s; - //char ans[1000]; - for (int idet = 0; idet < thisMultiDetector->numberOfDetectors; ++idet) { - if (detectors[idet]) { - s = detectors[idet]->getCalDir(); - if (detectors[idet]->getErrorMask()) - setErrorMask(getErrorMask() | (1 << idet)); + return callDetectors(&slsDetector::getCalDir); + // string s0 = "", s1 = "", s; + // //char ans[1000]; + // for (int idet = 0; idet < thisMultiDetector->numberOfDetectors; ++idet) { + // if (detectors[idet]) { + // s = detectors[idet]->getCalDir(); + // if (detectors[idet]->getErrorMask()) + // setErrorMask(getErrorMask() | (1 << idet)); - if (s0 == "") - s0 = s; - else - s0 += string("+") + s; - if (s1 == "") - s1 = s; - else if (s1 != s) - s1 = "bad"; - } - } - if (s1 == "bad") - strcpy(ans, s0.c_str()); - else - strcpy(ans, s1.c_str()); - return ans; + // if (s0 == "") + // s0 = s; + // else + // s0 += string("+") + s; + // if (s1 == "") + // s1 = s; + // else if (s1 != s) + // s1 = "bad"; + // } + // } + // if (s1 == "bad") + // strcpy(ans, s0.c_str()); + // else + // strcpy(ans, s1.c_str()); + // return ans; } /** sets the location of the calibration files \sa sharedSlsDetector */ -char* multiSlsDetector::setCalDir(string s) +string multiSlsDetector::setCalDir(string s) { if (s.find('+') == string::npos) { diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h index 2f8ec3a9b..d1daf1857 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.h @@ -1054,12 +1054,12 @@ class multiSlsDetector : public slsDetectorUtils { returns the location of the calibration files \sa sharedSlsDetector */ - char* getCalDir(); + std::string getCalDir(); /** sets the location of the calibration files \sa sharedSlsDetector */ - char* setCalDir(std::string s); + std::string setCalDir(std::string s); std::string getNetworkParameter(networkParameter); diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index 95cd47f4a..db6798c24 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -493,12 +493,12 @@ class slsDetector : public slsDetectorUtils, public energyConversion { returns the location of the calibration files \sa sharedSlsDetector */ - char* getCalDir() {return thisDetector->calDir;}; + std::string getCalDir() {return thisDetector->calDir;}; /** sets the location of the calibration files \sa sharedSlsDetector */ - char* setCalDir(string s) {sprintf(thisDetector->calDir, s.c_str()); return thisDetector->calDir;}; + std::string setCalDir(string s) {sprintf(thisDetector->calDir, s.c_str()); return thisDetector->calDir;}; diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index cda0752f1..bada96b0b 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -3061,9 +3061,9 @@ string slsDetectorCommand::cmdCalDir(int narg, char *args[], int action){ if (action==PUT_ACTION) { myDet->setCalDir(string(args[1])); } - if (myDet->getCalDir()==NULL) + if ( (myDet->getCalDir()).empty() ) return string("undefined"); - return string(myDet->getCalDir()); + return myDet->getCalDir(); } diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h index e96aeb65f..3a0de545b 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h @@ -413,12 +413,12 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing { /** returns the location of the calibration files */ - virtual char* getCalDir()=0; + virtual std::string getCalDir()=0; /** sets the location of the calibration files */ - virtual char* setCalDir(std::string s)=0; + virtual std::string setCalDir(std::string s)=0; /** Frees the shared memory - should not be used except for debugging*/ virtual int freeSharedMemory()=0;