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

@ -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(".");