File name functions made (also) static

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@48 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
bergamaschi 2011-11-11 15:51:34 +00:00
parent a8943b0746
commit 025c6ae10f
5 changed files with 777 additions and 2481 deletions

View File

@ -58,7 +58,7 @@ HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
INPUT = slsDetector/slsDetector.h mythenDetector/mythenDetector.h eigerDetector/eigerDetector.h MySocketTCP/MySocketTCP.h usersFunctions/usersFunctions.h commonFiles/sls_detector_defs.h slsDetector/slsDetector.cpp MySocketTCP/MySocketTCP.cxx usersFunctions/usersFunctions.c
INPUT = slsDetector/slsDetector.h mythenDetector/mythenDetector.h eigerDetector/eigerDetector.h gotthardDetector/gotthardDetector.h MySocketTCP/MySocketTCP.h usersFunctions/usersFunctions.h multiSlsDetector/multiSlsDetector.h commonFiles/sls_detector_defs.h slsDetector/slsDetector.cpp MySocketTCP/MySocketTCP.cxx usersFunctions/usersFunctions.c multiSlsDetector/multiSlsDetector.cpp gotthardDetector/gotthardDetector.cpp
OUTPUT_DIRECTORY = docs

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -844,27 +844,30 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
/* generates file name without extension*/
string slsDetector::createFileName() {
createFileName(thisDetector->filePath, thisDetector->fileName, thisDetector->actionMask, currentScanVariable[0], thisDetector->scanPrecision[0], currentScanVariable[1], thisDetector->scanPrecision[1], currentPositionIndex, thisDetector->numberOfPositions, thisDetector->fileIndex);
}
string slsDetector::createFileName(char *filepath, char *filename, int aMask, float sv0, int prec0, float sv1, int prec1, int pindex, int npos, int findex) {
ostringstream osfn;
/*directory name +root file name */
osfn << thisDetector->filePath << "/" << thisDetector->fileName;
osfn << filepath << "/" << filename;
// scan level 0
if (thisDetector->actionMask & (1 << (MAX_ACTIONS)))
osfn << "_S" << fixed << setprecision(thisDetector->scanPrecision[0]) << currentScanVariable[0];
if ( aMask& (1 << (MAX_ACTIONS)))
osfn << "_S" << fixed << setprecision(prec0) << sv0;
//scan level 1
if (thisDetector->actionMask & (1 << (MAX_ACTIONS+1)))
osfn << "_s" << fixed << setprecision(thisDetector->scanPrecision[1]) << currentScanVariable[1];
if (aMask & (1 << (MAX_ACTIONS+1)))
osfn << "_s" << fixed << setprecision(prec1) << sv1;
//position
if (currentPositionIndex>0 && currentPositionIndex<=thisDetector->numberOfPositions)
osfn << "_p" << currentPositionIndex;
if (pindex>0 && pindex<=npos)
osfn << "_p" << pindex;
// file index
osfn << "_" << thisDetector->fileIndex;
osfn << "_" << findex;
#ifdef VERBOSE
@ -876,6 +879,16 @@ string slsDetector::createFileName() {
}
int slsDetector::getFileIndexFromFileName(string fname) {
int i;
size_t dot=fname.rfind(".");

View File

@ -487,6 +487,7 @@ typedef struct sharedSlsDetector {
*/
int getFileIndex() {return thisDetector->fileIndex;};
/** generates file name without extension
always appends to file path and file name the run index.
@ -495,13 +496,51 @@ typedef struct sharedSlsDetector {
Filenames will be of the form: filepath/filename(_px)_i
where x is the position index and i is the run index
\param filepath outdir
\param filename file root name
\param aMask action mask (scans, positions)
\param sv0 scan variable 0
\param prec0 scan precision 0
\param sv1 scan variable 1
\param prec1 scan precision 1
\param pindex position index
\param number of positions
\param findex file index
\returns file name without extension
*/
static string createFileName(char *filepath, char *filename, int aMask, float sv0, int prec0, float sv1, int prec1, int pindex, int npos, int findex);
/** generates file name without extension
always appends to file path and file name the run index.
in case also appends the position index
Filenames will be of the form: filepath/filename(_px)_i
where x is the position index and i is the run index
\returns file name without extension
*/
string createFileName();
/** static function that returns the file index from the file name
\param fname file name
\returns file index*/
static int getFileIndexFromFileName(string fname);
/** static function that returns the variables from the file name
\param fname file name
\param index reference to index
\param p_index reference to position index
\param sv0 reference to scan variable 0
\param sv1 reference to scan variable 1
\returns file index
*/
static int getVariablesFromFileName(string fname, int &index, int &p_index, float &sv0, float &sv1);
/**
Pure virtual function
writes a data file
\param name of the file to be written
\param data array of data values
@ -517,7 +556,7 @@ typedef struct sharedSlsDetector {
virtual int writeDataFile(string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=-1){};
/**
Pure virtual function
writes a data file
\param name of the file to be written
\param data array of data values
@ -527,7 +566,7 @@ typedef struct sharedSlsDetector {
virtual int writeDataFile(string fname, int *data){};
/**
Pure virtual function
reads a data file
\param name of the file to be read
\param data array of data values to be filled
@ -543,7 +582,7 @@ typedef struct sharedSlsDetector {
virtual int readDataFile(string fname, float *data, float *err=NULL, float *ang=NULL, char dataformat='f', int nch=0){};
/**
Pure virtual function
reads a data file
\param name of the file to be read
\param data array of data values
@ -565,7 +604,7 @@ typedef struct sharedSlsDetector {
*/
char* setCalDir(string s) {sprintf(thisDetector->calDir, s.c_str()); return thisDetector->calDir;};
/**
Pure virtual function
reads a calibration file
\param fname file to be read
\param gain reference to the gain variable
@ -574,7 +613,7 @@ typedef struct sharedSlsDetector {
*/
virtual int readCalibrationFile(string fname, float &gain, float &offset){};
/**
Pure virtual function
writes a calibration file
\param fname file to be written
\param gain
@ -585,7 +624,7 @@ typedef struct sharedSlsDetector {
/**
Pure virtual function
reads an angular conversion file
\param fname file to be read
\sa angleConversionConstant mythenDetector::readAngularConversion
@ -1546,9 +1585,6 @@ enum {GET_ACTION, PUT_ACTION, READOUT_ACTION};
protected:
int getFileIndexFromFileName(string fname);
int getVariablesFromFileName(string fname, int &index, int &p_index, float &sv0, float &sv1);
static const int64_t thisSoftwareVersion=0x20110113;