mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-01 10:20:04 +02:00
included a short filename for receiver for sebastian, which has a frameindex incrementing by 1
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@356 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
6a74fda3ed
commit
c02075dc12
@ -31,6 +31,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
|
||||
//reads config file, creates socket, assigns function table
|
||||
slsReceiverFuncs *receiver = new slsReceiverFuncs(socket,fname,ret, shortfname);
|
||||
if(ret==slsDetectorDefs::FAIL)
|
||||
|
@ -25,6 +25,7 @@ int slsReceiverFunctionList::listening_thread_running(0);
|
||||
|
||||
slsReceiverFunctionList::slsReceiverFunctionList(bool shortfname):
|
||||
shortFileName(shortfname),
|
||||
shortFileNameIndex(0),
|
||||
fileIndex(0),
|
||||
frameIndexNeeded(true),
|
||||
framesCaught(0),
|
||||
@ -185,7 +186,7 @@ int slsReceiverFunctionList::startListening(){
|
||||
framesCaught=0;
|
||||
startFrameIndex=-1;
|
||||
frameIndex=0;
|
||||
|
||||
shortFileNameIndex=1;
|
||||
|
||||
//Catch signal SIGINT to close files properly
|
||||
signal(SIGINT,closeFile);
|
||||
@ -200,7 +201,7 @@ int slsReceiverFunctionList::startListening(){
|
||||
if(!shortFileName)
|
||||
strcpy(actualfilename,savefilename);
|
||||
else
|
||||
sprintf(actualfilename, "%s/%s_%d_%012d.raw", filePath,fileName,fileIndex, framesCaught);
|
||||
sprintf(actualfilename, "%s/%s_%d_%09d.raw", filePath,fileName,fileIndex, 0);
|
||||
|
||||
// A do/while(FALSE) loop is used to make error cleanup easier. The
|
||||
// close() of each of the socket descriptors is only done once at the
|
||||
@ -230,7 +231,9 @@ int slsReceiverFunctionList::startListening(){
|
||||
if(!shortFileName)
|
||||
strcpy(actualfilename,savefilename);
|
||||
else
|
||||
sprintf(actualfilename, "%s/%s_%d_%012d.raw", filePath,fileName,fileIndex, framesCaught);
|
||||
sprintf(actualfilename, "%s/%s_%d_%09d.raw", filePath,fileName,fileIndex, shortFileNameIndex);
|
||||
|
||||
shortFileNameIndex++;
|
||||
|
||||
cout << "saving to " << actualfilename << "\t\t"
|
||||
"packet loss " << ((currframenum-prevframenum-(2*framesInFile))/(double)(2*framesInFile))*100.000 << "%\t\t"
|
||||
|
@ -146,9 +146,12 @@ private:
|
||||
/** Actual Complete File name. This is used if you need a simple filename */
|
||||
char actualfilename[MAX_STR_LENGTH];
|
||||
|
||||
/** if short file name is needed*/
|
||||
/** if short file name is needed, filename= filepath/filename_fileindex_shortFileNameIndex.raw */
|
||||
bool shortFileName;
|
||||
|
||||
/** If short file name is used, different index used instead of frame index */
|
||||
int shortFileNameIndex;
|
||||
|
||||
/** File Name without frame index, file index and extension*/
|
||||
char fileName[MAX_STR_LENGTH];
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "slsReceiver_funcs.h"
|
||||
#include "slsReceiverFunctionList.h"
|
||||
|
||||
#include <signal.h> // SIGINT
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
@ -91,6 +93,9 @@ slsReceiverFuncs::slsReceiverFuncs(MySocketTCP *&mySocket,string const fname,int
|
||||
function_table();
|
||||
slsReceiverList = new slsReceiverFunctionList(shortfname);
|
||||
|
||||
//Catch signal SIGINT to close files properly
|
||||
//signal(SIGINT,closeFile);
|
||||
|
||||
success = OK;
|
||||
}
|
||||
}
|
||||
@ -189,6 +194,15 @@ int slsReceiverFuncs::M_nofunc(){
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void slsReceiverFuncs::closeFile(int p){
|
||||
//if(socket)
|
||||
slsReceiverFunctionList::closeFile(0);
|
||||
socket->Disconnect();//non static
|
||||
delete socket;
|
||||
exit(0);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
int slsReceiverFuncs::set_file_name() {
|
||||
|
@ -41,6 +41,9 @@ public:
|
||||
/** Unrecognized Function */
|
||||
int M_nofunc();
|
||||
|
||||
/** Close File */
|
||||
//static void closeFile(int p);
|
||||
|
||||
/** Set File name without frame index, file index and extension */
|
||||
int set_file_name();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user