Merge branch 'developer' into versioning

This commit is contained in:
maliakal_d 2018-05-24 16:56:39 +02:00
commit ad3ac2cdee
41 changed files with 615 additions and 650 deletions

View File

@ -15,7 +15,7 @@
#include <string> #include <string>
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
using namespace std; //
/** Error flags */ /** Error flags */
/*Assumption: Only upto 63 detectors */ /*Assumption: Only upto 63 detectors */
@ -112,9 +112,9 @@ public:
* param errorMask error mask * param errorMask error mask
/returns error message from error mask /returns error message from error mask
*/ */
static string getErrorMessage(int64_t slsErrorMask){ static std::string getErrorMessage(int64_t slsErrorMask){
string retval = ""; std::string retval = "";
if(slsErrorMask&CANNOT_CONNECT_TO_DETECTOR) if(slsErrorMask&CANNOT_CONNECT_TO_DETECTOR)
retval.append("Cannot connect to Detector\n"); retval.append("Cannot connect to Detector\n");

View File

@ -16,7 +16,7 @@
#include <math.h> #include <math.h>
using namespace std;

View File

@ -623,31 +623,17 @@ string multiSlsDetector::ssetDetectorsType(string name, int pos) {
} }
string multiSlsDetector::getHostname(int pos) { string multiSlsDetector::getHostname(int pos) {
string s=string(""); string hostnames;
#ifdef VERBOSE if (pos>=0){
cout << "returning hostname" << pos << endl; if (detectors[pos])
#endif return detectors[pos]->getHostname();
if (pos>=0) { } else {
if (detectors[pos]) for (int ip=0; ip<thisMultiDetector->numberOfDetectors; ++ip) {
return detectors[pos]->getHostname(); if (detectors[ip])
} else { hostnames += detectors[ip]->getHostname() + "+";
for (int ip=0; ip<thisMultiDetector->numberOfDetectors; ++ip) { }
#ifdef VERBOSE }
cout << "detector " << ip << endl; return hostnames;
#endif
if (detectors[ip]) {
s+=detectors[ip]->getHostname();
s+=string("+");
}
#ifdef VERBOSE
cout << s <<endl;
cout << "hostname " << s << endl;
#endif
}
}
return s;
} }
@ -667,35 +653,19 @@ slsDetectorDefs::detectorType multiSlsDetector::getDetectorsType(int pos) {
string multiSlsDetector::sgetDetectorsType(int pos) { string multiSlsDetector::sgetDetectorsType(int pos) {
string s;
string s=string("");
#ifdef VERBOSE
cout << "returning type" << pos << endl;
#endif
if (pos>=0) { if (pos>=0) {
if (detectors[pos]) if (detectors[pos])
return detectors[pos]->sgetDetectorsType(); return detectors[pos]->sgetDetectorsType();
} else { } else {
for (int ip=0; ip<thisMultiDetector->numberOfDetectors; ++ip) { for (int ip=0; ip<thisMultiDetector->numberOfDetectors; ++ip) {
#ifdef VERBOSE if (detectors[ip])
cout << "detector " << ip << endl; s+=detectors[ip]->sgetDetectorsType() + "+";
#endif
if (detectors[ip]) {
s+=detectors[ip]->sgetDetectorsType();
s+=string("+");
}
#ifdef VERBOSE
cout << "type " << s << endl;
#endif
} }
} }
return s; return s;
} }
int multiSlsDetector::getDetectorId(int pos) { int multiSlsDetector::getDetectorId(int pos) {
#ifdef VERBOSE #ifdef VERBOSE
@ -1144,26 +1114,21 @@ int multiSlsDetector::setOnline(int off) {
string multiSlsDetector::checkOnline() { string multiSlsDetector::checkOnline() {
string retval1 = "",retval; string offlineDetectors = "";
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet) { for (int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet) {
if (detectors[idet]) { if (detectors[idet]) {
retval=detectors[idet]->checkOnline(); string tmp = detectors[idet]->checkOnline();
if(!retval.empty()){ if(!tmp.empty())
retval1.append(retval); offlineDetectors += tmp + "+";
retval1.append("+");
}
} }
} }
return retval1; return offlineDetectors;
}; }
int multiSlsDetector::activate(int const enable){ int multiSlsDetector::activate(int const enable){
int i;
int ret1=-100, ret; int ret1=-100, ret;
for (i=0; i<thisMultiDetector->numberOfDetectors; ++i) { for (int i=0; i<thisMultiDetector->numberOfDetectors; ++i) {
if (detectors[i]) { if (detectors[i]) {
ret=detectors[i]->activate(enable); ret=detectors[i]->activate(enable);
if(detectors[i]->getErrorMask()) if(detectors[i]->getErrorMask())

View File

@ -23,7 +23,7 @@ class ZmqSocket;
//using namespace std;
@ -258,7 +258,7 @@ class multiSlsDetector : public slsDetectorUtils {
*/ */
multiSlsDetector(int id=0); multiSlsDetector(int id=0);
//slsDetector(string const fname); //slsDetector(std::string const fname);
/** destructor */ /** destructor */
virtual ~multiSlsDetector(); virtual ~multiSlsDetector();
@ -311,20 +311,20 @@ class multiSlsDetector : public slsDetectorUtils {
string setHostname(const char*, int pos=-1); std::string setHostname(const char*, int pos=-1);
string getHostname(int pos=-1); std::string getHostname(int pos=-1);
using slsDetectorBase::getDetectorType; using slsDetectorBase::getDetectorType;
string getDetectorType(){return sgetDetectorsType();}; std::string getDetectorType(){return sgetDetectorsType();};
detectorType getDetectorsType(int pos=-1); detectorType getDetectorsType(int pos=-1);
detectorType setDetectorsType(detectorType type=GET_DETECTOR_TYPE, int pos=-1){addSlsDetector(type, pos); return getDetectorsType(pos);}; detectorType setDetectorsType(detectorType type=GET_DETECTOR_TYPE, int pos=-1){addSlsDetector(type, pos); return getDetectorsType(pos);};
string sgetDetectorsType(int pos=-1); std::string sgetDetectorsType(int pos=-1);
string ssetDetectorsType(detectorType type=GET_DETECTOR_TYPE, int pos=-1){return getDetectorType(setDetectorsType(type, pos));}; // std::string ssetDetectorsType(detectorType type=GET_DETECTOR_TYPE, int pos=-1){return getDetectorType(setDetectorsType(type, pos));}; //
string ssetDetectorsType(string s, int pos=-1);//{return getDetectorType(setDetectorsType(getDetectorType(s),pos));}; // should decode detector type std::string ssetDetectorsType(std::string s, int pos=-1);//{return getDetectorType(setDetectorsType(getDetectorType(s),pos));}; // should decode detector type
/** adds a detector by id in position pos /** adds a detector by id in position pos
@ -440,7 +440,7 @@ class multiSlsDetector : public slsDetectorUtils {
/** checks if each of the detectors are online /** checks if each of the detectors are online
\returns online/offline status and -1 if any of the detector's online status is different from the other \returns online/offline status and -1 if any of the detector's online status is different from the other
*/ */
string checkOnline(); std::string checkOnline();
/** @short activates the detector (detector specific) /** @short activates the detector (detector specific)
\param enable can be: -1 returns wether the detector is in active (1) or inactive (0) state \param enable can be: -1 returns wether the detector is in active (1) or inactive (0) state
@ -465,13 +465,13 @@ class multiSlsDetector : public slsDetectorUtils {
/sa mythenDetector::readConfigurationFile /sa mythenDetector::readConfigurationFile
*/ */
int readConfigurationFile(string const fname); int readConfigurationFile(std::string const fname);
/** /**
Purely virtual function Purely virtual function
Should be implemented in the specific detector class Should be implemented in the specific detector class
/sa mythenDetector::writeConfigurationFile /sa mythenDetector::writeConfigurationFile
*/ */
int writeConfigurationFile(string const fname); int writeConfigurationFile(std::string const fname);
@ -532,7 +532,7 @@ class multiSlsDetector : public slsDetectorUtils {
int64_t getId(idMode mode, int imod=0); int64_t getId(idMode mode, int imod=0);
int digitalTest(digitalTestMode mode, int imod=0); int digitalTest(digitalTestMode mode, int imod=0);
int executeTrimming(trimMode mode, int par1, int par2, int imod=-1); int executeTrimming(trimMode mode, int par1, int par2, int imod=-1);
string getSettingsFile(); std::string getSettingsFile();
int decodeNMod(int i, int &idet, int &imod); int decodeNMod(int i, int &idet, int &imod);
@ -541,7 +541,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param fname file name \param fname file name
\returns OK or FAIL \returns OK or FAIL
*/ */
int programFPGA(string fname); int programFPGA(std::string fname);
/** resets FPGA /** resets FPGA
\returns OK or FAIL \returns OK or FAIL
@ -561,10 +561,10 @@ class multiSlsDetector : public slsDetectorUtils {
int setAutoComparatorDisableMode(int ival= -1); int setAutoComparatorDisableMode(int ival= -1);
/** loads the modules settings/trimbits reading from a file - file name extension is automatically generated! */ /** loads the modules settings/trimbits reading from a file - file name extension is automatically generated! */
int loadSettingsFile(string fname, int nmod=-1); int loadSettingsFile(std::string fname, int nmod=-1);
/** gets the modules settings/trimbits and writes them to file - file name extension is automatically generated! */ /** gets the modules settings/trimbits and writes them to file - file name extension is automatically generated! */
int saveSettingsFile(string fname, int nmod=-1); int saveSettingsFile(std::string fname, int nmod=-1);
/** sets all the trimbits to a particular value /** sets all the trimbits to a particular value
@ -576,10 +576,10 @@ class multiSlsDetector : public slsDetectorUtils {
/** loads the modules calibration data reading from a file - file name extension is automatically generated! */ /** loads the modules calibration data reading from a file - file name extension is automatically generated! */
int loadCalibrationFile(string fname, int nmod=-1); int loadCalibrationFile(std::string fname, int nmod=-1);
/** gets the modules calibration data and writes them to file - file name extension is automatically generated! */ /** gets the modules calibration data and writes them to file - file name extension is automatically generated! */
int saveCalibrationFile(string fname, int nmod=-1); int saveCalibrationFile(std::string fname, int nmod=-1);
@ -796,7 +796,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param fname name of the flat field file (or "" if disable) \param fname name of the flat field file (or "" if disable)
\returns 0 if disable (or file could not be read), >0 otherwise \returns 0 if disable (or file could not be read), >0 otherwise
*/ */
int setFlatFieldCorrection(string fname=""); int setFlatFieldCorrection(std::string fname="");
/** /**
set flat field corrections set flat field corrections
@ -853,7 +853,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param fname file with bad channel list ("" disable) \param fname file with bad channel list ("" disable)
\returns 0 if bad channel disabled, >0 otherwise \returns 0 if bad channel disabled, >0 otherwise
*/ */
int setBadChannelCorrection(string fname=""); int setBadChannelCorrection(std::string fname="");
int setBadChannelCorrection(int nch, int *chs, int ff); int setBadChannelCorrection(int nch, int *chs, int ff);
@ -881,9 +881,9 @@ class multiSlsDetector : public slsDetectorUtils {
int readAngularConversionFile(string fname); int readAngularConversionFile(std::string fname);
int writeAngularConversion(string fname); int writeAngularConversion(std::string fname);
// double* convertAngles(double pos); // double* convertAngles(double pos);
@ -1049,7 +1049,7 @@ class multiSlsDetector : public slsDetectorUtils {
/** returns the detector trimbit/settings directory \sa sharedSlsDetector */ /** returns the detector trimbit/settings directory \sa sharedSlsDetector */
char* getSettingsDir(); char* getSettingsDir();
/** sets the detector trimbit/settings directory \sa sharedSlsDetector */ /** sets the detector trimbit/settings directory \sa sharedSlsDetector */
char* setSettingsDir(string s); char* setSettingsDir(std::string s);
/** /**
returns the location of the calibration files returns the location of the calibration files
\sa sharedSlsDetector \sa sharedSlsDetector
@ -1059,10 +1059,10 @@ class multiSlsDetector : public slsDetectorUtils {
sets the location of the calibration files sets the location of the calibration files
\sa sharedSlsDetector \sa sharedSlsDetector
*/ */
char* setCalDir(string s); char* setCalDir(std::string s);
string getNetworkParameter(networkParameter); std::string getNetworkParameter(networkParameter);
/** /**
sets the network parameters sets the network parameters
@ -1072,11 +1072,11 @@ class multiSlsDetector : public slsDetectorUtils {
\returns parameter \returns parameter
*/ */
string setNetworkParameter(networkParameter, std::string); std::string setNetworkParameter(networkParameter, std::string);
int setPort(portType, int); int setPort(portType, int);
int lockServer(int); int lockServer(int);
string getLastClientIP(); std::string getLastClientIP();
/** /**
configures mac for gotthard readout configures mac for gotthard readout
@ -1154,7 +1154,7 @@ class multiSlsDetector : public slsDetectorUtils {
\fname file name to load data from \fname file name to load data from
\returns OK or FAIL \returns OK or FAIL
*/ */
int loadImageToDetector(imageType index,string const fname); int loadImageToDetector(imageType index,std::string const fname);
/** /**
sets the value of s angular conversion parameter sets the value of s angular conversion parameter
@ -1179,7 +1179,7 @@ class multiSlsDetector : public slsDetectorUtils {
\sa mythenDetector::writeDataFile \sa mythenDetector::writeDataFile
*/ */
int writeDataFile(string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1); int writeDataFile(std::string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1);
/** /**
@ -1190,7 +1190,7 @@ class multiSlsDetector : public slsDetectorUtils {
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
\sa mythenDetector::writeDataFile \sa mythenDetector::writeDataFile
*/ */
int writeDataFile(string fname, int *data); int writeDataFile(std::string fname, int *data);
/** /**
@ -1206,7 +1206,7 @@ class multiSlsDetector : public slsDetectorUtils {
\sa mythenDetector::readDataFile \sa mythenDetector::readDataFile
*/ */
int readDataFile(string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f'); int readDataFile(std::string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f');
/** /**
@ -1217,7 +1217,7 @@ class multiSlsDetector : public slsDetectorUtils {
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
\sa mythenDetector::readDataFile \sa mythenDetector::readDataFile
*/ */
int readDataFile(string fname, int *data); int readDataFile(std::string fname, int *data);
/** /**
@ -1226,7 +1226,7 @@ class multiSlsDetector : public slsDetectorUtils {
\param fname file name to load data from \param fname file name to load data from
\returns OK or FAIL \returns OK or FAIL
*/ */
int writeCounterBlockFile(string const fname,int startACQ=0); int writeCounterBlockFile(std::string const fname,int startACQ=0);
/** /**
@ -1262,7 +1262,7 @@ class multiSlsDetector : public slsDetectorUtils {
/** /**
Checks if the receiver is really online Checks if the receiver is really online
*/ */
string checkReceiverOnline(); std::string checkReceiverOnline();
/** /**
@ -1270,14 +1270,14 @@ class multiSlsDetector : public slsDetectorUtils {
@param s file directory @param s file directory
\returns file dir \returns file dir
*/ */
string setFilePath(string s=""); std::string setFilePath(std::string s="");
/** /**
Sets up the file name Sets up the file name
@param s file name @param s file name
\returns file name \returns file name
*/ */
string setFileName(string s=""); std::string setFileName(std::string s="");
/** /**
Sets the max frames per file in receiver Sets the max frames per file in receiver
@ -1303,12 +1303,12 @@ class multiSlsDetector : public slsDetectorUtils {
/** /**
\returns file dir \returns file dir
*/ */
string getFilePath(){return setFilePath();}; std::string getFilePath(){return setFilePath();};
/** /**
\returns file name \returns file name
*/ */
string getFileName(){return setFileName();}; std::string getFileName(){return setFileName();};
/** /**
\returns file name \returns file name
@ -1385,7 +1385,7 @@ class multiSlsDetector : public slsDetectorUtils {
/** /**
Returns the IP of the last client connecting to the receiver Returns the IP of the last client connecting to the receiver
*/ */
string getReceiverLastClientIP(); std::string getReceiverLastClientIP();
/** /**
Turns off the receiver server! Turns off the receiver server!
@ -1411,9 +1411,9 @@ class multiSlsDetector : public slsDetectorUtils {
/**checks error mask and returns error message if it exists /**checks error mask and returns error message if it exists
* @param myDet is the multidetector object * @param myDet is the multidetector object
* @param critical is 1 if any of the messages is critical * @param critical is 1 if any of the messages is critical
/returns error message else an empty string /returns error message else an empty std::string
*/ */
string getErrorMessage(int &critical); std::string getErrorMessage(int &critical);
/** Clears error mask of both multi and sls /** Clears error mask of both multi and sls
/returns error mask /returns error mask
@ -1491,7 +1491,7 @@ class multiSlsDetector : public slsDetectorUtils {
@param fname pattern file to open @param fname pattern file to open
@returns OK/FAIL @returns OK/FAIL
*/ */
int setCTBPattern(string fname); int setCTBPattern(std::string fname);
/** Writes a pattern word to the CTB /** Writes a pattern word to the CTB

View File

@ -7,7 +7,7 @@
#include <stdlib.h> #include <stdlib.h>
using namespace std;
int dummyCallback(detectorData* d, int p,void*) { int dummyCallback(detectorData* d, int p,void*) {
cout << "got data " << p << endl; cout << "got data " << p << endl;

View File

@ -6,7 +6,7 @@
#include "slsDetector.h" #include "slsDetector.h"
#include "multiSlsDetector.h" #include "multiSlsDetector.h"
#include "slsDetectorCommand.h" #include "slsDetectorCommand.h"
using namespace std;
/** @short This class handles the command line I/Os, help etc. of the text clients */ /** @short This class handles the command line I/Os, help etc. of the text clients */

View File

@ -11,6 +11,7 @@
#include <math.h> #include <math.h>
#include "gitInfoLib.h" #include "gitInfoLib.h"
using namespace std;
int slsDetector::initSharedMemory(detectorType type, int id) { int slsDetector::initSharedMemory(detectorType type, int id) {

View File

@ -8,7 +8,7 @@
#include <fstream> #include <fstream>
using namespace std; //
/** /**
@ -38,7 +38,7 @@ class slsDetectorActions : public virtual slsDetectorBase
\param par for script \param par for script
\returns 0 if action disabled, >0 otherwise \returns 0 if action disabled, >0 otherwise
*/ */
int setAction(int iaction, string fname="", string par=""); int setAction(int iaction,std::string fname="",std::string par="");
/** /**
set action script set action script
@ -46,7 +46,7 @@ class slsDetectorActions : public virtual slsDetectorBase
\param fname for script ("" disable) \param fname for script ("" disable)
\returns 0 if action disabled, >0 otherwise \returns 0 if action disabled, >0 otherwise
*/ */
int setActionScript(int iaction, string fname=""); int setActionScript(int iaction, std::string fname="");
/** /**
@ -55,7 +55,7 @@ class slsDetectorActions : public virtual slsDetectorBase
\param par for script \param par for script
\returns 0 if action disabled, >0 otherwise \returns 0 if action disabled, >0 otherwise
*/ */
int setActionParameter(int iaction, string par=""); int setActionParameter(int iaction, std::string par="");
/** /**
@ -63,14 +63,14 @@ class slsDetectorActions : public virtual slsDetectorBase
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript} \param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
\returns action script \returns action script
*/ */
string getActionScript(int iaction); std::string getActionScript(int iaction);
/** /**
returns action parameter returns action parameter
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript} \param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
\returns action parameter \returns action parameter
*/ */
string getActionParameter(int iaction); std::string getActionParameter(int iaction);
/** /**
returns action mode returns action mode
@ -89,20 +89,20 @@ class slsDetectorActions : public virtual slsDetectorBase
\param precision to write the scan varaible in the scan name (-1 unchanged) \param precision to write the scan varaible in the scan name (-1 unchanged)
\returns 0 is scan disabled, >0 otherwise \returns 0 is scan disabled, >0 otherwise
*/ */
int setScan(int index, string script="", int nvalues=-1, double *values=NULL, string par="", int precision=-1); int setScan(int index, std::string script="", int nvalues=-1, double *values=NULL, std::string par="", int precision=-1);
/** set scan script /** set scan script
\param index of the scan (0,1) \param index of the scan (0,1)
\param script fname for script ("" disables, "none" disables and overwrites current, "threshold" threshold scan, "trimbits", trimbits scan) \param script fname for script ("" disables, "none" disables and overwrites current, "threshold" threshold scan, "trimbits", trimbits scan)
\returns 0 is scan disabled, >0 otherwise \returns 0 is scan disabled, >0 otherwise
*/ */
int setScanScript(int index, string script=""); int setScanScript(int index, std::string script="");
/** set scan script parameter /** set scan script parameter
\param index of the scan (0,1) \param index of the scan (0,1)
\param script parameter for scan \param script parameter for scan
\returns 0 is scan disabled, >0 otherwise \returns 0 is scan disabled, >0 otherwise
*/ */
int setScanParameter(int index, string par=""); int setScanParameter(int index, std::string par="");
/** set scan script parameter /** set scan script parameter
\param index of the scan (0,1) \param index of the scan (0,1)
\param precision scan varaible precision to be printed in file name \param precision scan varaible precision to be printed in file name
@ -130,14 +130,14 @@ class slsDetectorActions : public virtual slsDetectorBase
\param iscan can be (0,1) \param iscan can be (0,1)
\returns scan script \returns scan script
*/ */
string getScanScript(int iscan); std::string getScanScript(int iscan);
/** /**
returns scan parameter returns scan parameter
\param iscan can be (0,1) \param iscan can be (0,1)
\returns scan parameter \returns scan parameter
*/ */
string getScanParameter(int iscan); std::string getScanParameter(int iscan);
/** /**
returns scan mode returns scan mode
@ -273,7 +273,7 @@ class slsDetectorActions : public virtual slsDetectorBase
int startIndex; int startIndex;
int lastIndex; int lastIndex;
int nowIndex; int nowIndex;
string fName; std::string fName;

View File

@ -54,8 +54,6 @@
#include <string> #include <string>
using namespace std;
/** /**
@libdoc The slsDetectorBase contains also a set of purely virtual functions useful for the implementation of the derived classes @libdoc The slsDetectorBase contains also a set of purely virtual functions useful for the implementation of the derived classes
@ -83,7 +81,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
*/ */
virtual detectorType getDetectorsType(int pos=-1)=0; virtual detectorType getDetectorsType(int pos=-1)=0;
string getDetectorDeveloper(){return string("PSI");}; std::string getDetectorDeveloper(){return std::string("PSI");};
// protected: // protected:
/** /**
@ -91,14 +89,14 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
\param fname file with angular conversion constants ("" disable) \param fname file with angular conversion constants ("" disable)
\returns 0 if angular conversion disabled, >0 otherwise \returns 0 if angular conversion disabled, >0 otherwise
*/ */
virtual int setAngularConversionFile(string fname="")=0; virtual int setAngularConversionFile(std::string fname="")=0;
/** /**
pure virtual function pure virtual function
returns the angular conversion file returns the angular conversion file
*/ */
virtual string getAngularConversionFile()=0; virtual std::string getAngularConversionFile()=0;
@ -108,7 +106,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
\param fname for script ("" disable) \param fname for script ("" disable)
\returns 0 if action disabled, >0 otherwise \returns 0 if action disabled, >0 otherwise
*/ */
virtual int setActionScript(int iaction, string fname="")=0; virtual int setActionScript(int iaction, std::string fname="")=0;
/** /**
set action set action
@ -116,21 +114,21 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
\param par for script ("" disable) \param par for script ("" disable)
\returns 0 if action disabled, >0 otherwise \returns 0 if action disabled, >0 otherwise
*/ */
virtual int setActionParameter(int iaction, string par="")=0; virtual int setActionParameter(int iaction, std::string par="")=0;
/** /**
returns action script returns action script
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript} \param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
\returns action script \returns action script
*/ */
virtual string getActionScript(int iaction)=0; virtual std::string getActionScript(int iaction)=0;
/** /**
returns action parameter returns action parameter
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript} \param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
\returns action parameter \returns action parameter
*/ */
virtual string getActionParameter(int iaction)=0; virtual std::string getActionParameter(int iaction)=0;
/** /**
set scan script set scan script
@ -138,7 +136,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
\param script fname for script ("" disable, "none" disables and overwrites current, "threshold" makes threshold scan, "trimbits" make trimbits scan, "energy" makes energy scan) \param script fname for script ("" disable, "none" disables and overwrites current, "threshold" makes threshold scan, "trimbits" make trimbits scan, "energy" makes energy scan)
\returns 0 if scan disabled, >0 otherwise \returns 0 if scan disabled, >0 otherwise
*/ */
virtual int setScanScript(int index, string script="")=0; virtual int setScanScript(int index, std::string script="")=0;
/** /**
set scan script parameter set scan script parameter
@ -146,7 +144,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
\param spar parameter to be passed to the scan script with syntax par=spar \param spar parameter to be passed to the scan script with syntax par=spar
\returns 0 if scan disabled, >0 otherwise \returns 0 if scan disabled, >0 otherwise
*/ */
virtual int setScanParameter(int index, string spar="")=0; virtual int setScanParameter(int index, std::string spar="")=0;
/** set scan precision /** set scan precision
@ -169,14 +167,14 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
\param index is the scan index (0 or 1) \param index is the scan index (0 or 1)
\returns "none" if disables, "threshold" threshold scan, "trimbits" trimbits scan, "energy" energy scan or scan script name \returns "none" if disables, "threshold" threshold scan, "trimbits" trimbits scan, "energy" energy scan or scan script name
*/ */
virtual string getScanScript(int index)=0; virtual std::string getScanScript(int index)=0;
/** /**
get scan script get scan script
\param index is the scan index (0 or 1) \param index is the scan index (0 or 1)
\returns scan script parameter \returns scan script parameter
*/ */
virtual string getScanParameter(int index)=0; virtual std::string getScanParameter(int index)=0;
/** /**
get scan precision get scan precision
@ -199,7 +197,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
\param fname file name \param fname file name
\returns OK or FAIL \returns OK or FAIL
*/ */
virtual int writeConfigurationFile(string const fname)=0; virtual int writeConfigurationFile(std::string const fname)=0;
/** /**
@ -208,7 +206,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
\param fname file name to load data from \param fname file name to load data from
\returns OK or FAIL \returns OK or FAIL
*/ */
virtual int loadImageToDetector(imageType index,string const fname)=0; virtual int loadImageToDetector(imageType index,std::string const fname)=0;
/** /**
\returns number of positions \returns number of positions
@ -241,7 +239,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
virtual int getTotalNumberOfChannels(dimension d)=0; virtual int getTotalNumberOfChannels(dimension d)=0;
/** generates file name without extension */ /** generates file name without extension */
virtual string createFileName()=0; virtual std::string createFileName()=0;
virtual void incrementProgress()=0; virtual void incrementProgress()=0;
@ -254,12 +252,12 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
virtual double* decodeData(int *datain, int &nn, double *fdata=NULL)=0; virtual double* decodeData(int *datain, int &nn, double *fdata=NULL)=0;
virtual string getCurrentFileName()=0; virtual std::string getCurrentFileName()=0;
virtual int getFileIndexFromFileName(string fname)=0; virtual int getFileIndexFromFileName(std::string fname)=0;
virtual int getIndicesFromFileName(string fname,int &index)=0; virtual int getIndicesFromFileName(std::string fname,int &index)=0;
virtual double *convertAngles()=0; virtual double *convertAngles()=0;
/** /**
@ -282,9 +280,9 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
*/ */
virtual int getRateCorrection()=0; virtual int getRateCorrection()=0;
virtual int setFlatFieldCorrection(string fname="")=0; virtual int setFlatFieldCorrection(std::string fname="")=0;
int setFlatFieldCorrectionFile(string fname=""){return setFlatFieldCorrection(fname);}; int setFlatFieldCorrectionFile(std::string fname=""){return setFlatFieldCorrection(fname);};
/** /**
set/get dynamic range set/get dynamic range
@ -532,12 +530,12 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
\param fname file name \param fname file name
\returns OK or FAIL \returns OK or FAIL
*/ */
virtual int readConfigurationFile(string const fname)=0; virtual int readConfigurationFile(std::string const fname)=0;
virtual int dumpDetectorSetup(string const fname, int level)=0; virtual int dumpDetectorSetup(std::string const fname, int level)=0;
int dumpDetectorSetup(string const fname){return dumpDetectorSetup(fname,0);}; int dumpDetectorSetup(std::string const fname){return dumpDetectorSetup(fname,0);};
virtual int retrieveDetectorSetup(string const fname, int level)=0; virtual int retrieveDetectorSetup(std::string const fname, int level)=0;
int retrieveDetectorSetup(string const fname){return retrieveDetectorSetup(fname,0);}; int retrieveDetectorSetup(std::string const fname){return retrieveDetectorSetup(fname,0);};
/** /**
@short @short
\returns the default output file index \returns the default output file index
@ -628,29 +626,29 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
virtual runStatus startReceiverReadout()=0; virtual runStatus startReceiverReadout()=0;
/** returns detector type string from detector type index /** returns detector type std::string from detector type index
\param t string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown \param t std::string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown
\returns MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, MÖNCH, GENERIC \returns MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, MÖNCH, GENERIC
*/ */
static string getDetectorType(detectorType t){\ static std::string getDetectorType(detectorType t){\
switch (t) {\ switch (t) {\
case MYTHEN: return string("Mythen"); \ case MYTHEN: return std::string("Mythen"); \
case PILATUS: return string("Pilatus"); \ case PILATUS: return std::string("Pilatus"); \
case EIGER: return string("Eiger"); \ case EIGER: return std::string("Eiger"); \
case GOTTHARD: return string("Gotthard"); \ case GOTTHARD: return std::string("Gotthard"); \
case AGIPD: return string("Agipd"); \ case AGIPD: return std::string("Agipd"); \
case MOENCH: return string("Moench"); \ case MOENCH: return std::string("Moench"); \
case JUNGFRAU: return string("Jungfrau"); \ case JUNGFRAU: return std::string("Jungfrau"); \
case JUNGFRAUCTB: return string("JungfrauCTB"); \ case JUNGFRAUCTB: return std::string("JungfrauCTB"); \
case PROPIX: return string("Propix"); \ case PROPIX: return std::string("Propix"); \
default: return string("Unknown"); \ default: return std::string("Unknown"); \
}}; }};
/** returns detector type index from detector type string /** returns detector type index from detector type std::string
\param type can be MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, GENERIC \param type can be MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, GENERIC
\returns Mythen, Pilatus, Eiger, Gotthard, Agipd, Mönch, Unknown \returns Mythen, Pilatus, Eiger, Gotthard, Agipd, Mönch, Unknown
*/ */
static detectorType getDetectorType(string const type){\ static detectorType getDetectorType(std::string const type){\
if (type=="Mythen") return MYTHEN;\ if (type=="Mythen") return MYTHEN;\
if (type=="Pilatus") return PILATUS; \ if (type=="Pilatus") return PILATUS; \
if (type=="Eiger") return EIGER; \ if (type=="Eiger") return EIGER; \
@ -664,11 +662,11 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
/** returns synchronization type index from string /** returns synchronization type index from std::string
\param type can be none, gating, trigger, complementary \param type can be none, gating, trigger, complementary
\returns ONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS \returns ONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
*/ */
static synchronizationMode getSyncType(string const type){\ static synchronizationMode getSyncType(std::string const type){\
if (type=="none") return NO_SYNCHRONIZATION;\ if (type=="none") return NO_SYNCHRONIZATION;\
if (type=="gating") return MASTER_GATES;\ if (type=="gating") return MASTER_GATES;\
if (type=="trigger") return MASTER_TRIGGERS; \ if (type=="trigger") return MASTER_TRIGGERS; \
@ -676,55 +674,55 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
return GET_SYNCHRONIZATION_MODE; \ return GET_SYNCHRONIZATION_MODE; \
}; };
/** returns synchronization type string from index /** returns synchronization type std::string from index
\param s can be NONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS \param s can be NONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
\returns none, gating, trigger, complementary, unknown \returns none, gating, trigger, complementary, unknown
*/ */
static string getSyncType(synchronizationMode s ){\ static std::string getSyncType(synchronizationMode s ){\
switch(s) { \ switch(s) { \
case NO_SYNCHRONIZATION: return string("none"); \ case NO_SYNCHRONIZATION: return std::string("none"); \
case MASTER_GATES: return string("gating"); \ case MASTER_GATES: return std::string("gating"); \
case MASTER_TRIGGERS: return string("trigger"); \ case MASTER_TRIGGERS: return std::string("trigger"); \
case SLAVE_STARTS_WHEN_MASTER_STOPS: return string("complementary"); \ case SLAVE_STARTS_WHEN_MASTER_STOPS: return std::string("complementary"); \
default: return string("unknown"); \ default: return std::string("unknown"); \
}}; }};
/** returns string from external signal type index /** returns std::string from external signal type index
\param f can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, =TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE, RO_TRIGGER_OUT_FALLING_EDGE, OUTPUT_LOW, OUTPUT_HIGH, MASTER_SLAVE_SYNCHRONIZATION, GET_EXTERNAL_SIGNAL_FLAG \param f can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, =TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE, RO_TRIGGER_OUT_FALLING_EDGE, OUTPUT_LOW, OUTPUT_HIGH, MASTER_SLAVE_SYNCHRONIZATION, GET_EXTERNAL_SIGNAL_FLAG
\returns string off, gate_in_active_high, gate_in_active_low, trigger_in_rising_edge, trigger_in_falling_edge, ro_trigger_in_rising_edge, ro_trigger_in_falling_edge, gate_out_active_high, gate_out_active_low, trigger_out_rising_edge, trigger_out_falling_edge, ro_trigger_out_rising_edge, ro_trigger_out_falling_edge, gnd, vcc, sync, unknown \returns std::string off, gate_in_active_high, gate_in_active_low, trigger_in_rising_edge, trigger_in_falling_edge, ro_trigger_in_rising_edge, ro_trigger_in_falling_edge, gate_out_active_high, gate_out_active_low, trigger_out_rising_edge, trigger_out_falling_edge, ro_trigger_out_rising_edge, ro_trigger_out_falling_edge, gnd, vcc, sync, unknown
*/ */
static string externalSignalType(externalSignalFlag f){\ static std::string externalSignalType(externalSignalFlag f){\
switch(f) { \ switch(f) { \
case SIGNAL_OFF: return string( "off"); \ case SIGNAL_OFF: return std::string( "off"); \
case GATE_IN_ACTIVE_HIGH: return string( "gate_in_active_high"); \ case GATE_IN_ACTIVE_HIGH: return std::string( "gate_in_active_high"); \
case GATE_IN_ACTIVE_LOW: return string( "gate_in_active_low"); \ case GATE_IN_ACTIVE_LOW: return std::string( "gate_in_active_low"); \
case TRIGGER_IN_RISING_EDGE: return string( "trigger_in_rising_edge"); \ case TRIGGER_IN_RISING_EDGE: return std::string( "trigger_in_rising_edge"); \
case TRIGGER_IN_FALLING_EDGE: return string( "trigger_in_falling_edge"); \ case TRIGGER_IN_FALLING_EDGE: return std::string( "trigger_in_falling_edge"); \
case RO_TRIGGER_IN_RISING_EDGE: return string( "ro_trigger_in_rising_edge"); \ case RO_TRIGGER_IN_RISING_EDGE: return std::string( "ro_trigger_in_rising_edge"); \
case RO_TRIGGER_IN_FALLING_EDGE: return string( "ro_trigger_in_falling_edge"); \ case RO_TRIGGER_IN_FALLING_EDGE: return std::string( "ro_trigger_in_falling_edge"); \
case GATE_OUT_ACTIVE_HIGH: return string( "gate_out_active_high"); \ case GATE_OUT_ACTIVE_HIGH: return std::string( "gate_out_active_high"); \
case GATE_OUT_ACTIVE_LOW: return string( "gate_out_active_low"); \ case GATE_OUT_ACTIVE_LOW: return std::string( "gate_out_active_low"); \
case TRIGGER_OUT_RISING_EDGE: return string( "trigger_out_rising_edge"); \ case TRIGGER_OUT_RISING_EDGE: return std::string( "trigger_out_rising_edge"); \
case TRIGGER_OUT_FALLING_EDGE: return string( "trigger_out_falling_edge"); \ case TRIGGER_OUT_FALLING_EDGE: return std::string( "trigger_out_falling_edge"); \
case RO_TRIGGER_OUT_RISING_EDGE: return string( "ro_trigger_out_rising_edge"); \ case RO_TRIGGER_OUT_RISING_EDGE: return std::string( "ro_trigger_out_rising_edge"); \
case RO_TRIGGER_OUT_FALLING_EDGE: return string( "ro_trigger_out_falling_edge"); \ case RO_TRIGGER_OUT_FALLING_EDGE: return std::string( "ro_trigger_out_falling_edge"); \
case MASTER_SLAVE_SYNCHRONIZATION: return string("sync"); \ case MASTER_SLAVE_SYNCHRONIZATION: return std::string("sync"); \
case OUTPUT_LOW: return string("gnd"); \ case OUTPUT_LOW: return std::string("gnd"); \
case OUTPUT_HIGH: return string("vcc"); \ case OUTPUT_HIGH: return std::string("vcc"); \
default: return string( "unknown"); \ default: return std::string( "unknown"); \
} }; } };
/** returns external signal type index from string /** returns external signal type index from std::string
\param sval off, gate_in_active_high, gate_in_active_low, trigger_in_rising_edge, trigger_in_falling_edge, ro_trigger_in_rising_edge, ro_trigger_in_falling_edge, gate_out_active_high, gate_out_active_low, trigger_out_rising_edge, trigger_out_falling_edge, ro_trigger_out_rising_edge, ro_trigger_out_falling_edge, gnd, vcc, sync, unknown \param sval off, gate_in_active_high, gate_in_active_low, trigger_in_rising_edge, trigger_in_falling_edge, ro_trigger_in_rising_edge, ro_trigger_in_falling_edge, gate_out_active_high, gate_out_active_low, trigger_out_rising_edge, trigger_out_falling_edge, ro_trigger_out_rising_edge, ro_trigger_out_falling_edge, gnd, vcc, sync, unknown
\returns can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE, RO_TRIGGER_OUT_FALLING_EDGE, OUTPUT_LOW, OUTPUT_HIGH, MASTER_SLAVE_SYNCHRONIZATION, GET_EXTERNAL_SIGNAL_FLAG (if unknown) \returns can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE, RO_TRIGGER_OUT_FALLING_EDGE, OUTPUT_LOW, OUTPUT_HIGH, MASTER_SLAVE_SYNCHRONIZATION, GET_EXTERNAL_SIGNAL_FLAG (if unknown)
*/ */
static externalSignalFlag externalSignalType(string sval){\ static externalSignalFlag externalSignalType(std::string sval){\
if (sval=="off") return SIGNAL_OFF;\ if (sval=="off") return SIGNAL_OFF;\
if (sval=="gate_in_active_high") return GATE_IN_ACTIVE_HIGH; \ if (sval=="gate_in_active_high") return GATE_IN_ACTIVE_HIGH; \
if (sval=="gate_in_active_low") return GATE_IN_ACTIVE_LOW;\ if (sval=="gate_in_active_low") return GATE_IN_ACTIVE_LOW;\
@ -743,39 +741,39 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
if (sval=="vcc") return OUTPUT_HIGH;\ if (sval=="vcc") return OUTPUT_HIGH;\
return GET_EXTERNAL_SIGNAL_FLAG ;}; return GET_EXTERNAL_SIGNAL_FLAG ;};
/** returns detector settings string from index /** returns detector settings std::string from index
\param s can be STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN, LOWNOISE, \param s can be STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN, LOWNOISE,
DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2, GET_SETTINGS DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2, GET_SETTINGS
\returns standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, lownoise, \returns standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, lownoise,
dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2, verylowgain, undefined dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2, verylowgain, undefined
*/ */
static string getDetectorSettings(detectorSettings s){\ static std::string getDetectorSettings(detectorSettings s){\
switch(s) { \ switch(s) { \
case STANDARD: return string("standard"); \ case STANDARD: return std::string("standard"); \
case FAST: return string("fast"); \ case FAST: return std::string("fast"); \
case HIGHGAIN: return string("highgain"); \ case HIGHGAIN: return std::string("highgain"); \
case DYNAMICGAIN: return string("dynamicgain"); \ case DYNAMICGAIN: return std::string("dynamicgain"); \
case LOWGAIN: return string("lowgain"); \ case LOWGAIN: return std::string("lowgain"); \
case MEDIUMGAIN: return string("mediumgain"); \ case MEDIUMGAIN: return std::string("mediumgain"); \
case VERYHIGHGAIN: return string("veryhighgain"); \ case VERYHIGHGAIN: return std::string("veryhighgain"); \
case LOWNOISE: return string("lownoise"); \ case LOWNOISE: return std::string("lownoise"); \
case DYNAMICHG0: return string("dynamichg0"); \ case DYNAMICHG0: return std::string("dynamichg0"); \
case FIXGAIN1: return string("fixgain1"); \ case FIXGAIN1: return std::string("fixgain1"); \
case FIXGAIN2: return string("fixgain2"); \ case FIXGAIN2: return std::string("fixgain2"); \
case FORCESWITCHG1: return string("forceswitchg1");\ case FORCESWITCHG1: return std::string("forceswitchg1");\
case FORCESWITCHG2: return string("forceswitchg2");\ case FORCESWITCHG2: return std::string("forceswitchg2");\
case VERYLOWGAIN: return string("verylowgain");\ case VERYLOWGAIN: return std::string("verylowgain");\
default: return string("undefined"); \ default: return std::string("undefined"); \
}}; }};
/** returns detector settings string from index /** returns detector settings std::string from index
\param s can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, lownoise, \param s can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, lownoise,
dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2, undefined dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2, undefined
\returns setting index STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN,LOWNOISE, \returns setting index STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN,LOWNOISE,
DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2, VERYLOWGAIN, GET_SETTINGS DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2, VERYLOWGAIN, GET_SETTINGS
*/ */
static detectorSettings getDetectorSettings(string s){ \ static detectorSettings getDetectorSettings(std::string s){ \
if (s=="standard") return STANDARD; \ if (s=="standard") return STANDARD; \
if (s=="fast") return FAST; \ if (s=="fast") return FAST; \
if (s=="highgain") return HIGHGAIN; \ if (s=="highgain") return HIGHGAIN; \
@ -795,31 +793,31 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
/** /**
returns external communication mode string from index returns external communication mode std::string from index
\param f can be AUTO_TIMING, TRIGGER_EXPOSURE, TRIGGER_READOUT, GATE_FIX_NUMBER, GATE_WITH_START_TRIGGER, BURST_TRIGGER, GET_EXTERNAL_COMMUNICATION_MODE \param f can be AUTO_TIMING, TRIGGER_EXPOSURE, TRIGGER_READOUT, GATE_FIX_NUMBER, GATE_WITH_START_TRIGGER, BURST_TRIGGER, GET_EXTERNAL_COMMUNICATION_MODE
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown \returns auto, trigger, ro_trigger, gating, triggered_gating, unknown
*/ */
static string externalCommunicationType(externalCommunicationMode f){ \ static std::string externalCommunicationType(externalCommunicationMode f){ \
switch(f) { \ switch(f) { \
case AUTO_TIMING: return string( "auto"); \ case AUTO_TIMING: return std::string( "auto"); \
case TRIGGER_EXPOSURE: return string("trigger"); \ case TRIGGER_EXPOSURE: return std::string("trigger"); \
case TRIGGER_READOUT: return string("ro_trigger"); \ case TRIGGER_READOUT: return std::string("ro_trigger"); \
case GATE_FIX_NUMBER: return string("gating"); \ case GATE_FIX_NUMBER: return std::string("gating"); \
case GATE_WITH_START_TRIGGER: return string("triggered_gating"); \ case GATE_WITH_START_TRIGGER: return std::string("triggered_gating"); \
case BURST_TRIGGER: return string("burst_trigger"); \ case BURST_TRIGGER: return std::string("burst_trigger"); \
default: return string( "unknown"); \ default: return std::string( "unknown"); \
} }; } };
/** /**
returns external communication mode index from string returns external communication mode index from std::string
\param sval can be auto, trigger, ro_trigger, gating, triggered_gating \param sval can be auto, trigger, ro_trigger, gating, triggered_gating
\returns AUTO_TIMING, TRIGGER_EXPOSURE, TRIGGER_READOUT, GATE_FIX_NUMBER, GATE_WITH_START_TRIGGER, BURST_TRIGGER, GET_EXTERNAL_COMMUNICATION_MODE \returns AUTO_TIMING, TRIGGER_EXPOSURE, TRIGGER_READOUT, GATE_FIX_NUMBER, GATE_WITH_START_TRIGGER, BURST_TRIGGER, GET_EXTERNAL_COMMUNICATION_MODE
*/ */
static externalCommunicationMode externalCommunicationType(string sval){\ static externalCommunicationMode externalCommunicationType(std::string sval){\
if (sval=="auto") return AUTO_TIMING;\ if (sval=="auto") return AUTO_TIMING;\
if (sval=="trigger") return TRIGGER_EXPOSURE; \ if (sval=="trigger") return TRIGGER_EXPOSURE; \
if (sval=="ro_trigger") return TRIGGER_READOUT;\ if (sval=="ro_trigger") return TRIGGER_READOUT;\
@ -829,66 +827,66 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
return GET_EXTERNAL_COMMUNICATION_MODE; \ return GET_EXTERNAL_COMMUNICATION_MODE; \
}; };
/** returns string from run status index /** returns std::string from run status index
\param s can be ERROR, WAITING, RUNNING, TRANSMITTING, RUN_FINISHED \param s can be ERROR, WAITING, RUNNING, TRANSMITTING, RUN_FINISHED
\returns string error, waiting, running, data, finished \returns std::string error, waiting, running, data, finished
*/ */
static string runStatusType(runStatus s){\ static std::string runStatusType(runStatus s){\
switch (s) { \ switch (s) { \
case ERROR: return string("error"); \ case ERROR: return std::string("error"); \
case WAITING: return string("waiting"); \ case WAITING: return std::string("waiting"); \
case RUNNING: return string("running");\ case RUNNING: return std::string("running");\
case TRANSMITTING: return string("data"); \ case TRANSMITTING: return std::string("data"); \
case RUN_FINISHED: return string("finished"); \ case RUN_FINISHED: return std::string("finished"); \
default: return string("idle"); \ default: return std::string("idle"); \
}}; }};
/** returns string from file format index /** returns std::string from file format index
\param s can be RAW, HDF5 \param s can be RAW, HDF5
\returns string raw, hdf5 \returns std::string raw, hdf5
*/ */
static string fileFormats(fileFormat f){\ static std::string fileFormats(fileFormat f){\
switch (f) { \ switch (f) { \
case BINARY: return string("binary"); \ case BINARY: return std::string("binary"); \
case ASCII: return string("ascii"); \ case ASCII: return std::string("ascii"); \
case HDF5: return string("hdf5"); \ case HDF5: return std::string("hdf5"); \
default: return string("unknown"); \ default: return std::string("unknown"); \
}}; }};
/** returns string from timer index /** returns std::string from timer index
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_PERIOD \param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_PERIOD
\returns string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, subframe_period \returns std::string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, subframe_period
*/ */
static string getTimerType(timerIndex t){ \ static std::string getTimerType(timerIndex t){ \
switch (t) { \ switch (t) { \
case FRAME_NUMBER: return string("frame_number"); \ case FRAME_NUMBER: return std::string("frame_number"); \
case ACQUISITION_TIME: return string("acquisition_time"); \ case ACQUISITION_TIME: return std::string("acquisition_time"); \
case FRAME_PERIOD: return string("frame_period"); \ case FRAME_PERIOD: return std::string("frame_period"); \
case DELAY_AFTER_TRIGGER: return string("delay_after_trigger"); \ case DELAY_AFTER_TRIGGER: return std::string("delay_after_trigger"); \
case GATES_NUMBER: return string("gates_number"); \ case GATES_NUMBER: return std::string("gates_number"); \
case PROBES_NUMBER: return string("probes_number"); \ case PROBES_NUMBER: return std::string("probes_number"); \
case CYCLES_NUMBER: return string("cycles_number"); \ case CYCLES_NUMBER: return std::string("cycles_number"); \
case ACTUAL_TIME: return string("actual_time"); \ case ACTUAL_TIME: return std::string("actual_time"); \
case MEASUREMENT_TIME: return string("measurement_time"); \ case MEASUREMENT_TIME: return std::string("measurement_time"); \
case PROGRESS: return string("progress"); \ case PROGRESS: return std::string("progress"); \
case MEASUREMENTS_NUMBER: return string("measurements_number"); \ case MEASUREMENTS_NUMBER: return std::string("measurements_number"); \
case FRAMES_FROM_START: return string("frames_from_start"); \ case FRAMES_FROM_START: return std::string("frames_from_start"); \
case FRAMES_FROM_START_PG: return string("frames_from_start_pg"); \ case FRAMES_FROM_START_PG: return std::string("frames_from_start_pg"); \
case SAMPLES_JCTB: return string("samples_jctb"); \ case SAMPLES_JCTB: return std::string("samples_jctb"); \
case SUBFRAME_ACQUISITION_TIME: return string("subframe_acquisition_time"); \ case SUBFRAME_ACQUISITION_TIME: return std::string("subframe_acquisition_time"); \
case SUBFRAME_PERIOD: return string("subframe_period"); \ case SUBFRAME_PERIOD: return std::string("subframe_period"); \
case STORAGE_CELL_NUMBER: return string("storage_cell_number"); \ case STORAGE_CELL_NUMBER: return std::string("storage_cell_number"); \
default: return string("unknown"); \ default: return std::string("unknown"); \
}}; }};
/** /**
@short returns adc index from string @short returns adc index from std::string
\param s can be temp_fpga, temp_fpgaext, temp_10ge, temp_dcdc, temp_sodl, temp_sodr, temp_fpgafl, temp_fpgafr \param s can be temp_fpga, temp_fpgaext, temp_10ge, temp_dcdc, temp_sodl, temp_sodr, temp_fpgafl, temp_fpgafr
\returns TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, TEMPERATURE_DCDC, TEMPERATURE_SODL, \returns TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, TEMPERATURE_DCDC, TEMPERATURE_SODL,
TEMPERATURE_SODR, TEMPERATURE_FPGA2, TEMPERATURE_FPGA3, -1 when unknown mode TEMPERATURE_SODR, TEMPERATURE_FPGA2, TEMPERATURE_FPGA3, -1 when unknown mode
*/ */
static int getADCIndex(string s){ static int getADCIndex(std::string s){
if (s=="temp_fpga") return TEMPERATURE_FPGA; if (s=="temp_fpga") return TEMPERATURE_FPGA;
if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT; if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT;
if (s=="temp_10ge") return TEMPERATURE_10GE; if (s=="temp_10ge") return TEMPERATURE_10GE;
@ -902,11 +900,11 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
/** /**
@short returns dac index from string @short returns dac index from std::string
\param s can be vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr, vthreshold, vrf, vrs, vtr, vcall, vcp \param s can be vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr, vthreshold, vrf, vrs, vtr, vcall, vcp
\returns E_Vcmp_ll, E_Vcmp_lr, E_Vcmp_rl, E_Vcmp_rr, THRESHOLD, E_Vrf, E_Vrs, E_Vtr, E_cal, E_Vcp , -1 when unknown mode \returns E_Vcmp_ll, E_Vcmp_lr, E_Vcmp_rl, E_Vcmp_rr, THRESHOLD, E_Vrf, E_Vrs, E_Vtr, E_cal, E_Vcp , -1 when unknown mode
*/ */
static int getDACIndex(string s){ static int getDACIndex(std::string s){
if (s=="vcmp_ll") return E_Vcmp_ll; if (s=="vcmp_ll") return E_Vcmp_ll;
if (s=="vcmp_lr") return E_Vcmp_lr; if (s=="vcmp_lr") return E_Vcmp_lr;
if (s=="vcmp_rl") return E_Vcmp_rl; if (s=="vcmp_rl") return E_Vcmp_rl;

View File

@ -6,6 +6,8 @@
#include <cstdlib> #include <cstdlib>
#include <iomanip> #include <iomanip>
using namespace std;
/*! \mainpage Introduction /*! \mainpage Introduction
This program is intended to control the SLS detectors via command line interface. This program is intended to control the SLS detectors via command line interface.

View File

@ -5,7 +5,7 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include "slsDetectorUtils.h" #include "slsDetectorUtils.h"
using namespace std;
/** @short This class handles the command line I/Os, help etc. of the text clients */ /** @short This class handles the command line I/Os, help etc. of the text clients */
@ -26,68 +26,68 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */ /* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
/* \returns answer string */ /* \returns answer string */
/* *\/ */ /* *\/ */
virtual string executeLine(int narg, char *args[], int action); virtual std::string executeLine(int narg, char *args[], int action);
/* /\** */ /* /\** */
/* returns the help for the executeLine command */ /* returns the help for the executeLine command */
/* \param os output stream to return the help to */ /* \param os output stream to return the help to */
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */ /* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
/* *\/ */ /* *\/ */
string helpLine(int narg, char *args[], int action=HELP_ACTION); std::string helpLine(int narg, char *args[], int action=HELP_ACTION);
static string helpAcquire(int narg, char *args[], int action); static std::string helpAcquire(int narg, char *args[], int action);
static string helpData(int narg, char *args[], int action); static std::string helpData(int narg, char *args[], int action);
static string helpFrame(int narg, char *args[], int action); static std::string helpFrame(int narg, char *args[], int action);
static string helpStatus(int narg, char *args[], int action); static std::string helpStatus(int narg, char *args[], int action);
static string helpDataStream(int narg, char *args[], int action); static std::string helpDataStream(int narg, char *args[], int action);
static string helpFree(int narg, char *args[], int action); static std::string helpFree(int narg, char *args[], int action);
static string helpAdd(int narg, char *args[], int action); static std::string helpAdd(int narg, char *args[], int action);
static string helpRemove(int narg, char *args[], int action); static std::string helpRemove(int narg, char *args[], int action);
static string helpHostname(int narg, char *args[], int action); static std::string helpHostname(int narg, char *args[], int action);
static string helpId(int narg, char *args[], int action); static std::string helpId(int narg, char *args[], int action);
static string helpMaster(int narg, char *args[], int action); static std::string helpMaster(int narg, char *args[], int action);
static string helpSync(int narg, char *args[], int action); static std::string helpSync(int narg, char *args[], int action);
static string helpExitServer(int narg, char *args[], int action); static std::string helpExitServer(int narg, char *args[], int action);
static string helpSettingsDir(int narg, char *args[], int action); static std::string helpSettingsDir(int narg, char *args[], int action);
static string helpCalDir(int narg, char *args[], int action); static std::string helpCalDir(int narg, char *args[], int action);
static string helpTrimEn(int narg, char *args[], int action); static std::string helpTrimEn(int narg, char *args[], int action);
static string helpOutDir(int narg, char *args[], int action); static std::string helpOutDir(int narg, char *args[], int action);
static string helpFileName(int narg, char *args[], int action); static std::string helpFileName(int narg, char *args[], int action);
static string helpFileIndex(int narg, char *args[], int action); static std::string helpFileIndex(int narg, char *args[], int action);
static string helpFlatField(int narg, char *args[], int action); static std::string helpFlatField(int narg, char *args[], int action);
static string helpRateCorr(int narg, char *args[], int action); static std::string helpRateCorr(int narg, char *args[], int action);
static string helpBadChannels(int narg, char *args[], int action); static std::string helpBadChannels(int narg, char *args[], int action);
static string helpAngConv(int narg, char *args[], int action); static std::string helpAngConv(int narg, char *args[], int action);
static string helpThreaded(int narg, char *args[], int action); static std::string helpThreaded(int narg, char *args[], int action);
static string helpPositions(int narg, char *args[], int action); static std::string helpPositions(int narg, char *args[], int action);
static string helpScripts(int narg, char *args[], int action); static std::string helpScripts(int narg, char *args[], int action);
static string helpScans(int narg, char *args[], int action); static std::string helpScans(int narg, char *args[], int action);
static string helpNetworkParameter(int narg, char *args[], int action); static std::string helpNetworkParameter(int narg, char *args[], int action);
static string helpPort(int narg, char *args[], int action); static std::string helpPort(int narg, char *args[], int action);
static string helpLock(int narg, char *args[], int action); static std::string helpLock(int narg, char *args[], int action);
static string helpLastClient(int narg, char *args[], int action); static std::string helpLastClient(int narg, char *args[], int action);
static string helpOnline(int narg, char *args[], int action); static std::string helpOnline(int narg, char *args[], int action);
static string helpConfigureMac(int narg, char *args[], int action); static std::string helpConfigureMac(int narg, char *args[], int action);
static string helpDetectorSize(int narg, char *args[], int action); static std::string helpDetectorSize(int narg, char *args[], int action);
static string helpSettings(int narg, char *args[], int action); static std::string helpSettings(int narg, char *args[], int action);
static string helpSN(int narg, char *args[], int action); static std::string helpSN(int narg, char *args[], int action);
static string helpDigiTest(int narg, char *args[], int action); static std::string helpDigiTest(int narg, char *args[], int action);
static string helpRegister(int narg, char *args[], int action); static std::string helpRegister(int narg, char *args[], int action);
static string helpDAC(int narg, char *args[], int action); static std::string helpDAC(int narg, char *args[], int action);
static string helpTimer(int narg, char *args[], int action); static std::string helpTimer(int narg, char *args[], int action);
static string helpTiming(int narg, char *args[], int action); static std::string helpTiming(int narg, char *args[], int action);
static string helpTimeLeft(int narg, char *args[], int action); static std::string helpTimeLeft(int narg, char *args[], int action);
static string helpSpeed(int narg, char *args[], int action); static std::string helpSpeed(int narg, char *args[], int action);
static string helpAdvanced(int narg, char *args[], int action); static std::string helpAdvanced(int narg, char *args[], int action);
static string helpConfiguration(int narg, char *args[], int action); static std::string helpConfiguration(int narg, char *args[], int action);
static string helpImage(int narg, char *args[], int action); static std::string helpImage(int narg, char *args[], int action);
static string helpCounter(int narg, char *args[], int action); static std::string helpCounter(int narg, char *args[], int action);
static string helpADC(int narg, char *args[], int action); static std::string helpADC(int narg, char *args[], int action);
static string helpTempControl(int narg, char *args[], int action); static std::string helpTempControl(int narg, char *args[], int action);
static string helpEnablefwrite(int narg, char *args[], int action); static std::string helpEnablefwrite(int narg, char *args[], int action);
static string helpOverwrite(int narg, char *args[], int action); static std::string helpOverwrite(int narg, char *args[], int action);
static string helpReceiver(int narg, char *args[], int action); static std::string helpReceiver(int narg, char *args[], int action);
static string helpPattern(int narg, char *args[], int action); static std::string helpPattern(int narg, char *args[], int action);
static string helpPulse(int narg, char *args[], int action); static std::string helpPulse(int narg, char *args[], int action);
@ -105,74 +105,74 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
slsDetectorUtils *myDet; slsDetectorUtils *myDet;
string cmdUnderDevelopment(int narg, char *args[], int action); std::string cmdUnderDevelopment(int narg, char *args[], int action);
string cmdUnknown(int narg, char *args[], int action); std::string cmdUnknown(int narg, char *args[], int action);
string cmdAcquire(int narg, char *args[], int action); std::string cmdAcquire(int narg, char *args[], int action);
string cmdData(int narg, char *args[], int action); std::string cmdData(int narg, char *args[], int action);
string cmdFrame(int narg, char *args[], int action); std::string cmdFrame(int narg, char *args[], int action);
string cmdStatus(int narg, char *args[], int action); std::string cmdStatus(int narg, char *args[], int action);
string cmdDataStream(int narg, char *args[], int action); std::string cmdDataStream(int narg, char *args[], int action);
string cmdFree(int narg, char *args[], int action); std::string cmdFree(int narg, char *args[], int action);
string cmdAdd(int narg, char *args[], int action); std::string cmdAdd(int narg, char *args[], int action);
string cmdRemove(int narg, char *args[], int action); std::string cmdRemove(int narg, char *args[], int action);
string cmdHostname(int narg, char *args[], int action); std::string cmdHostname(int narg, char *args[], int action);
string cmdId(int narg, char *args[], int action); std::string cmdId(int narg, char *args[], int action);
string cmdMaster(int narg, char *args[], int action); std::string cmdMaster(int narg, char *args[], int action);
string cmdSync(int narg, char *args[], int action); std::string cmdSync(int narg, char *args[], int action);
string cmdHelp(int narg, char *args[], int action); std::string cmdHelp(int narg, char *args[], int action);
string cmdExitServer(int narg, char *args[], int action); std::string cmdExitServer(int narg, char *args[], int action);
string cmdSettingsDir(int narg, char *args[], int action); std::string cmdSettingsDir(int narg, char *args[], int action);
string cmdCalDir(int narg, char *args[], int action); std::string cmdCalDir(int narg, char *args[], int action);
string cmdTrimEn(int narg, char *args[], int action); std::string cmdTrimEn(int narg, char *args[], int action);
string cmdOutDir(int narg, char *args[], int action); std::string cmdOutDir(int narg, char *args[], int action);
string cmdFileName(int narg, char *args[], int action); std::string cmdFileName(int narg, char *args[], int action);
string cmdFileIndex(int narg, char *args[], int action); std::string cmdFileIndex(int narg, char *args[], int action);
string cmdFlatField(int narg, char *args[], int action); std::string cmdFlatField(int narg, char *args[], int action);
string cmdRateCorr(int narg, char *args[], int action); std::string cmdRateCorr(int narg, char *args[], int action);
string cmdBadChannels(int narg, char *args[], int action); std::string cmdBadChannels(int narg, char *args[], int action);
string cmdAngConv(int narg, char *args[], int action); std::string cmdAngConv(int narg, char *args[], int action);
string cmdThreaded(int narg, char *args[], int action); std::string cmdThreaded(int narg, char *args[], int action);
string cmdPositions(int narg, char *args[], int action); std::string cmdPositions(int narg, char *args[], int action);
string cmdScripts(int narg, char *args[], int action); std::string cmdScripts(int narg, char *args[], int action);
string cmdScans(int narg, char *args[], int action); std::string cmdScans(int narg, char *args[], int action);
string cmdNetworkParameter(int narg, char *args[], int action); std::string cmdNetworkParameter(int narg, char *args[], int action);
string cmdPort(int narg, char *args[], int action); std::string cmdPort(int narg, char *args[], int action);
string cmdLock(int narg, char *args[], int action); std::string cmdLock(int narg, char *args[], int action);
string cmdLastClient(int narg, char *args[], int action); std::string cmdLastClient(int narg, char *args[], int action);
string cmdOnline(int narg, char *args[], int action); std::string cmdOnline(int narg, char *args[], int action);
string cmdConfigureMac(int narg, char *args[], int action); std::string cmdConfigureMac(int narg, char *args[], int action);
string cmdDetectorSize(int narg, char *args[], int action); std::string cmdDetectorSize(int narg, char *args[], int action);
string cmdSettings(int narg, char *args[], int action); std::string cmdSettings(int narg, char *args[], int action);
string cmdSN(int narg, char *args[], int action); std::string cmdSN(int narg, char *args[], int action);
string cmdDigiTest(int narg, char *args[], int action); std::string cmdDigiTest(int narg, char *args[], int action);
string cmdRegister(int narg, char *args[], int action); std::string cmdRegister(int narg, char *args[], int action);
string cmdDAC(int narg, char *args[], int action); std::string cmdDAC(int narg, char *args[], int action);
string cmdTiming(int narg, char *args[], int action); std::string cmdTiming(int narg, char *args[], int action);
string cmdTimer(int narg, char *args[], int action); std::string cmdTimer(int narg, char *args[], int action);
string cmdTimeLeft(int narg, char *args[], int action); std::string cmdTimeLeft(int narg, char *args[], int action);
string cmdSpeed(int narg, char *args[], int action); std::string cmdSpeed(int narg, char *args[], int action);
string cmdAdvanced(int narg, char *args[], int action); std::string cmdAdvanced(int narg, char *args[], int action);
string cmdConfiguration(int narg, char *args[], int action); std::string cmdConfiguration(int narg, char *args[], int action);
string cmdImage(int narg, char *args[], int action); std::string cmdImage(int narg, char *args[], int action);
string cmdCounter(int narg, char *args[], int action); std::string cmdCounter(int narg, char *args[], int action);
string cmdADC(int narg, char *args[], int action); std::string cmdADC(int narg, char *args[], int action);
string cmdTempControl(int narg, char *args[], int action); std::string cmdTempControl(int narg, char *args[], int action);
string cmdEnablefwrite(int narg, char *args[], int action); std::string cmdEnablefwrite(int narg, char *args[], int action);
string cmdOverwrite(int narg, char *args[], int action); std::string cmdOverwrite(int narg, char *args[], int action);
string cmdReceiver(int narg, char *args[], int action); std::string cmdReceiver(int narg, char *args[], int action);
string cmdPattern(int narg, char *args[], int action); std::string cmdPattern(int narg, char *args[], int action);
string cmdPulse(int narg, char *args[], int action); std::string cmdPulse(int narg, char *args[], int action);
int numberOfCommands; int numberOfCommands;
string cmd; std::string cmd;
typedef string (slsDetectorCommand::*MemFuncGetter)(int narg, char *args[], int action); typedef std::string (slsDetectorCommand::*MemFuncGetter)(int narg, char *args[], int action);
struct FuncTable struct FuncTable
{ {
string m_pFuncName; std::string m_pFuncName;
//const char* m_pFuncName; //const char* m_pFuncName;
MemFuncGetter m_pFuncPtr; MemFuncGetter m_pFuncPtr;
}; };

View File

@ -4,6 +4,8 @@
#include "multiSlsDetectorCommand.h" #include "multiSlsDetectorCommand.h"
using namespace std;
slsDetectorUsers::slsDetectorUsers(int id) : myDetector(NULL){ slsDetectorUsers::slsDetectorUsers(int id) : myDetector(NULL){
myDetector=new multiSlsDetector(id); myDetector=new multiSlsDetector(id);

View File

@ -22,7 +22,7 @@ class multiSlsDetectorCommand;
#include <string> #include <string>
using namespace std;
@ -100,7 +100,7 @@ class slsDetectorUsers
@short useful to define subset of working functions @short useful to define subset of working functions
\returns "PSI" or "Dectris" \returns "PSI" or "Dectris"
*/ */
string getDetectorDeveloper(); std::string getDetectorDeveloper();
@ -138,20 +138,20 @@ class slsDetectorUsers
/** /**
@short returns the default output files path @short returns the default output files path
*/ */
string getFilePath(); std::string getFilePath();
/** /**
@short sets the default output files path @short sets the default output files path
\param s file path \param s file path
\returns file path \returns file path
*/ */
string setFilePath(string s); std::string setFilePath(std::string s);
/** /**
@short @short
\returns the default output files root name \returns the default output files root name
*/ */
string getFileName(); std::string getFileName();
/** /**
@short sets the default output files path @short sets the default output files path
@ -159,7 +159,7 @@ class slsDetectorUsers
\returns the default output files root name \returns the default output files root name
*/ */
string setFileName(string s); std::string setFileName(std::string s);
/** /**
@short @short
@ -178,27 +178,27 @@ class slsDetectorUsers
@short get flat field corrections file directory @short get flat field corrections file directory
\returns flat field correction file directory \returns flat field correction file directory
*/ */
string getFlatFieldCorrectionDir(); std::string getFlatFieldCorrectionDir();
/** /**
@short set flat field corrections file directory @short set flat field corrections file directory
\param dir flat field correction file directory \param dir flat field correction file directory
\returns flat field correction file directory \returns flat field correction file directory
*/ */
string setFlatFieldCorrectionDir(string dir); std::string setFlatFieldCorrectionDir(std::string dir);
/** /**
@short get flat field corrections file name @short get flat field corrections file name
\returns flat field correction file name \returns flat field correction file name
*/ */
string getFlatFieldCorrectionFile(); std::string getFlatFieldCorrectionFile();
/** /**
@short set flat field correction file @short set flat field correction file
\param fname name of the flat field file (or "" if disable) \param fname name of the flat field file (or "" if disable)
\returns 0 if disable (or file could not be read), >0 otherwise \returns 0 if disable (or file could not be read), >0 otherwise
*/ */
int setFlatFieldCorrectionFile(string fname=""); int setFlatFieldCorrectionFile(std::string fname="");
@ -380,7 +380,7 @@ class slsDetectorUsers
\param fname file name \param fname file name
\returns OK or FAIL \returns OK or FAIL
*/ */
int readConfigurationFile(string const fname); int readConfigurationFile(std::string const fname);
/** /**
@ -389,20 +389,20 @@ class slsDetectorUsers
\returns OK or FAIL \returns OK or FAIL
*/ */
int dumpDetectorSetup(string const fname); int dumpDetectorSetup(std::string const fname);
/** /**
@short Loads the detector setup from file @short Loads the detector setup from file
\param fname file to read from \param fname file to read from
\returns OK or FAIL \returns OK or FAIL
*/ */
int retrieveDetectorSetup(string const fname); int retrieveDetectorSetup(std::string const fname);
/** /**
@short useful for data plotting etc. @short useful for data plotting etc.
\returns Mythen, Eiger, Gotthard etc. \returns Mythen, Eiger, Gotthard etc.
*/ */
string getDetectorType(); std::string getDetectorType();
/** /**
@short sets the mode by which gui requests data from receiver @short sets the mode by which gui requests data from receiver
@ -443,7 +443,7 @@ class slsDetectorUsers
\param var optional parameter - unused. \param var optional parameter - unused.
*/ */
virtual void addFrame(double *data, double pos, double i0, double t, string fname, double var); virtual void addFrame(double *data, double pos, double i0, double t, std::string fname, double var);
/** /**
@short finalizes the data set returning the array of angles, values and errors to be used as final data - can be overcome by the user's functions thanks to the virtual property @short finalizes the data set returning the array of angles, values and errors to be used as final data - can be overcome by the user's functions thanks to the virtual property
@ -488,18 +488,18 @@ class slsDetectorUsers
/** (for expert users) /** (for expert users)
* Set/Get receiver streaming out ZMQ IP * Set/Get receiver streaming out ZMQ IP
* By default, it is the IP of receiver hostname * By default, it is the IP of receiver hostname
* @param ip sets, empty string gets * @param ip sets, empty std::string gets
* @returns receiver streaming out ZMQ IP * @returns receiver streaming out ZMQ IP
*/ */
string setReceiverDataStreamingOutIP(string ip=""); std::string setReceiverDataStreamingOutIP(std::string ip="");
/** (for expert users) /** (for expert users)
* Set/Get client streaming in ZMQ IP * Set/Get client streaming in ZMQ IP
* By default, it is the IP of receiver hostname * By default, it is the IP of receiver hostname
* @param i sets, empty string gets * @param i sets, empty std::string gets
* @returns client streaming in ZMQ IP * @returns client streaming in ZMQ IP
*/ */
string setClientDataStreamingInIP(string ip=""); std::string setClientDataStreamingInIP(std::string ip="");
/** /**
get get Module Firmware Version get get Module Firmware Version
@ -590,18 +590,18 @@ class slsDetectorUsers
\param narg value to be set \param narg value to be set
\param args value to be set \param args value to be set
\param pos position of detector in multislsdetector list \param pos position of detector in multislsdetector list
\returns answer string \returns answer std::string
*/ */
string putCommand(int narg, char *args[], int pos=-1); std::string putCommand(int narg, char *args[], int pos=-1);
/** /**
@short gets parameters in command interface http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowTo.pdf @short gets parameters in command interface http://www.psi.ch/detectors/UsersSupportEN/slsDetectorClientHowTo.pdf
\param narg value to be set \param narg value to be set
\param args value to be set \param args value to be set
\param pos position of detector in multislsdetector list \param pos position of detector in multislsdetector list
\returns answer string \returns answer std::string
*/ */
string getCommand(int narg, char *args[], int pos=-1); std::string getCommand(int narg, char *args[], int pos=-1);
/************************************************************************ /************************************************************************
@ -639,20 +639,20 @@ class slsDetectorUsers
/** /**
@short set dac value @short set dac value
\param dac dac as string. can be vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr, vthreshold, vrf, vrs, vtr, vcall, vcp. others not supported \param dac dac as std::string. can be vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr, vthreshold, vrf, vrs, vtr, vcall, vcp. others not supported
\param val value to be set (-1 gets) \param val value to be set (-1 gets)
\param id module index (-1 for all) \param id module index (-1 for all)
\returns dac value or -1 (if id=-1 & dac value is different for all modules) or -9999 if dac string does not match \returns dac value or -1 (if id=-1 & dac value is different for all modules) or -9999 if dac std::string does not match
*/ */
int setDAC(string dac, int val, int id = -1); int setDAC(std::string dac, int val, int id = -1);
/** /**
@short get adc value @short get adc value
\param adc adc as string. can be temp_fpga, temp_fpgaext, temp_10ge, temp_dcdc, temp_sodl, temp_sodr, temp_fpgafl, temp_fpgafr. others not supported \param adc adc as std::string. can be temp_fpga, temp_fpgaext, temp_10ge, temp_dcdc, temp_sodl, temp_sodr, temp_fpgafl, temp_fpgafr. others not supported
\param id module index (-1 for all) \param id module index (-1 for all)
\returns adc value in millidegree Celsius or -1 (if id=-1 & adc value is different for all modules) or -9999 if adc string does not match \returns adc value in millidegree Celsius or -1 (if id=-1 & adc value is different for all modules) or -9999 if adc std::string does not match
*/ */
int getADC(string adc, int id = -1); int getADC(std::string adc, int id = -1);
/** /**
@short start receiver listening mode @short start receiver listening mode
@ -750,29 +750,29 @@ class slsDetectorUsers
*********************************************************************/ *********************************************************************/
/** @short returns string from run status index /** @short returns std::string from run status index
\param s run status index \param s run status index
\returns string error, waiting, running, data, finished or unknown when wrong index \returns std::string error, waiting, running, data, finished or unknown when wrong index
*/ */
static string runStatusType(int s){ \ static std::string runStatusType(int s){ \
switch (s) { \ switch (s) { \
case 0: return string("idle"); \ case 0: return std::string("idle"); \
case 1: return string("error"); \ case 1: return std::string("error"); \
case 2: return string("waiting"); \ case 2: return std::string("waiting"); \
case 3: return string("finished"); \ case 3: return std::string("finished"); \
case 4: return string("data"); \ case 4: return std::string("data"); \
case 5: return string("running"); \ case 5: return std::string("running"); \
default: return string("unknown"); \ default: return std::string("unknown"); \
}}; }};
/** @short returns detector settings string from index /** @short returns detector settings std::string from index
\param s can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain \param s can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain
\returns setting index (-1 unknown string) \returns setting index (-1 unknown std::string)
*/ */
static int getDetectorSettings(string s){ \ static int getDetectorSettings(std::string s){ \
if (s=="standard") return 0; \ if (s=="standard") return 0; \
if (s=="fast") return 1; \ if (s=="fast") return 1; \
if (s=="highgain") return 2; \ if (s=="highgain") return 2; \
@ -782,47 +782,47 @@ class slsDetectorUsers
if (s=="veryhighgain") return 6; \ if (s=="veryhighgain") return 6; \
return -1; }; return -1; };
/** @short returns detector settings string from index /** @short returns detector settings std::string from index
\param s settings index \param s settings index
\returns standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, undefined when wrong index \returns standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, undefined when wrong index
*/ */
static string getDetectorSettings(int s){\ static std::string getDetectorSettings(int s){\
switch(s) { \ switch(s) { \
case 0: return string("standard");\ case 0: return std::string("standard");\
case 1: return string("fast");\ case 1: return std::string("fast");\
case 2: return string("highgain");\ case 2: return std::string("highgain");\
case 3: return string("dynamicgain"); \ case 3: return std::string("dynamicgain"); \
case 4: return string("lowgain"); \ case 4: return std::string("lowgain"); \
case 5: return string("mediumgain"); \ case 5: return std::string("mediumgain"); \
case 6: return string("veryhighgain"); \ case 6: return std::string("veryhighgain"); \
default: return string("undefined"); \ default: return std::string("undefined"); \
}}; }};
/** /**
@short returns external communication mode string from index @short returns external communication mode std::string from index
\param f index for communication mode \param f index for communication mode
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode \returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode
*/ */
static string getTimingMode(int f){ \ static std::string getTimingMode(int f){ \
switch(f) { \ switch(f) { \
case 0: return string( "auto"); \ case 0: return std::string( "auto"); \
case 1: return string("trigger"); \ case 1: return std::string("trigger"); \
case 2: return string("ro_trigger"); \ case 2: return std::string("ro_trigger"); \
case 3: return string("gating"); \ case 3: return std::string("gating"); \
case 4: return string("triggered_gating"); \ case 4: return std::string("triggered_gating"); \
default: return string( "unknown"); \ default: return std::string( "unknown"); \
} }; } };
/** /**
@short returns external communication mode string from index @short returns external communication mode std::string from index
\param s index for communication mode \param s index for communication mode
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode \returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode
*/ */
static int getTimingMode(string s){ \ static int getTimingMode(std::string s){ \
if (s== "auto") return 0; \ if (s== "auto") return 0; \
if (s== "trigger") return 1; \ if (s== "trigger") return 1; \
if (s== "ro_trigger") return 2; \ if (s== "ro_trigger") return 2; \

View File

@ -9,7 +9,9 @@
#include <sys/ipc.h> #include <sys/ipc.h>
#include <sys/shm.h> #include <sys/shm.h>
#include <time.h> //clock() #include <time.h> //clock()
#include <string>
using namespace std; using namespace std;
slsDetectorUtils::slsDetectorUtils() { slsDetectorUtils::slsDetectorUtils() {

View File

@ -31,7 +31,7 @@ extern "C" {
#include <math.h> #include <math.h>
#include <semaphore.h> #include <semaphore.h>
#include <cstdlib> #include <cstdlib>
using namespace std;
//#include "slsDetectorActions_Standalone.h" //#include "slsDetectorActions_Standalone.h"
@ -110,7 +110,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
*/ */
int setReceiverDataStreamingOutPort(int i) { \ int setReceiverDataStreamingOutPort(int i) { \
if (i >= 0) { \ if (i >= 0) { \
ostringstream ss; ss << i; string s = ss.str(); \ std::ostringstream ss; ss << i; std::string s = ss.str(); \
int prev_streaming = enableDataStreamingFromReceiver(); \ int prev_streaming = enableDataStreamingFromReceiver(); \
setNetworkParameter(RECEIVER_STREAMING_PORT, s); \ setNetworkParameter(RECEIVER_STREAMING_PORT, s); \
if (prev_streaming) { \ if (prev_streaming) { \
@ -126,7 +126,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
*/ */
int setClientDataStreamingInPort(int i){ \ int setClientDataStreamingInPort(int i){ \
if (i >= 0) { \ if (i >= 0) { \
ostringstream ss; ss << i; string s = ss.str(); \ std::ostringstream ss; ss << i; std::string s = ss.str(); \
int prev_streaming = enableDataStreamingToClient(); \ int prev_streaming = enableDataStreamingToClient(); \
setNetworkParameter(CLIENT_STREAMING_PORT, s); \ setNetworkParameter(CLIENT_STREAMING_PORT, s); \
if (prev_streaming) { \ if (prev_streaming) { \
@ -140,7 +140,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
* @param i sets, -1 gets * @param i sets, -1 gets
* @returns receiver streaming out ZMQ port * @returns receiver streaming out ZMQ port
*/ */
string setReceiverDataStreamingOutIP(string ip) { \ std::string setReceiverDataStreamingOutIP(std::string ip) { \
if (ip.length()) { \ if (ip.length()) { \
int prev_streaming = enableDataStreamingFromReceiver(); \ int prev_streaming = enableDataStreamingFromReceiver(); \
setNetworkParameter(RECEIVER_STREAMING_SRC_IP, ip); \ setNetworkParameter(RECEIVER_STREAMING_SRC_IP, ip); \
@ -155,7 +155,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
* @param i sets, -1 gets * @param i sets, -1 gets
* @returns client streaming in ZMQ port * @returns client streaming in ZMQ port
*/ */
string setClientDataStreamingInIP(string ip){ \ std::string setClientDataStreamingInIP(std::string ip){ \
if (ip.length()) { \ if (ip.length()) { \
int prev_streaming = enableDataStreamingToClient(); \ int prev_streaming = enableDataStreamingToClient(); \
setNetworkParameter(CLIENT_STREAMING_SRC_IP, ip); \ setNetworkParameter(CLIENT_STREAMING_SRC_IP, ip); \
@ -199,7 +199,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\param pos position in the multi detector structure (is -1 returns concatenated hostnames divided by a +) \param pos position in the multi detector structure (is -1 returns concatenated hostnames divided by a +)
\returns hostname \returns hostname
*/ */
virtual string getHostname(int pos=-1)=0; virtual std::string getHostname(int pos=-1)=0;
/** sets the detector hostname /** sets the detector hostname
@ -207,22 +207,22 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\param pos position in the multi detector structure (is -1 expects concatenated hostnames divided by a +) \param pos position in the multi detector structure (is -1 expects concatenated hostnames divided by a +)
\returns hostname \returns hostname
*/ */
virtual string setHostname(const char* name, int pos=-1)=0; virtual std::string setHostname(const char* name, int pos=-1)=0;
/** returns the detector type /** returns the detector type
\param pos position in the multi detector structure (is -1 returns type of detector with id -1) \param pos position in the multi detector structure (is -1 returns type of detector with id -1)
\returns type \returns type
*/ */
virtual string sgetDetectorsType(int pos=-1)=0; virtual std::string sgetDetectorsType(int pos=-1)=0;
/** returns the detector type /** returns the detector type
\param pos position in the multi detector structure (is -1 returns type of detector with id -1) \param pos position in the multi detector structure (is -1 returns type of detector with id -1)
\returns type \returns type
*/ */
virtual detectorType setDetectorsType(detectorType t=GET_DETECTOR_TYPE, int pos=-1)=0; virtual detectorType setDetectorsType(detectorType t=GET_DETECTOR_TYPE, int pos=-1)=0;
virtual string ssetDetectorsType(detectorType t=GET_DETECTOR_TYPE, int pos=-1)=0; virtual std::string ssetDetectorsType(detectorType t=GET_DETECTOR_TYPE, int pos=-1)=0;
virtual string ssetDetectorsType(string s, int pos=-1)=0; virtual std::string ssetDetectorsType(std::string s, int pos=-1)=0;
@ -247,7 +247,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\returns parameter \returns parameter
*/ */
virtual string getNetworkParameter(networkParameter i)=0; virtual std::string getNetworkParameter(networkParameter i)=0;
/** /**
sets the network parameters sets the network parameters
@ -257,14 +257,14 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\returns parameter \returns parameter
*/ */
virtual string setNetworkParameter(networkParameter i, string s)=0; virtual std::string setNetworkParameter(networkParameter i, std::string s)=0;
int setFlowControl10G(int i = -1) { int setFlowControl10G(int i = -1) {
string sret=""; std::string sret="";
if (i != -1) { if (i != -1) {
ostringstream o; std::ostringstream o;
o << ((i >= 1) ? 1 : 0); o << ((i >= 1) ? 1 : 0);
string sval = o.str(); std::string sval = o.str();
sret = setNetworkParameter(FLOW_CONTROL_10G, sval); sret = setNetworkParameter(FLOW_CONTROL_10G, sval);
} else } else
sret = getNetworkParameter(FLOW_CONTROL_10G); sret = getNetworkParameter(FLOW_CONTROL_10G);
@ -284,7 +284,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
checks if the detector(s) are online/offline checks if the detector(s) are online/offline
\returns hostname if offline \returns hostname if offline
*/ */
virtual string checkOnline()=0; virtual std::string checkOnline()=0;
/** /**
Digital test of the modules Digital test of the modules
@ -308,7 +308,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
/** /**
returns currently the loaded trimfile/settingsfile name returns currently the loaded trimfile/settingsfile name
*/ */
virtual string getSettingsFile()=0; virtual std::string getSettingsFile()=0;
/** /**
@ -382,7 +382,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
int setBadChannelCorrection(string fname, int &nbadtot, int *badchanlist, int off=0); int setBadChannelCorrection(std::string fname, int &nbadtot, int *badchanlist, int off=0);
@ -408,7 +408,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
virtual char* getSettingsDir()=0; virtual char* getSettingsDir()=0;
/** sets the detector trimbit/settings directory */ /** sets the detector trimbit/settings directory */
virtual char* setSettingsDir(string s)=0; virtual char* setSettingsDir(std::string s)=0;
/** /**
returns the location of the calibration files returns the location of the calibration files
@ -418,7 +418,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
/** /**
sets the location of the calibration files sets the location of the calibration files
*/ */
virtual char* setCalDir(string s)=0; virtual char* setCalDir(std::string s)=0;
/** Frees the shared memory - should not be used except for debugging*/ /** Frees the shared memory - should not be used except for debugging*/
virtual int freeSharedMemory()=0; virtual int freeSharedMemory()=0;
@ -467,7 +467,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\fname file name to load data from \fname file name to load data from
\returns OK or FAIL \returns OK or FAIL
*/ */
virtual int loadImageToDetector(imageType index,string const fname)=0; virtual int loadImageToDetector(imageType index,std::string const fname)=0;
/** /**
@ -476,7 +476,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\fname file fname to load data from \fname file fname to load data from
\returns OK or FAIL \returns OK or FAIL
*/ */
virtual int writeCounterBlockFile(string const fname,int startACQ=0)=0; virtual int writeCounterBlockFile(std::string const fname,int startACQ=0)=0;
/** /**
@ -606,7 +606,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
/** /**
Returns the IP of the last client connecting to the detector Returns the IP of the last client connecting to the detector
*/ */
virtual string getLastClientIP()=0; virtual std::string getLastClientIP()=0;
@ -623,13 +623,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\param imod module number, -1 means all modules \param imod module number, -1 means all modules
\returns OK or FAIL \returns OK or FAIL
*/ */
virtual int loadSettingsFile(string fname, int imod=-1)=0; virtual int loadSettingsFile(std::string fname, int imod=-1)=0;
/** programs FPGA with pof file /** programs FPGA with pof file
\param fname file name \param fname file name
\returns OK or FAIL \returns OK or FAIL
*/ */
virtual int programFPGA(string fname)=0; virtual int programFPGA(std::string fname)=0;
/** resets FPGA /** resets FPGA
\returns OK or FAIL \returns OK or FAIL
@ -653,7 +653,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\param imod module number, -1 means all modules \param imod module number, -1 means all modules
\returns OK or FAIL \returns OK or FAIL
*/ */
virtual int saveSettingsFile(string fname, int imod=-1)=0; virtual int saveSettingsFile(std::string fname, int imod=-1)=0;
/** sets all the trimbits to a particular value /** sets all the trimbits to a particular value
\param val trimbit value \param val trimbit value
@ -723,7 +723,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\param fname file name \param fname file name
\returns OK or FAIL \returns OK or FAIL
*/ */
virtual int writeConfigurationFile(string const fname)=0; virtual int writeConfigurationFile(std::string const fname)=0;
void registerGetPositionCallback( double (*func)(void*),void *arg){get_position=func; POarg=arg;}; void registerGetPositionCallback( double (*func)(void*),void *arg){get_position=func; POarg=arg;};
@ -747,7 +747,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\returns OK or FAIL \returns OK or FAIL
*/ */
int dumpDetectorSetup(string const fname, int level=0); int dumpDetectorSetup(std::string const fname, int level=0);
/** /**
@ -757,7 +757,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
\returns OK or FAIL \returns OK or FAIL
*/ */
int retrieveDetectorSetup(string const fname, int level=0); int retrieveDetectorSetup(std::string const fname, int level=0);
static int dummyAcquisitionFinished(double prog,int status,void* p){cout <<"Acquisition finished callback! " << prog << " " << status << endl; return 0;} static int dummyAcquisitionFinished(double prog,int status,void* p){cout <<"Acquisition finished callback! " << prog << " " << status << endl; return 0;}
static int dummyMeasurementFinished(int im,int findex,void* p){cout <<"Measurement finished callback! " << im << " " << findex << endl; return 0;} static int dummyMeasurementFinished(int im,int findex,void* p){cout <<"Measurement finished callback! " << im << " " << findex << endl; return 0;}
@ -771,12 +771,12 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
/** /**
Checks if the receiver is really online Checks if the receiver is really online
*/ */
virtual string checkReceiverOnline()=0; virtual std::string checkReceiverOnline()=0;
/** /**
Returns the IP of the last client connecting to the receiver Returns the IP of the last client connecting to the receiver
*/ */
virtual string getReceiverLastClientIP()=0; virtual std::string getReceiverLastClientIP()=0;
/** /**
@ -784,14 +784,14 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
@param fileName fileDir file directory @param fileName fileDir file directory
\returns file dir \returns file dir
*/ */
virtual string setFilePath(string s="")=0; virtual std::string setFilePath(std::string s="")=0;
/** /**
Sets up the file name Sets up the file name
@param fileName file name @param fileName file name
\returns file name \returns file name
*/ */
virtual string setFileName(string s="")=0; virtual std::string setFileName(std::string s="")=0;
/** /**
Sets the max frames per file in receiver Sets the max frames per file in receiver
@ -811,12 +811,12 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
/** /**
\returns file dir \returns file dir
*/ */
virtual string getFilePath()=0; virtual std::string getFilePath()=0;
/** /**
\returns file name \returns file name
*/ */
virtual string getFileName()=0; virtual std::string getFileName()=0;
/** /**
\returns file name \returns file name
@ -950,7 +950,7 @@ virtual int setReceiverSilentMode(int i = -1)=0;
@param fname pattern file to open @param fname pattern file to open
@returns OK/FAIL @returns OK/FAIL
*/ */
virtual int setCTBPattern(string fname)=0; virtual int setCTBPattern(std::string fname)=0;
/** Writes a pattern word to the CTB /** Writes a pattern word to the CTB

View File

@ -12,7 +12,7 @@
#include <queue> #include <queue>
#include <math.h> #include <math.h>
using namespace std; ;
/** /**
@short class handling the data file I/O flags @short class handling the data file I/O flags
*/ */

View File

@ -13,7 +13,7 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#endif #endif
using namespace std; ;
class angCalLogClass { class angCalLogClass {
@ -27,7 +27,7 @@ class angCalLogClass {
char *argv[2]; \ char *argv[2]; \
argv[0]=cmd; \ argv[0]=cmd; \
sprintf(cmd,"_%d.angcal",det->getFileIndex()); \ sprintf(cmd,"_%d.angcal",det->getFileIndex()); \
outfile.open(string(det->getFilePath()+string("/")+det->getFileName()+string(cmd)).c_str()); \ outfile.open( std::string(det->getFilePath()+ std::string("/")+det->getFileName()+ std::string(cmd)).c_str()); \
outfile.precision(8); outfile.precision(8);
myDet=new slsDetectorCommand(det); \ myDet=new slsDetectorCommand(det); \
if (outfile.is_open()) { \ if (outfile.is_open()) { \
@ -44,12 +44,12 @@ class angCalLogClass {
#endif #endif
int addStep(double pos, string fname) {std::cout.precision(5); outfile << pos << " " << fname << endl; return 0;}; int addStep(double pos, std::string fname) {std::cout.precision(5); outfile << pos << " " << fname << endl; return 0;};
// //
int readHeader(ifstream &infile, int &maxmod, int &nmod, int &chanspermod, char *angconvfile, double &globaloff, double &fineoff, int &angdir, char *ffdir, char *fffile, char *badfile ) { \ int readHeader(std::ifstream &infile, int &maxmod, int &nmod, int &chanspermod, char *angconvfile, double &globaloff, double &fineoff, int &angdir, char *ffdir, char *fffile, char *badfile ) { \
nmod=0; chanspermod=0; globaloff=0; fineoff=0; angdir=1; \ nmod=0; chanspermod=0; globaloff=0; fineoff=0; angdir=1; \
strcpy(angconvfile,"none"); strcpy(ffdir,"none"); strcpy(fffile,"none"); strcpy(badfile,"none"); \ strcpy(angconvfile,"none"); strcpy(ffdir,"none"); strcpy(fffile,"none"); strcpy(badfile,"none"); \
char line[1000], myvar[100], myarg[100]; \ char line[1000], myvar[100], myarg[100]; \
@ -57,14 +57,14 @@ class angCalLogClass {
for (int iv=0; iv<nvars; iv++) { \ for (int iv=0; iv<nvars; iv++) { \
infile.getline(line,1000); \ infile.getline(line,1000); \
sscanf(line,"%s %s", myvar, myarg); \ sscanf(line,"%s %s", myvar, myarg); \
if (string(myvar)!=string(vars[iv])) if ( std::string(myvar)!= std::string(vars[iv]))
cout << "Found variable " << myvar << " instead of " << vars[iv] << endl; cout << "Found variable " << myvar << " instead of " << vars[iv] << endl;
else else
switch (iv) { \ switch (iv) { \
case 0: \ case 0: \
if (string(myarg).find("Mythen")!=string::npos) \ if ( std::string(myarg).find("Mythen")!= std::string::npos) \
chanspermod=1280; \ chanspermod=1280; \
else if (string(myarg).find("Gotthard")!=string::npos) \ else if ( std::string(myarg).find("Gotthard")!= std::string::npos) \
chanspermod=1280; \ chanspermod=1280; \
else \ else \
chanspermod=65535; \ chanspermod=65535; \
@ -106,7 +106,7 @@ class angCalLogClass {
return 0; \ return 0; \
}; };
int getStep(ifstream &infile, double &threshold, char *datafname){ \ int getStep(std::ifstream &infile, double &threshold, char *datafname){ \
char line[1000]; \ char line[1000]; \
float v; float v;
infile.getline(line,1000); \ infile.getline(line,1000); \
@ -140,7 +140,7 @@ class angCalLogClass {
#ifndef MYROOT #ifndef MYROOT
slsDetectorCommand *myDet; slsDetectorCommand *myDet;
#endif #endif
ofstream outfile; std::ofstream outfile;
char vars[100][100]; char vars[100][100];
int nvars; int nvars;

View File

@ -19,7 +19,7 @@
//double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction) //double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction)
using namespace std; //
/** /**
@short Angular conversion constants needed for a detector module @short Angular conversion constants needed for a detector module
@ -58,7 +58,7 @@ class angularConversion : public virtual slsDetectorBase, public angularConversi
pure virtual function pure virtual function
\param file name to be written (nmod and array of angular conversion constants default to the ones ot the slsDetector \param file name to be written (nmod and array of angular conversion constants default to the ones ot the slsDetector
*/ */
virtual int writeAngularConversion(string fname)=0; virtual int writeAngularConversion(std::string fname)=0;
/** /**
sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize(); sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize();
\param mp already merged postions \param mp already merged postions
@ -250,19 +250,19 @@ class angularConversion : public virtual slsDetectorBase, public angularConversi
\returns angular conversion flag \returns angular conversion flag
*/ */
int setAngularConversionFile(string fname); int setAngularConversionFile(std::string fname);
/** /**
returns the angular conversion file returns the angular conversion file
*/ */
string getAngularConversionFile(){if (setAngularCorrectionMask()) return string(angConvFile); else return string("none");}; std::string getAngularConversionFile(){if (setAngularCorrectionMask()) return std::string(angConvFile); else return std::string("none");};
/** /**
reads teh angular conversion file for the (multi)detector and writes it to shared memory reads teh angular conversion file for the (multi)detector and writes it to shared memory
*/ */
virtual int readAngularConversionFile(string fname="")=0; virtual int readAngularConversionFile(std::string fname="")=0;

View File

@ -19,7 +19,7 @@
class angleConversionConstant; class angleConversionConstant;
using namespace std; ;
/** /**
@short Angular conversion constants needed for a detector module @short Angular conversion constants needed for a detector module
@ -47,7 +47,7 @@ class angularConversionStatic
//virtual int readAngularConversion(string fname)=0; //virtual int readAngularConversion(std::string fname)=0;
@ -60,7 +60,7 @@ class angularConversionStatic
\param angOff pointer to array of angleConversionConstants \param angOff pointer to array of angleConversionConstants
\returns OK or FAIL \returns OK or FAIL
*/ */
static int readAngularConversion(string fname, int nmod, angleConversionConstant *angOff); static int readAngularConversion(std::string fname, int nmod, angleConversionConstant *angOff);
/** /**
reads an angular conversion file reads an angular conversion file
@ -70,7 +70,7 @@ class angularConversionStatic
\returns OK or FAIL \returns OK or FAIL
*/ */
static int readAngularConversion(ifstream& ifs, int nmod, angleConversionConstant *angOff); static int readAngularConversion(std::ifstream& ifs, int nmod, angleConversionConstant *angOff);
/** /**
writes an angular conversion file writes an angular conversion file
\param fname file to be written \param fname file to be written
@ -78,7 +78,7 @@ class angularConversionStatic
\param angOff pointer to array of angleConversionConstants \param angOff pointer to array of angleConversionConstants
\returns OK or FAIL \returns OK or FAIL
*/ */
static int writeAngularConversion(string fname, int nmod, angleConversionConstant *angOff); static int writeAngularConversion(std::string fname, int nmod, angleConversionConstant *angOff);
/** /**
writes an angular conversion file writes an angular conversion file
@ -87,7 +87,7 @@ class angularConversionStatic
\param angOff pointer to array of angleConversionConstants \param angOff pointer to array of angleConversionConstants
\returns OK or FAIL \returns OK or FAIL
*/ */
static int writeAngularConversion(ofstream& ofs, int nmod, angleConversionConstant *angOff); static int writeAngularConversion(std::ofstream& ofs, int nmod, angleConversionConstant *angOff);
/** /**
sets the arrays of the merged data to 0. NB The array should be created with size nbins >= 360./getBinSize(); sets the arrays of the merged data to 0. NB The array should be created with size nbins >= 360./getBinSize();

View File

@ -7,30 +7,30 @@
#include <sstream> #include <sstream>
#include <string.h> #include <string.h>
using namespace std; //
class badChannelCorrections{ class badChannelCorrections{
public: public:
static int readBadChannelCorrectionFile(string fname, int &nbad, int *badlist){ ifstream infile(fname.c_str()); int nb=-1; if (infile.is_open()) {nb=readBadChannelCorrectionFile(infile,nbad,badlist); infile.close();}; return nb;}; static int readBadChannelCorrectionFile(std::string fname, int &nbad, int *badlist){ std::ifstream infile(fname.c_str()); int nb=-1; if (infile.is_open()) {nb=readBadChannelCorrectionFile(infile,nbad,badlist); infile.close();}; return nb;};
static int readBadChannelCorrectionFile(ifstream &infile, int &nbad, int *badlist, int moff=0){ \ static int readBadChannelCorrectionFile(std::ifstream &infile, int &nbad, int *badlist, int moff=0){ \
int interrupt=0; \ int interrupt=0; \
int ich; \ int ich; \
int chmin,chmax; \ int chmin,chmax; \
string str; \ std::string str; \
nbad=0; \ nbad=0; \
while (infile.good() and interrupt==0) { \ while (infile.good() and interrupt==0) { \
getline(infile,str); \ getline(infile,str); \
istringstream ssstr; \ std::istringstream ssstr; \
ssstr.str(str); \ ssstr.str(str); \
if (ssstr.bad() || ssstr.fail() || infile.eof()) { \ if (ssstr.bad() || ssstr.fail() || infile.eof()) { \
interrupt=1; \ interrupt=1; \
break; \ break; \
} \ } \
if (str.find('-')!=string::npos) { \ if (str.find('-')!=std::string::npos) { \
ssstr >> chmin ; \ ssstr >> chmin ; \
ssstr.str(str.substr(str.find('-')+1,str.size())); \ ssstr.str(str.substr(str.find('-')+1,str.size())); \
ssstr >> chmax; \ ssstr >> chmax; \
@ -47,7 +47,7 @@ class badChannelCorrections{
return nbad; }; return nbad; };
static int setBadChannelCorrection(ifstream &infile, int &nbad, int *badlist, int moff){ \ static int setBadChannelCorrection(std::ifstream &infile, int &nbad, int *badlist, int moff){ \
int retval=readBadChannelCorrectionFile(infile,nbad,badlist); \ int retval=readBadChannelCorrectionFile(infile,nbad,badlist); \
for (int ich=0; ich<nbad; ich++) { badlist[ich]=badlist[ich]+moff; }; \ for (int ich=0; ich<nbad; ich++) { badlist[ich]=badlist[ich]+moff; }; \
return retval; \ return retval; \

View File

@ -15,7 +15,7 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#endif #endif
using namespace std; ;
class enCalLogClass { class enCalLogClass {
@ -32,7 +32,7 @@ class enCalLogClass {
strcpy(vars[3],"modulenumber"); \ strcpy(vars[3],"modulenumber"); \
argv[0]=cmd; \ argv[0]=cmd; \
sprintf(cmd,"_%d.encal",det->getFileIndex()); \ sprintf(cmd,"_%d.encal",det->getFileIndex()); \
outfile.open(string(det->getFilePath()+string("/")+det->getFileName()+string(cmd)).c_str()); \ outfile.open(std::string(det->getFilePath()+std::string("/")+det->getFileName()+std::string(cmd)).c_str()); \
myDet=new slsDetectorCommand(det); \ myDet=new slsDetectorCommand(det); \
strcpy(cmd,vars[0]); \ strcpy(cmd,vars[0]); \
outfile << cmd << " " << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \ outfile << cmd << " " << myDet->executeLine(1,argv,slsDetectorDefs::GET_ACTION) << endl; \
@ -58,12 +58,12 @@ class enCalLogClass {
#endif #endif
int addStep(double threshold, string fname) {outfile << threshold << " " << fname << endl; return 0;}; int addStep(double threshold, std::string fname) {outfile << threshold << " " << fname << endl; return 0;};
// //
int readHeader(ifstream &infile, char *settings, int &nmod, int &chanspermod, int *mods ) { \ int readHeader(std::ifstream &infile, char *settings, int &nmod, int &chanspermod, int *mods ) { \
nmod=0; strcpy(settings,"unknown"); chanspermod=0; \ nmod=0; strcpy(settings,"unknown"); chanspermod=0; \
char line[1000],myarg[100]; \ char line[1000],myarg[100]; \
int dum; \ int dum; \
@ -75,9 +75,9 @@ class enCalLogClass {
break; \ break; \
case 1: \ case 1: \
sscanf(line,"type %s", myarg); \ sscanf(line,"type %s", myarg); \
if (string(myarg).find("Mythen")!=string::npos) \ if (std::string(myarg).find("Mythen")!=std::string::npos) \
chanspermod=1280; \ chanspermod=1280; \
else if (string(myarg).find("Gotthard")!=string::npos) \ else if (std::string(myarg).find("Gotthard")!=std::string::npos) \
chanspermod=1280; \ chanspermod=1280; \
else \ else \
chanspermod=65535; \ chanspermod=65535; \
@ -101,7 +101,7 @@ class enCalLogClass {
return 0; \ return 0; \
}; };
int getStep(ifstream &infile, double &threshold, char *datafname){ \ int getStep(std::ifstream &infile, double &threshold, char *datafname){ \
char line[1000]; \ char line[1000]; \
float v; float v;
infile.getline(line,1000); \ infile.getline(line,1000); \
@ -122,7 +122,7 @@ class enCalLogClass {
#ifndef MYROOT #ifndef MYROOT
slsDetectorCommand *myDet; slsDetectorCommand *myDet;
#endif #endif
ofstream outfile; std::ofstream outfile;
char vars[4][100]; char vars[4][100];
}; };

View File

@ -16,7 +16,7 @@ class TGraphErrors;
#endif #endif
using namespace std;

View File

@ -13,7 +13,7 @@
#include <cmath> #include <cmath>
#include <string> #include <string>
using namespace std;
/** /**
@short class handling the energy calibration and trim files IO @short class handling the energy calibration and trim files IO
*/ */
@ -39,7 +39,7 @@ class energyConversion
\returns OK if successful, else FAIL or -1 \returns OK if successful, else FAIL or -1
*/ */
static int readCalibrationFile(string fname, double &gain, double &offset); static int readCalibrationFile(std::string fname, double &gain, double &offset);
/** /**
writes a calibration file writes a calibration file
@ -48,7 +48,7 @@ class energyConversion
\param offset \param offset
\returns OK if successful, else FAIL or -1 \returns OK if successful, else FAIL or -1
*/ */
static int writeCalibrationFile(string fname, double gain, double offset); static int writeCalibrationFile(std::string fname, double gain, double offset);
/** /**
reads a calibration file reads a calibration file
@ -57,7 +57,7 @@ class energyConversion
\param offset reference to the offset variable \param offset reference to the offset variable
\returns OK if successful, else FAIL or -1 \returns OK if successful, else FAIL or -1
*/ */
static int readCalibrationFile(string fname, int *gain, int *offset); static int readCalibrationFile(std::string fname, int *gain, int *offset);
/** /**
writes a calibration file writes a calibration file
@ -66,7 +66,7 @@ class energyConversion
\param offset reference to the offset variable \param offset reference to the offset variable
\returns OK if successful, else FAIL or -1 \returns OK if successful, else FAIL or -1
*/ */
static int writeCalibrationFile(string fname, int *gain, int *offset); static int writeCalibrationFile(std::string fname, int *gain, int *offset);
@ -108,7 +108,7 @@ class energyConversion
\returns the pointer to myMod or NULL if reading the file failed \returns the pointer to myMod or NULL if reading the file failed
*/ */
sls_detector_module* readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod=NULL, int tb=1); sls_detector_module* readSettingsFile(std::string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod=NULL, int tb=1);
/** /**
writes a trim/settings file writes a trim/settings file
@ -121,7 +121,7 @@ class energyConversion
\sa ::sls_detector_module mythenDetector::writeSettingsFile(string, sls_detector_module) \sa ::sls_detector_module mythenDetector::writeSettingsFile(string, sls_detector_module)
*/ */
int writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod, int iodelay, int tau); int writeSettingsFile(std::string fname, detectorType myDetectorType, sls_detector_module mod, int iodelay, int tau);
/** allocates the momery for a detector module structure /** allocates the momery for a detector module structure
\param myDetectorType detector type (needed for number of channels, chips, dacs etc.) \param myDetectorType detector type (needed for number of channels, chips, dacs etc.)

View File

@ -1,6 +1,6 @@
#include "fileIO.h" #include "fileIO.h"
using namespace std;
/* I/O */ /* I/O */

View File

@ -14,7 +14,7 @@
#include <math.h> #include <math.h>
#include <semaphore.h> #include <semaphore.h>
using namespace std; //
/** /**
@short class handling the data file I/O flags @short class handling the data file I/O flags
*/ */
@ -50,14 +50,14 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
using fileIOStatic::writeDataFile; using fileIOStatic::writeDataFile;
using fileIOStatic::createFileName; using fileIOStatic::createFileName;
int getFileIndexFromFileName(string fname){ int getFileIndexFromFileName(std::string fname){
int ret; int ret;
pthread_mutex_lock(&mf); pthread_mutex_lock(&mf);
ret=fileIOStatic::getFileIndexFromFileName(fname); ret=fileIOStatic::getFileIndexFromFileName(fname);
pthread_mutex_unlock(&mf); pthread_mutex_unlock(&mf);
return ret; return ret;
}; };
int getIndicesFromFileName(string fname, int &index){ int getIndicesFromFileName(std::string fname, int &index){
int ret; int ret;
pthread_mutex_lock(&mf); pthread_mutex_lock(&mf);
ret=fileIOStatic::getIndicesFromFileName(fname,index); ret=fileIOStatic::getIndicesFromFileName(fname,index);
@ -67,7 +67,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
int getVariablesFromFileName(string fname, int &index, int &p_index, double &sv0, double &sv1){ int getVariablesFromFileName(std::string fname, int &index, int &p_index, double &sv0, double &sv1){
int ret; int ret;
pthread_mutex_lock(&mf); pthread_mutex_lock(&mf);
@ -76,7 +76,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
return ret; return ret;
}; };
int getVariablesFromFileName(string fname, int &index, int &f_index, int &p_index, double &sv0, double &sv1, int &detindex){ int getVariablesFromFileName(std::string fname, int &index, int &f_index, int &p_index, double &sv0, double &sv1, int &detindex){
int ret; int ret;
@ -91,11 +91,11 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
\param s file path \param s file path
\return actual file path \return actual file path
*/ */
virtual string setFilePath(string s) { virtual std::string setFilePath(std::string s) {
pthread_mutex_lock(&mf); pthread_mutex_lock(&mf);
sprintf(filePath, s.c_str()); sprintf(filePath, s.c_str());
pthread_mutex_unlock(&mf); pthread_mutex_unlock(&mf);
return string(filePath); return std::string(filePath);
}; };
/** /**
@ -103,11 +103,11 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
\param s file name to be set \param s file name to be set
\returns actual file name \returns actual file name
*/ */
virtual string setFileName(string s) { virtual std::string setFileName(std::string s) {
pthread_mutex_lock(&mf); pthread_mutex_lock(&mf);
sprintf(fileName, s.c_str()); sprintf(fileName, s.c_str());
pthread_mutex_unlock(&mf); pthread_mutex_unlock(&mf);
return string(fileName);}; return std::string(fileName);};
/** /**
sets the default output file index sets the default output file index
@ -175,11 +175,11 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
\returns the output files path \returns the output files path
*/ */
virtual string getFilePath() {return string(filePath);}; virtual std::string getFilePath() {return std::string(filePath);};
/** /**
\returns the output files root name \returns the output files root name
*/ */
virtual string getFileName() {return string(fileName);}; virtual std::string getFileName() {return std::string(fileName);};
/** /**
\returns the output file index \returns the output file index
@ -212,9 +212,9 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
virtual fileFormat getFileFormat() {return *fileFormatType;}; virtual fileFormat getFileFormat() {return *fileFormatType;};
string createFileName(); std::string createFileName();
string createReceiverFilePrefix(); std::string createReceiverFilePrefix();
/** /**
@ -227,7 +227,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
\param nch number of channels to be written to file. if -1 defaults to the number of installed channels of the detector \param nch number of channels to be written to file. if -1 defaults to the number of installed channels of the detector
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
virtual int writeDataFile(string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1); virtual int writeDataFile(std::string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1);
/** /**
@ -244,7 +244,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
virtual int writeDataFile(ofstream &outfile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1, int offset=0); virtual int writeDataFile(std::ofstream &outfile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int nch=-1, int offset=0);
/** /**
@ -253,7 +253,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
\param data array of data values \param data array of data values
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
virtual int writeDataFile(string fname, int *data); virtual int writeDataFile(std::string fname, int *data);
virtual int writeDataFile(void *data, int iframe=-1); virtual int writeDataFile(void *data, int iframe=-1);
@ -266,7 +266,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
\param offset start channel number \param offset start channel number
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
virtual int writeDataFile(ofstream &outfile, int *data, int offset=0); virtual int writeDataFile(std::ofstream &outfile, int *data, int offset=0);
@ -276,7 +276,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
\param data array of data values \param data array of data values
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
virtual int writeDataFile(string fname, short int *data); virtual int writeDataFile(std::string fname, short int *data);
@ -291,7 +291,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
\param offset start channel number \param offset start channel number
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
virtual int writeDataFile(ofstream &outfile, short int *data, int offset=0); virtual int writeDataFile(std::ofstream &outfile, short int *data, int offset=0);
/** /**
@ -304,7 +304,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
\param dataformat format of the data: can be 'i' integer or 'f' double (default) \param dataformat format of the data: can be 'i' integer or 'f' double (default)
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
*/ */
virtual int readDataFile(string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f'); virtual int readDataFile(std::string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f');
/** /**
reads a data file reads a data file
@ -316,7 +316,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
\param offset start channel number to be expected \param offset start channel number to be expected
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
*/ */
int readDataFile(ifstream& infile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0); int readDataFile(std::ifstream& infile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0);
/** /**
reads a raw data file reads a raw data file
@ -324,7 +324,7 @@ class fileIO : public fileIOStatic, public virtual slsDetectorBase {
\param data array of data values \param data array of data values
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
yes */ yes */
virtual int readDataFile(string fname, int *data); virtual int readDataFile(std::string fname, int *data);
/** /**
reads a raw data file reads a raw data file
@ -333,7 +333,7 @@ yes */
\param offset first channel number to be expected \param offset first channel number to be expected
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
*/ */
int readDataFile(ifstream &infile, int *data, int offset=0); int readDataFile(std::ifstream &infile, int *data, int offset=0);
/** /**
@ -342,7 +342,7 @@ yes */
\param data array of data values \param data array of data values
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
*/ */
virtual int readDataFile(string fname, short int *data); virtual int readDataFile(std::string fname, short int *data);
/** /**
reads a short int raw data file reads a short int raw data file
\param infile input file stream \param infile input file stream
@ -350,12 +350,12 @@ yes */
\param offset first channel number to be expected \param offset first channel number to be expected
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
*/ */
int readDataFile(ifstream &infile, short int *data, int offset=0); int readDataFile(std::ifstream &infile, short int *data, int offset=0);
virtual int getDataBytes ( )=0; virtual int getDataBytes ( )=0;
friend class slsDetector; friend class slsDetector;
string getCurrentFileName(){return currentFileName;}; std::string getCurrentFileName(){return currentFileName;};
protected: protected:
@ -368,12 +368,12 @@ yes */
void incrementDetectorIndex() { (detIndex)++; }; void incrementDetectorIndex() { (detIndex)++; };
string getCurrentReceiverFilePrefix(){return currentReceiverFilePrefix;}; std::string getCurrentReceiverFilePrefix(){return currentReceiverFilePrefix;};
string currentFileName; std::string currentFileName;
string currentReceiverFilePrefix; std::string currentReceiverFilePrefix;
/** output directory */ /** output directory */
@ -397,7 +397,7 @@ yes */
FILE *filefd; FILE *filefd;
ofstream fstream; std::ofstream fstream;
int nframes; int nframes;
// int fformat; // int fformat;

View File

@ -14,8 +14,11 @@
#define MYROOT #define MYROOT
#endif #endif
using std::endl;
using std::cout;
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
using namespace std; //
/** /**
@short class handling the data file I/O flags @short class handling the data file I/O flags
*/ */
@ -56,11 +59,11 @@ class fileIOStatic {
\param detindex detector id \param detindex detector id
\returns file name without extension \returns file name without extension
*/ */
static string createFileName(char *filepath, char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos, int findex, int frameindex=-1, int detindex=-1){ \ static std::string createFileName(char *filepath, char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos, int findex, int frameindex=-1, int detindex=-1){ \
ostringstream osfn; \ std::ostringstream osfn; \
osfn << filepath << "/" << filename; \ osfn << filepath << "/" << filename; \
if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \ if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << std::fixed << std::setprecision(prec0) << sv0; \
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \ if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << std::fixed << std::setprecision(prec1) << sv1; \
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \ if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
if(detindex>=0) osfn << "_d"<< detindex; \ if(detindex>=0) osfn << "_d"<< detindex; \
if(frameindex>=0) osfn << "_f" << frameindex; \ if(frameindex>=0) osfn << "_f" << frameindex; \
@ -86,11 +89,11 @@ class fileIOStatic {
\param detindex detector id \param detindex detector id
\returns file name without extension \returns file name without extension
*/ */
static string createReceiverFilePrefix(char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos,int detindex=-1){ \ static std::string createReceiverFilePrefix(char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos,int detindex=-1){ \
ostringstream osfn; \ std::ostringstream osfn; \
osfn << filename; \ osfn << filename; \
if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \ if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << std::fixed << std::setprecision(prec0) << sv0; \
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \ if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << std::fixed << std::setprecision(prec1) << sv1; \
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \ if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
if(detindex!=-1) osfn << "_d"<< detindex; \ if(detindex!=-1) osfn << "_d"<< detindex; \
return osfn.str(); \ return osfn.str(); \
@ -101,13 +104,13 @@ class fileIOStatic {
\param fname file name \param fname file name
\returns file index \returns file index
*/ */
static int getFileIndexFromFileName(string fname){ \ static int getFileIndexFromFileName(std::string fname){ \
int i; \ int i; \
size_t dot=fname.rfind("."); \ size_t dot=fname.rfind("."); \
if (dot==string::npos) \ if (dot==std::string::npos) \
return -1; \ return -1; \
size_t uscore=fname.rfind("_"); \ size_t uscore=fname.rfind("_"); \
if (uscore==string::npos) return -1; \ if (uscore==std::string::npos) return -1; \
if (sscanf( fname.substr(uscore+1,dot-uscore-1).c_str(),"%d",&i)) return i; \ if (sscanf( fname.substr(uscore+1,dot-uscore-1).c_str(),"%d",&i)) return i; \
cout << "******************************** cannot parse file index" << endl; \ cout << "******************************** cannot parse file index" << endl; \
return 0; \ return 0; \
@ -118,11 +121,11 @@ class fileIOStatic {
\param index reference to index \param index reference to index
\returns frame index \returns frame index
*/ */
static int getIndicesFromFileName(string fname,int &index){ \ static int getIndicesFromFileName(std::string fname,int &index){ \
int i; \ int i; \
string s; \ std::string s; \
size_t uscore=fname.rfind("_"); \ size_t uscore=fname.rfind("_"); \
if (uscore==string::npos) return -1; \ if (uscore==std::string::npos) return -1; \
s=fname; \ s=fname; \
if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)){ \ if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)){ \
index=i; \ index=i; \
@ -146,16 +149,16 @@ class fileIOStatic {
\param sv1 reference to scan variable 1 \param sv1 reference to scan variable 1
\returns file index \returns file index
*/ */
static int getVariablesFromFileName(string fname, int &index, int &p_index, double &sv0, double &sv1) { \ static int getVariablesFromFileName(std::string fname, int &index, int &p_index, double &sv0, double &sv1) { \
int i; \ int i; \
double f; \ double f; \
string s; \ std::string s; \
index=-1; \ index=-1; \
p_index=-1; \ p_index=-1; \
sv0=-1; \ sv0=-1; \
sv1=-1; \ sv1=-1; \
size_t uscore=fname.rfind("_"); \ size_t uscore=fname.rfind("_"); \
if (uscore==string::npos) return -1; \ if (uscore==std::string::npos) return -1; \
s=fname; \ s=fname; \
if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)) { \ if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)) { \
index=i; \ index=i; \
@ -201,16 +204,16 @@ class fileIOStatic {
\param detindex reference to detector id \param detindex reference to detector id
\returns file index \returns file index
*/ */
static int getVariablesFromFileName(string fname, int &index, int &f_index, int &p_index, double &sv0, double &sv1, int &detindex) { \ static int getVariablesFromFileName(std::string fname, int &index, int &f_index, int &p_index, double &sv0, double &sv1, int &detindex) { \
int i; \ int i; \
double f; \ double f; \
string s; \ std::string s; \
index=-1; \ index=-1; \
p_index=-1; \ p_index=-1; \
sv0=-1; \ sv0=-1; \
sv1=-1; \ sv1=-1; \
size_t uscore=fname.rfind("_"); \ size_t uscore=fname.rfind("_"); \
if (uscore==string::npos) return -1; \ if (uscore==std::string::npos) return -1; \
s=fname; \ s=fname; \
if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)) { \ if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)) { \
index=i; \ index=i; \
@ -262,7 +265,7 @@ class fileIOStatic {
\param detindex reference to detector id \param detindex reference to detector id
\returns file name \returns file name
*/ */
static int verifySameFrame(string fname, int index, int f_index, int p_index, double sv0, double sv1, int detindex) { \ static int verifySameFrame(std::string fname, int index, int f_index, int p_index, double sv0, double sv1, int detindex) { \
int new_index=-1; int new_index=-1;
int new_f_index=-1; int new_f_index=-1;
int new_p_index=-1; int new_p_index=-1;
@ -283,10 +286,10 @@ class fileIOStatic {
\param fname complete file name prefix \param fname complete file name prefix
\returns file name \returns file name
*/ */
static string getNameFromReceiverFilePrefix(string fname) { \ static std::string getNameFromReceiverFilePrefix(std::string fname) { \
int i; \ int i; \
double f; \ double f; \
string s; \ std::string s; \
s=fname; \ s=fname; \
size_t uscore=s.rfind("_"); \ size_t uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) \ if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) \
@ -313,14 +316,14 @@ class fileIOStatic {
\param fname complete file name \param fname complete file name
\returns file name without file name prefix, detector index or extension \returns file name without file name prefix, detector index or extension
*/ */
static string getReceiverFileNameToConcatenate(string fname) { \ static std::string getReceiverFileNameToConcatenate(std::string fname) { \
int i;double f; \ int i;double f; \
string s=fname; \ std::string s=fname; \
if(fname.empty()) return fname; \ if(fname.empty()) return fname; \
size_t dot=s.find("."); size_t dot=s.find(".");
size_t uscore=s.rfind("_"); \ size_t uscore=s.rfind("_"); \
if (uscore==string::npos) return "??"; \ if (uscore==std::string::npos) return "??"; \
if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)) \ if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)) \
s=fname.substr(0,uscore); \ s=fname.substr(0,uscore); \
uscore=s.rfind("_"); \ uscore=s.rfind("_"); \
@ -358,13 +361,13 @@ class fileIOStatic {
*/ */
static int writeDataFile(string fname, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f'){ \ static int writeDataFile(std::string fname, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f'){ \
ofstream outfile; \ std::ofstream outfile; \
if (data==NULL) { \ if (data==NULL) { \
cout << "No data to write!" << endl; \ cout << "No data to write!" << endl; \
return slsDetectorDefs::FAIL; \ return slsDetectorDefs::FAIL; \
} \ } \
outfile.open (fname.c_str(),ios_base::out); \ outfile.open (fname.c_str(),std::ios_base::out); \
if (outfile.is_open()) { \ if (outfile.is_open()) { \
writeDataFile(outfile, nch, data, err, ang, dataformat, 0); \ writeDataFile(outfile, nch, data, err, ang, dataformat, 0); \
outfile.close(); \ outfile.close(); \
@ -389,7 +392,7 @@ class fileIOStatic {
\param offset start channel number \param offset start channel number
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
static int writeDataFile(ofstream &outfile, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0){ static int writeDataFile(std::ofstream &outfile, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0){
int idata; \ int idata; \
if (data==NULL || nch==0) { \ if (data==NULL || nch==0) { \
cout << "No data to write!" << endl; \ cout << "No data to write!" << endl; \
@ -426,10 +429,10 @@ class fileIOStatic {
\param data array of data values \param data array of data values
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
static int writeDataFile(string fname,int nch, int *data){ \ static int writeDataFile(std::string fname,int nch, int *data){ \
ofstream outfile; \ std::ofstream outfile; \
if (data==NULL) return slsDetectorDefs::FAIL; \ if (data==NULL) return slsDetectorDefs::FAIL; \
outfile.open (fname.c_str(),ios_base::out); \ outfile.open (fname.c_str(),std::ios_base::out); \
if (outfile.is_open()) { \ if (outfile.is_open()) { \
writeDataFile(outfile, nch, data, 0); \ writeDataFile(outfile, nch, data, 0); \
outfile.close(); \ outfile.close(); \
@ -447,7 +450,7 @@ class fileIOStatic {
\param data array of data values \param data array of data values
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
static int writeBinaryDataFile(string fname, size_t nbytes, void *data){ \ static int writeBinaryDataFile(std::string fname, size_t nbytes, void *data){ \
FILE *sfilefd; \ FILE *sfilefd; \
if (data==NULL) return slsDetectorDefs::FAIL; \ if (data==NULL) return slsDetectorDefs::FAIL; \
sfilefd = fopen(fname.c_str(), "w"); \ sfilefd = fopen(fname.c_str(), "w"); \
@ -473,7 +476,7 @@ class fileIOStatic {
\param offset start channel number \param offset start channel number
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
static int writeDataFile(ofstream &outfile,int nch, int *data, int offset=0){ \ static int writeDataFile(std::ofstream &outfile,int nch, int *data, int offset=0){ \
if (data==NULL) return slsDetectorDefs::FAIL; \ if (data==NULL) return slsDetectorDefs::FAIL; \
for (int ichan=0; ichan<nch; ichan++) outfile << ichan+offset << " " << *(data+ichan) << std::endl; \ for (int ichan=0; ichan<nch; ichan++) outfile << ichan+offset << " " << *(data+ichan) << std::endl; \
return slsDetectorDefs::OK; \ return slsDetectorDefs::OK; \
@ -490,10 +493,10 @@ class fileIOStatic {
\param data array of data values \param data array of data values
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
static int writeDataFile(string fname,int nch, short int *data) { \ static int writeDataFile(std::string fname,int nch, short int *data) { \
ofstream outfile; \ std::ofstream outfile; \
if (data==NULL) return slsDetectorDefs::FAIL; \ if (data==NULL) return slsDetectorDefs::FAIL; \
outfile.open (fname.c_str(),ios_base::out); \ outfile.open (fname.c_str(),std::ios_base::out); \
if (outfile.is_open()) { \ if (outfile.is_open()) { \
writeDataFile(outfile, nch, data, 0); \ writeDataFile(outfile, nch, data, 0); \
outfile.close(); \ outfile.close(); \
@ -514,7 +517,7 @@ class fileIOStatic {
\param offset start channel number \param offset start channel number
\returns OK or FAIL if it could not write the file or data=NULL \returns OK or FAIL if it could not write the file or data=NULL
*/ */
static int writeDataFile(ofstream &outfile,int nch, short int *data, int offset=0){ \ static int writeDataFile(std::ofstream &outfile,int nch, short int *data, int offset=0){ \
if (data==NULL) return slsDetectorDefs::FAIL; \ if (data==NULL) return slsDetectorDefs::FAIL; \
for (int ichan=0; ichan<nch; ichan++) outfile << ichan+offset << " " << *(data+ichan) << std::endl; \ for (int ichan=0; ichan<nch; ichan++) outfile << ichan+offset << " " << *(data+ichan) << std::endl; \
return slsDetectorDefs::OK; \ return slsDetectorDefs::OK; \
@ -531,11 +534,11 @@ class fileIOStatic {
\returns number of channels read or -1 if it could not read the file or data=NULL \returns number of channels read or -1 if it could not read the file or data=NULL
*/ */
static int readDataFile(int nch, string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f') { \ static int readDataFile(int nch, std::string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f') { \
ifstream infile; \ std::ifstream infile; \
int iline=0; \ int iline=0; \
string str; \ std::string str; \
infile.open(fname.c_str(), ios_base::in); \ infile.open(fname.c_str(), std::ios_base::in); \
if (infile.is_open()) { \ if (infile.is_open()) { \
iline=readDataFile(nch, infile, data, err, ang, dataformat, 0); \ iline=readDataFile(nch, infile, data, err, ang, dataformat, 0); \
infile.close(); \ infile.close(); \
@ -558,17 +561,17 @@ class fileIOStatic {
\returns number of channels read or -1 if it could not read the file or data=NULL \returns number of channels read or -1 if it could not read the file or data=NULL
*/ */
static int readDataFile(int nch, ifstream &infile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0){ \ static int readDataFile(int nch, std::ifstream &infile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0){ \
int ichan,iline=0; \ int ichan,iline=0; \
int interrupt=0; \ int interrupt=0; \
double fdata, ferr, fang; \ double fdata, ferr, fang; \
int maxchans; \ int maxchans; \
int ich; \ int ich; \
string str; \ std::string str; \
maxchans=nch; \ maxchans=nch; \
while (infile.good() and interrupt==0) { \ while (infile.good() and interrupt==0) { \
getline(infile,str); \ getline(infile,str); \
istringstream ssstr(str); \ std::istringstream ssstr(str); \
if (ang==NULL) { \ if (ang==NULL) { \
ssstr >> ichan >> fdata; \ ssstr >> ichan >> fdata; \
if (ssstr.fail() || ssstr.bad()) { \ if (ssstr.fail() || ssstr.bad()) { \
@ -617,11 +620,11 @@ class fileIOStatic {
\param nch number of channels \param nch number of channels
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
*/ */
static int readDataFile(string fname, int *data, int nch) { \ static int readDataFile(std::string fname, int *data, int nch) { \
ifstream infile; \ std::ifstream infile; \
int iline=0; \ int iline=0; \
string str; \ std::string str; \
infile.open(fname.c_str(), ios_base::in); \ infile.open(fname.c_str(), std::ios_base::in); \
if (infile.is_open()) { \ if (infile.is_open()) { \
iline=readDataFile(infile, data, nch, 0); \ iline=readDataFile(infile, data, nch, 0); \
infile.close(); \ infile.close(); \
@ -641,13 +644,13 @@ class fileIOStatic {
\param offset start channel value \param offset start channel value
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
*/ */
static int readDataFile(ifstream &infile, int *data, int nch, int offset) { \ static int readDataFile(std::ifstream &infile, int *data, int nch, int offset) { \
int ichan, idata, iline=0; \ int ichan, idata, iline=0; \
int interrupt=0; \ int interrupt=0; \
string str; \ std::string str; \
while (infile.good() and interrupt==0) { \ while (infile.good() and interrupt==0) { \
getline(infile,str); \ getline(infile,str); \
istringstream ssstr(str); \ std::istringstream ssstr(str); \
ssstr >> ichan >> idata; \ ssstr >> ichan >> idata; \
if (ssstr.fail() || ssstr.bad()) { \ if (ssstr.fail() || ssstr.bad()) { \
interrupt=1; \ interrupt=1; \
@ -673,11 +676,11 @@ class fileIOStatic {
\param nch number of channels \param nch number of channels
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
*/ */
static int readDataFile(string fname, short int *data, int nch){ \ static int readDataFile(std::string fname, short int *data, int nch){ \
ifstream infile; \ std::ifstream infile; \
int iline=0; \ int iline=0; \
string str; \ std::string str; \
infile.open(fname.c_str(), ios_base::in); \ infile.open(fname.c_str(), std::ios_base::in); \
if (infile.is_open()) { \ if (infile.is_open()) { \
iline=readDataFile(infile, data, nch, 0); \ iline=readDataFile(infile, data, nch, 0); \
infile.close(); \ infile.close(); \
@ -696,14 +699,14 @@ class fileIOStatic {
\param offset start channel value \param offset start channel value
\returns OK or FAIL if it could not read the file or data=NULL \returns OK or FAIL if it could not read the file or data=NULL
*/ */
static int readDataFile(ifstream &infile, short int *data, int nch, int offset) { \ static int readDataFile(std::ifstream &infile, short int *data, int nch, int offset) { \
int ichan, iline=0; \ int ichan, iline=0; \
short int idata; \ short int idata; \
int interrupt=0; \ int interrupt=0; \
string str; \ std::string str; \
while (infile.good() and interrupt==0) { \ while (infile.good() and interrupt==0) { \
getline(infile,str); \ getline(infile,str); \
istringstream ssstr(str); \ std::istringstream ssstr(str); \
ssstr >> ichan >> idata; \ ssstr >> ichan >> idata; \
if (ssstr.fail() || ssstr.bad()) { \ if (ssstr.fail() || ssstr.bad()) { \
interrupt=1; \ interrupt=1; \

View File

@ -16,7 +16,7 @@
#include <queue> #include <queue>
#include <math.h> #include <math.h>
using namespace std; ;
typedef double double32_t; typedef double double32_t;

View File

@ -8,7 +8,7 @@
#endif #endif
#include <time.h> #include <time.h>
using namespace std;
//#define VERBOSE //#define VERBOSE
static void* startProcessData(void *n){ static void* startProcessData(void *n){

View File

@ -7,7 +7,6 @@
#include "angularConversion.h" #include "angularConversion.h"
#include "badChannelCorrections.h" #include "badChannelCorrections.h"
#include "fileIO.h" #include "fileIO.h"
#include <string>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
@ -22,8 +21,7 @@
class postProcessingFuncs; class postProcessingFuncs;
//
using namespace std;
#define MAX_BADCHANS 20000 #define MAX_BADCHANS 20000
@ -77,7 +75,7 @@ class postProcessing : public angularConversion, public fileIO, public badChanne
\param fname file with bad channel list ("" disable) \param fname file with bad channel list ("" disable)
\returns 0 if bad channel disabled, >0 otherwise \returns 0 if bad channel disabled, >0 otherwise
*/ */
virtual int setBadChannelCorrection(string fname="")=0; virtual int setBadChannelCorrection(std::string fname="")=0;
/** /**
@ -87,7 +85,7 @@ class postProcessing : public angularConversion, public fileIO, public badChanne
\param badlist array of badchannels \param badlist array of badchannels
\returns 0 if bad channel disabled, >0 otherwise \returns 0 if bad channel disabled, >0 otherwise
*/ */
virtual int setBadChannelCorrection(string fname, int &nbad, int *badlist, int off=0)=0; virtual int setBadChannelCorrection(std::string fname, int &nbad, int *badlist, int off=0)=0;
using badChannelCorrections::setBadChannelCorrection; using badChannelCorrections::setBadChannelCorrection;
/** /**
@ -118,26 +116,26 @@ class postProcessing : public angularConversion, public fileIO, public badChanne
/** returns the bad channel list file */ /** returns the bad channel list file */
string getBadChannelCorrectionFile() {if ((*correctionMask)&(1<< DISCARD_BAD_CHANNELS)) return string(badChanFile); else return string("none");}; std::string getBadChannelCorrectionFile() {if ((*correctionMask)&(1<< DISCARD_BAD_CHANNELS)) return std::string(badChanFile); else return std::string("none");};
/** /**
get flat field corrections file directory get flat field corrections file directory
\returns flat field correction file directory \returns flat field correction file directory
*/ */
string getFlatFieldCorrectionDir(){return string(flatFieldDir);}; std::string getFlatFieldCorrectionDir(){return std::string(flatFieldDir);};
/** /**
set flat field corrections file directory set flat field corrections file directory
\param flat field correction file directory \param flat field correction file directory
\returns flat field correction file directory \returns flat field correction file directory
*/ */
string setFlatFieldCorrectionDir(string dir){strcpy(flatFieldDir,dir.c_str()); return string(flatFieldDir);}; std::string setFlatFieldCorrectionDir(std::string dir){strcpy(flatFieldDir,dir.c_str()); return std::string(flatFieldDir);};
/** /**
get flat field corrections file name get flat field corrections file name
\returns flat field correction file name \returns flat field correction file name
*/ */
string getFlatFieldCorrectionFile(){ if ((*correctionMask)&(1<<FLAT_FIELD_CORRECTION)) return string(flatFieldFile); else return string("none");}; std::string getFlatFieldCorrectionFile(){ if ((*correctionMask)&(1<<FLAT_FIELD_CORRECTION)) return std::string(flatFieldFile); else return std::string("none");};
@ -172,7 +170,7 @@ s
\returns nothing \returns nothing
*/ */
void doProcessing(double* myData, int delflag, string fname); void doProcessing(double* myData, int delflag, std::string fname);
/** /**
@ -260,7 +258,7 @@ s
void initDataset(int refresh); void initDataset(int refresh);
void addFrame(double *data, double pos, double i0, double t, string fname, double var); void addFrame(double *data, double pos, double i0, double t, std::string fname, double var);
void finalizeDataset(double *a, double *v, double *e, int &np); void finalizeDataset(double *a, double *v, double *e, int &np);
virtual detectorType getDetectorsType(int pos=-1)=0; virtual detectorType getDetectorsType(int pos=-1)=0;
@ -295,11 +293,11 @@ s
/** /**
data queue data queue
*/ */
queue<int*> dataQueue; std::queue<int*> dataQueue;
/** /**
queue containing the postprocessed data queue containing the postprocessed data
*/ */
queue<detectorData*> finalDataQueue; std::queue<detectorData*> finalDataQueue;
/** data queue size */ /** data queue size */
int queuesize; int queuesize;

View File

@ -25,7 +25,7 @@
class angularConversion; class angularConversion;
class fileIO; class fileIO;
using namespace std; ;
#define MAX_BADCHANS 2000 #define MAX_BADCHANS 2000

View File

@ -1,6 +1,6 @@
#include "postProcessingFuncs.h" #include "postProcessingFuncs.h"
#include "angleConversionConstant.h" #include "angleConversionConstant.h"
using namespace std;
//#define VERBOSE //#define VERBOSE
postProcessingFuncs::postProcessingFuncs(int *nModules,int *chPerMod,int modMask[],int badCh[], double ffcoeff[], double fferr[], double* t, int *dir, double angRadius[], double angOffset[], double angCentre[], double* to, double* bs, double *sX, double *sY): postProcessingFuncs::postProcessingFuncs(int *nModules,int *chPerMod,int modMask[],int badCh[], double ffcoeff[], double fferr[], double* t, int *dir, double angRadius[], double angOffset[], double angCentre[], double* to, double* bs, double *sX, double *sY):

View File

@ -17,7 +17,7 @@
#include "angularConversionStatic.h" #include "angularConversionStatic.h"
class angleConversionConstant; class angleConversionConstant;
using namespace std;
class postProcessingFuncs : public virtual angularConversionStatic class postProcessingFuncs : public virtual angularConversionStatic

View File

@ -18,7 +18,7 @@
class angularConversion; class angularConversion;
using namespace std; ;
#define MAX_BADCHANS 2000 #define MAX_BADCHANS 2000

View File

@ -34,7 +34,7 @@
#include "runningStat.h" #include "runningStat.h"
#include "movingStat.h" #include "movingStat.h"
#include "single_photon_hit.h" #include "single_photon_hit.h"
using namespace std;
typedef double double32_t; typedef double double32_t;

View File

@ -8,7 +8,6 @@
#include "Global.h" #include "Global.h"
using namespace std;
class CondVar { class CondVar {
public: public:

View File

@ -4,7 +4,6 @@
#include "Global.h" #include "Global.h"
#include <string> #include <string>
using namespace std;
class Single; class Single;
class ThreadPool; class ThreadPool;
@ -15,10 +14,10 @@ public:
Multi(); Multi();
~Multi(); ~Multi();
string executeCommand(int argc,char* argv[]); std::string executeCommand(int argc,char* argv[]);
int printNumber(int inum); int printNumber(int inum);
string printString(string s); std::string printString(std::string s);
char* printCharArray(char a[]); char* printCharArray(char a[]);
int createThreadPool(); int createThreadPool();

View File

@ -10,7 +10,7 @@
#include "Global.h" #include "Global.h"
using namespace std; //
class Mutex class Mutex
{ {

View File

@ -3,7 +3,7 @@
#include "Multi.h" #include "Multi.h"
#include <string> #include <string>
using namespace std; //
class Single { class Single {
public: public:

View File

@ -6,16 +6,12 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string>
#include <stdio.h>
#include "Global.h" #include "Global.h"
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include <iostream>
#include <stdio.h>
using namespace std;
class slsDetector; class slsDetector;
template<typename _Ret> template<typename _Ret>
@ -121,14 +117,14 @@ protected:
func0_t <runStatus >* m4; func0_t <runStatus >* m4;
func1_t <int, int>* m5; func1_t <int, int>* m5;
func1_t <int, double>* m6; func1_t <int, double>* m6;
func1_t <string, string>* m7; func1_t <std::string, std::string>* m7;
func1_t <detectorSettings, int>* m8; func1_t <detectorSettings, int>* m8;
func2_t <int, int,int>* m9; func2_t <int, int,int>* m9;
func2_t <int, string,int>* m10; func2_t <int, std::string,int>* m10;
func2_t <dacs_t, dacIndex,int>* m11; func2_t <dacs_t, dacIndex,int>* m11;
func2_t <detectorSettings, detectorSettings,int>* m12; func2_t <detectorSettings, detectorSettings,int>* m12;
func2_t <int64_t, timerIndex,int64_t>* m13; func2_t <int64_t, timerIndex,int64_t>* m13;
func2_t <string, networkParameter,string>* m14; func2_t <std::string, networkParameter,std::string>* m14;
func3_t <int, int,int,int>* m15; func3_t <int, int,int,int>* m15;
func4_t <int, trimMode,int,int,int>* m16; func4_t <int, trimMode,int,int,int>* m16;
func4_t <int, int,int,detectorSettings,int>* m17; func4_t <int, int,int,detectorSettings,int>* m17;
@ -146,14 +142,14 @@ public:
Task(func0_t <runStatus >* t): SuperTask(),fnum(4){m4 = t;}; Task(func0_t <runStatus >* t): SuperTask(),fnum(4){m4 = t;};
Task(func1_t <int, int>* t): SuperTask(),fnum(5){m5 = t;}; Task(func1_t <int, int>* t): SuperTask(),fnum(5){m5 = t;};
Task(func1_t <int, double>* t): SuperTask(),fnum(6){m6 = t;}; Task(func1_t <int, double>* t): SuperTask(),fnum(6){m6 = t;};
Task(func1_t <string, string>* t): SuperTask(),fnum(7){m7 = t;}; Task(func1_t <std::string, std::string>* t): SuperTask(),fnum(7){m7 = t;};
Task(func1_t <detectorSettings, int>* t): SuperTask(),fnum(8){m8 = t;}; Task(func1_t <detectorSettings, int>* t): SuperTask(),fnum(8){m8 = t;};
Task(func2_t <int, int,int>* t): SuperTask(),fnum(9){m9 = t;}; Task(func2_t <int, int,int>* t): SuperTask(),fnum(9){m9 = t;};
Task(func2_t <int, string,int>* t): SuperTask(),fnum(10){m10 = t;}; Task(func2_t <int, std::string,int>* t): SuperTask(),fnum(10){m10 = t;};
Task(func2_t <dacs_t, dacIndex,int>* t): SuperTask(),fnum(11){m11 = t;}; Task(func2_t <dacs_t, dacIndex,int>* t): SuperTask(),fnum(11){m11 = t;};
Task(func2_t <detectorSettings, detectorSettings,int>* t): SuperTask(),fnum(12){m12 = t;}; Task(func2_t <detectorSettings, detectorSettings,int>* t): SuperTask(),fnum(12){m12 = t;};
Task(func2_t <int64_t, timerIndex,int64_t>* t): SuperTask(),fnum(13){m13 = t;}; Task(func2_t <int64_t, timerIndex,int64_t>* t): SuperTask(),fnum(13){m13 = t;};
Task(func2_t <string, networkParameter,string>* t): SuperTask(),fnum(14){m14 = t;}; Task(func2_t <std::string, networkParameter,std::string>* t): SuperTask(),fnum(14){m14 = t;};
Task(func3_t <int, int,int,int>* t): SuperTask(),fnum(15){m15 = t;}; Task(func3_t <int, int,int,int>* t): SuperTask(),fnum(15){m15 = t;};
Task(func4_t <int, trimMode,int,int,int>* t): SuperTask(),fnum(16){m16 = t;}; Task(func4_t <int, trimMode,int,int,int>* t): SuperTask(),fnum(16){m16 = t;};
Task(func4_t <int, int,int,detectorSettings,int>* t): SuperTask(),fnum(17){m17 = t;}; Task(func4_t <int, int,int,detectorSettings,int>* t): SuperTask(),fnum(17){m17 = t;};

View File

@ -1,6 +1,6 @@
#include "ThreadPool.h" #include "ThreadPool.h"
#include <pthread.h> #include <pthread.h>
using namespace std;
ThreadPool::ThreadPool(int pool_size) : m_pool_size(pool_size){ ThreadPool::ThreadPool(int pool_size) : m_pool_size(pool_size){
#ifdef VERBOSE #ifdef VERBOSE
cout << "Constructed ThreadPool of size " << m_pool_size << endl; cout << "Constructed ThreadPool of size " << m_pool_size << endl;

View File

@ -14,7 +14,7 @@
#include "CondVar.h" #include "CondVar.h"
#include "Global.h" #include "Global.h"
#include <semaphore.h> #include <semaphore.h>
using namespace std; //
class ThreadPool class ThreadPool