chaning return type of getSettingsDir and setSettingsDir to std::string

This commit is contained in:
Erik Frojdh 2018-05-24 17:47:12 +02:00
parent e65b416215
commit 301600e720
5 changed files with 17 additions and 52 deletions

View File

@ -1044,31 +1044,6 @@ slsDetectorDefs::synchronizationMode multiSlsDetector::setSynchronization(synchr
}
int multiSlsDetector::setOnline(int off) {
if (off!=GET_ONLINE_FLAG) {
@ -2077,8 +2052,6 @@ int multiSlsDetector::setSpeed(speedVariable index, int value){
int i;
int ret1=-100, ret;
for (i=0; i<thisMultiDetector->numberOfDetectors; ++i) {
if (detectors[i]) {
ret=detectors[i]->setSpeed(index,value);
@ -2098,22 +2071,13 @@ int multiSlsDetector::setSpeed(speedVariable index, int value){
int multiSlsDetector::getDataBytes(){
int ret=0;
int n_bytes = 0;
for (int ip=0; ip<thisMultiDetector->numberOfDetectors; ++ip) {
if (detectors[ip])
ret+=detectors[ip]->getDataBytes();
n_bytes += detectors[ip]->getDataBytes();
}
return ret;
return n_bytes;
}
@ -3656,7 +3620,8 @@ int multiSlsDetector::exitServer() {
/** returns the detector trimbit/settings directory */
char* multiSlsDetector::getSettingsDir() {
// char* multiSlsDetector::getSettingsDir() {
string multiSlsDetector::getSettingsDir() {
string s0="", s1="", s;
@ -3678,16 +3643,16 @@ char* multiSlsDetector::getSettingsDir() {
}
}
if (s1=="bad")
strcpy(ans,s0.c_str());
return s0;
else
strcpy(ans,s1.c_str());
return ans;
return s1;
// return ans;
}
/** sets the detector trimbit/settings directory \sa sharedSlsDetector */
char* multiSlsDetector::setSettingsDir(string s){
string multiSlsDetector::setSettingsDir(string s){
if (s.find('+')==string::npos) {
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet) {

View File

@ -1047,9 +1047,9 @@ class multiSlsDetector : public slsDetectorUtils {
/** returns the detector trimbit/settings directory \sa sharedSlsDetector */
char* getSettingsDir();
std::string getSettingsDir();
/** sets the detector trimbit/settings directory \sa sharedSlsDetector */
char* setSettingsDir(std::string s);
std::string setSettingsDir(std::string s);
/**
returns the location of the calibration files
\sa sharedSlsDetector

View File

@ -483,9 +483,9 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
/* I/O */
/** returns the detector trimbit/settings directory \sa sharedSlsDetector */
char* getSettingsDir() {return thisDetector->settingsDir;};
std::string getSettingsDir() {return std::string(thisDetector->settingsDir);};
/** sets the detector trimbit/settings directory \sa sharedSlsDetector */
char* setSettingsDir(string s) {sprintf(thisDetector->settingsDir, s.c_str()); return thisDetector->settingsDir;};
std::string setSettingsDir(string s) {sprintf(thisDetector->settingsDir, s.c_str()); return thisDetector->settingsDir;};

View File

@ -3031,9 +3031,9 @@ string slsDetectorCommand::cmdSettingsDir(int narg, char *args[], int action){
if (action==PUT_ACTION) {
myDet->setSettingsDir(string(args[1]));
}
if (myDet->getSettingsDir()==NULL)
if (myDet->getSettingsDir()=="")
return string("undefined");
return string(myDet->getSettingsDir());
return myDet->getSettingsDir();
}

View File

@ -405,10 +405,10 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
/**
returns the detector trimbit/settings directory
*/
virtual char* getSettingsDir()=0;
virtual std::string getSettingsDir()=0;
/** sets the detector trimbit/settings directory */
virtual char* setSettingsDir(std::string s)=0;
virtual std::string setSettingsDir(std::string s)=0;
/**
returns the location of the calibration files