mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 07:40:03 +02:00
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:
parent
a8943b0746
commit
025c6ae10f
@ -58,7 +58,7 @@ HIDE_UNDOC_CLASSES = NO
|
|||||||
|
|
||||||
HIDE_FRIEND_COMPOUNDS = 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
|
OUTPUT_DIRECTORY = docs
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -844,27 +844,30 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
|||||||
/* generates file name without extension*/
|
/* generates file name without extension*/
|
||||||
|
|
||||||
string slsDetector::createFileName() {
|
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;
|
ostringstream osfn;
|
||||||
/*directory name +root file name */
|
/*directory name +root file name */
|
||||||
osfn << thisDetector->filePath << "/" << thisDetector->fileName;
|
osfn << filepath << "/" << filename;
|
||||||
|
|
||||||
// scan level 0
|
// scan level 0
|
||||||
if (thisDetector->actionMask & (1 << (MAX_ACTIONS)))
|
if ( aMask& (1 << (MAX_ACTIONS)))
|
||||||
osfn << "_S" << fixed << setprecision(thisDetector->scanPrecision[0]) << currentScanVariable[0];
|
osfn << "_S" << fixed << setprecision(prec0) << sv0;
|
||||||
|
|
||||||
//scan level 1
|
//scan level 1
|
||||||
if (thisDetector->actionMask & (1 << (MAX_ACTIONS+1)))
|
if (aMask & (1 << (MAX_ACTIONS+1)))
|
||||||
osfn << "_s" << fixed << setprecision(thisDetector->scanPrecision[1]) << currentScanVariable[1];
|
osfn << "_s" << fixed << setprecision(prec1) << sv1;
|
||||||
|
|
||||||
|
|
||||||
//position
|
//position
|
||||||
if (currentPositionIndex>0 && currentPositionIndex<=thisDetector->numberOfPositions)
|
if (pindex>0 && pindex<=npos)
|
||||||
osfn << "_p" << currentPositionIndex;
|
osfn << "_p" << pindex;
|
||||||
|
|
||||||
// file index
|
// file index
|
||||||
osfn << "_" << thisDetector->fileIndex;
|
osfn << "_" << findex;
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -876,6 +879,16 @@ string slsDetector::createFileName() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::getFileIndexFromFileName(string fname) {
|
int slsDetector::getFileIndexFromFileName(string fname) {
|
||||||
int i;
|
int i;
|
||||||
size_t dot=fname.rfind(".");
|
size_t dot=fname.rfind(".");
|
||||||
|
@ -487,6 +487,7 @@ typedef struct sharedSlsDetector {
|
|||||||
*/
|
*/
|
||||||
int getFileIndex() {return thisDetector->fileIndex;};
|
int getFileIndex() {return thisDetector->fileIndex;};
|
||||||
|
|
||||||
|
|
||||||
/** generates file name without extension
|
/** generates file name without extension
|
||||||
|
|
||||||
always appends to file path and file name the run index.
|
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
|
Filenames will be of the form: filepath/filename(_px)_i
|
||||||
where x is the position index and i is the run index
|
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();
|
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
|
writes a data file
|
||||||
\param name of the file to be written
|
\param name of the file to be written
|
||||||
\param data array of data values
|
\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){};
|
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
|
writes a data file
|
||||||
\param name of the file to be written
|
\param name of the file to be written
|
||||||
\param data array of data values
|
\param data array of data values
|
||||||
@ -527,7 +566,7 @@ typedef struct sharedSlsDetector {
|
|||||||
virtual int writeDataFile(string fname, int *data){};
|
virtual int writeDataFile(string fname, int *data){};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Pure virtual function
|
|
||||||
reads a data file
|
reads a data file
|
||||||
\param name of the file to be read
|
\param name of the file to be read
|
||||||
\param data array of data values to be filled
|
\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){};
|
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
|
reads a data file
|
||||||
\param name of the file to be read
|
\param name of the file to be read
|
||||||
\param data array of data values
|
\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;};
|
char* setCalDir(string s) {sprintf(thisDetector->calDir, s.c_str()); return thisDetector->calDir;};
|
||||||
/**
|
/**
|
||||||
Pure virtual function
|
|
||||||
reads a calibration file
|
reads a calibration file
|
||||||
\param fname file to be read
|
\param fname file to be read
|
||||||
\param gain reference to the gain variable
|
\param gain reference to the gain variable
|
||||||
@ -574,7 +613,7 @@ typedef struct sharedSlsDetector {
|
|||||||
*/
|
*/
|
||||||
virtual int readCalibrationFile(string fname, float &gain, float &offset){};
|
virtual int readCalibrationFile(string fname, float &gain, float &offset){};
|
||||||
/**
|
/**
|
||||||
Pure virtual function
|
|
||||||
writes a calibration file
|
writes a calibration file
|
||||||
\param fname file to be written
|
\param fname file to be written
|
||||||
\param gain
|
\param gain
|
||||||
@ -585,7 +624,7 @@ typedef struct sharedSlsDetector {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Pure virtual function
|
|
||||||
reads an angular conversion file
|
reads an angular conversion file
|
||||||
\param fname file to be read
|
\param fname file to be read
|
||||||
\sa angleConversionConstant mythenDetector::readAngularConversion
|
\sa angleConversionConstant mythenDetector::readAngularConversion
|
||||||
@ -1546,9 +1585,6 @@ enum {GET_ACTION, PUT_ACTION, READOUT_ACTION};
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
int getFileIndexFromFileName(string fname);
|
|
||||||
int getVariablesFromFileName(string fname, int &index, int &p_index, float &sv0, float &sv1);
|
|
||||||
|
|
||||||
|
|
||||||
static const int64_t thisSoftwareVersion=0x20110113;
|
static const int64_t thisSoftwareVersion=0x20110113;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user