mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 07:40:03 +02:00
reducing changes of segmentation for null string, syntax of receiver call backs
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@505 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
8088e6231e
commit
02376bbc62
@ -96,7 +96,6 @@ int multiSlsDetector::initSharedMemory(int id=0) {
|
|||||||
multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1)
|
multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1)
|
||||||
{
|
{
|
||||||
|
|
||||||
cout << "Contrustor" << endl;
|
|
||||||
while (shmId<0) {
|
while (shmId<0) {
|
||||||
shmId=initSharedMemory(id);
|
shmId=initSharedMemory(id);
|
||||||
id++;
|
id++;
|
||||||
@ -4394,7 +4393,6 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &fIndex){
|
|||||||
int *retdet, *p=retval;
|
int *retdet, *p=retval;
|
||||||
string fullFName="";
|
string fullFName="";
|
||||||
string ext="";
|
string ext="";
|
||||||
char * pch;
|
|
||||||
|
|
||||||
|
|
||||||
for (int id=0; id<thisMultiDetector->numberOfDetectors; id++) {
|
for (int id=0; id<thisMultiDetector->numberOfDetectors; id++) {
|
||||||
@ -4413,7 +4411,10 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &fIndex){
|
|||||||
if (strrchr(fName,'.')!=NULL){
|
if (strrchr(fName,'.')!=NULL){
|
||||||
ext.assign(fName);
|
ext.assign(fName);
|
||||||
size_t dot = ext.rfind(".");
|
size_t dot = ext.rfind(".");
|
||||||
|
if(dot != string::npos)
|
||||||
ext = ext.erase(0,dot);
|
ext = ext.erase(0,dot);
|
||||||
|
else
|
||||||
|
ext = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fullFName.append(getReceiverFileNameToConcatenate(fName));
|
fullFName.append(getReceiverFileNameToConcatenate(fName));
|
||||||
|
@ -2565,7 +2565,7 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
|||||||
return helpDetectorSize(narg,args,action);
|
return helpDetectorSize(narg,args,action);
|
||||||
ROI allroi[val];
|
ROI allroi[val];
|
||||||
pos=2;
|
pos=2;
|
||||||
for(int i=0;i<val;i++){
|
for(i=0;i<val;i++){
|
||||||
if ((!sscanf(args[pos++],"%d",&allroi[i].xmin)) ||
|
if ((!sscanf(args[pos++],"%d",&allroi[i].xmin)) ||
|
||||||
(!sscanf(args[pos++],"%d",&allroi[i].xmax)) ||
|
(!sscanf(args[pos++],"%d",&allroi[i].xmax)) ||
|
||||||
(!sscanf(args[pos++],"%d",&allroi[i].ymin)) ||
|
(!sscanf(args[pos++],"%d",&allroi[i].ymin)) ||
|
||||||
@ -2829,6 +2829,7 @@ string slsDetectorCommand::helpSN(int narg, char *args[], int action) {
|
|||||||
os << "detectorversion \n gets the firmware version of the detector"<< std::endl;
|
os << "detectorversion \n gets the firmware version of the detector"<< std::endl;
|
||||||
os << "softwareversion \n gets the software version of the detector"<< std::endl;
|
os << "softwareversion \n gets the software version of the detector"<< std::endl;
|
||||||
os << "thisversion \n gets the version of this software"<< std::endl;
|
os << "thisversion \n gets the version of this software"<< std::endl;
|
||||||
|
os << "receiverversion \n gets the version of the receiver"<< std::endl;
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
|
|
||||||
|
@ -278,16 +278,17 @@ class fileIOStatic {
|
|||||||
\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 string getReceiverFileNameToConcatenate(string fname) { \
|
||||||
int i; \
|
//int i;
|
||||||
string s; \
|
string s=fname; \
|
||||||
s=fname; \
|
if(fname.empty()) return fname; \
|
||||||
size_t slash=s.rfind("/"); \
|
size_t slash=s.rfind("/"); \
|
||||||
if (slash!= string::npos) \
|
if (slash!= string::npos) \
|
||||||
s=s.substr(slash,s.size()-slash); \
|
s=s.substr(slash,s.size()-slash); \
|
||||||
size_t dot=s.find("."); \
|
size_t dot=s.find("."); \
|
||||||
size_t uscore=s.find("_"); \
|
size_t uscore=s.find("_"); \
|
||||||
|
if ((dot!= string::npos)&&(uscore!= string::npos)) \
|
||||||
s=s.substr(uscore,dot-uscore); \
|
s=s.substr(uscore,dot-uscore); \
|
||||||
uscore=s.find("_",1); \
|
// uscore=s.find("_",1);
|
||||||
//if ((uscore!= string::npos) && (sscanf( s.substr(1,uscore-1).c_str(),"d%d",&i)))
|
//if ((uscore!= string::npos) && (sscanf( s.substr(1,uscore-1).c_str(),"d%d",&i)))
|
||||||
//s=s.substr(uscore,s.size()-uscore);
|
//s=s.substr(uscore,s.size()-uscore);
|
||||||
return s; \
|
return s; \
|
||||||
|
@ -399,7 +399,7 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *wbuf;
|
char *wbuf;
|
||||||
int ret,sleepnumber=0;
|
int sleepnumber=0;
|
||||||
|
|
||||||
framesInFile=0;
|
framesInFile=0;
|
||||||
framesCaught=0;
|
framesCaught=0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//#ifdef SLS_RECEIVER_FUNCTION_LIST
|
#ifdef SLS_RECEIVER_FUNCTION_LIST
|
||||||
|
|
||||||
#ifndef SLS_RECEIVER_FUNCTION_LIST_H
|
#ifndef SLS_RECEIVER_FUNCTION_LIST_H
|
||||||
#define SLS_RECEIVER_FUNCTION_LIST_H
|
#define SLS_RECEIVER_FUNCTION_LIST_H
|
||||||
@ -111,7 +111,7 @@ public:
|
|||||||
* Set Frame Index Needed
|
* Set Frame Index Needed
|
||||||
* @param i frame index needed
|
* @param i frame index needed
|
||||||
*/
|
*/
|
||||||
int setFrameIndexNeeded(int i){frameIndexNeeded = i;};
|
int setFrameIndexNeeded(int i){frameIndexNeeded = i; return frameIndexNeeded;};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set enable file write
|
* Set enable file write
|
||||||
@ -371,7 +371,7 @@ public:
|
|||||||
toatal frames caught
|
toatal frames caught
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){acquisitionFinishedCallBack=func; pAcquisitionFinished=arg;};
|
void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){acquisitionFinishedCallBack=func; pAcquisitionFinished=arg;};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ public:
|
|||||||
file descriptor
|
file descriptor
|
||||||
guidatapointer (NULL, no data required)
|
guidatapointer (NULL, no data required)
|
||||||
*/
|
*/
|
||||||
int registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg){rawDataReadyCallBack=func; pRawDataReady=arg;};
|
void registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg){rawDataReadyCallBack=func; pRawDataReady=arg;};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -392,4 +392,4 @@ public:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#endif
|
#endif
|
||||||
|
@ -25,12 +25,12 @@ void slsReceiverUsers::registerCallBackStartAcquisition(int (*func)(char*, char*
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsReceiverUsers::registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){
|
void slsReceiverUsers::registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){
|
||||||
receiver->registerCallBackAcquisitionFinished(func,arg);
|
receiver->registerCallBackAcquisitionFinished(func,arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsReceiverUsers::registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg){
|
void slsReceiverUsers::registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg){
|
||||||
receiver->registerCallBackRawDataReady(func,arg);
|
receiver->registerCallBackRawDataReady(func,arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int registerCallBackAcquisitionFinished(void (*func)(int nf, void*),void *arg);
|
void registerCallBackAcquisitionFinished(void (*func)(int nf, void*),void *arg);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ public:
|
|||||||
\returns nothing
|
\returns nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int registerCallBackRawDataReady(void (*func)(int framenumber, char* datapointer, FILE* filedescriptor, char* guidatapointer, void*),void *arg);
|
void registerCallBackRawDataReady(void (*func)(int framenumber, char* datapointer, FILE* filedescriptor, char* guidatapointer, void*),void *arg);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -24,7 +24,7 @@ slsReceiverFuncs::~slsReceiverFuncs() {
|
|||||||
|
|
||||||
slsReceiverFuncs::closeFile(0);
|
slsReceiverFuncs::closeFile(0);
|
||||||
cout << "Goodbye!" << endl;
|
cout << "Goodbye!" << endl;
|
||||||
delete socket;
|
if(socket) delete socket;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,15 +34,14 @@ slsReceiverFuncs::slsReceiverFuncs(int argc, char *argv[], int &success):
|
|||||||
ret(OK),
|
ret(OK),
|
||||||
lockStatus(0),
|
lockStatus(0),
|
||||||
shortFrame(-1),
|
shortFrame(-1),
|
||||||
packetsPerFrame(2){
|
packetsPerFrame(PACKETS_PER_FRAME){
|
||||||
|
|
||||||
int port_no = DEFAULT_PORTNO+2;
|
int port_no = DEFAULT_PORTNO+2;
|
||||||
ifstream infile;
|
ifstream infile;
|
||||||
string sLine,sargname;
|
string sLine,sargname;
|
||||||
int iline = 0;
|
int iline = 0;
|
||||||
|
|
||||||
success=slsDetectorDefs::OK;
|
success=OK;
|
||||||
|
|
||||||
string fname = "";
|
string fname = "";
|
||||||
|
|
||||||
//parse command line for config
|
//parse command line for config
|
||||||
@ -260,8 +259,6 @@ int slsReceiverFuncs::M_nofunc(){
|
|||||||
|
|
||||||
|
|
||||||
void slsReceiverFuncs::closeFile(int p){
|
void slsReceiverFuncs::closeFile(int p){
|
||||||
char *buf;
|
|
||||||
char buffer[1];
|
|
||||||
|
|
||||||
|
|
||||||
if(slsReceiverFunctionList::listening_thread_running)
|
if(slsReceiverFunctionList::listening_thread_running)
|
||||||
@ -723,7 +720,6 @@ int slsReceiverFuncs::get_frame_index(){
|
|||||||
|
|
||||||
int slsReceiverFuncs::reset_frames_caught(){
|
int slsReceiverFuncs::reset_frames_caught(){
|
||||||
ret=OK;
|
ret=OK;
|
||||||
int index=-1;
|
|
||||||
|
|
||||||
strcpy(mess,"Could not reset frames caught\n");
|
strcpy(mess,"Could not reset frames caught\n");
|
||||||
|
|
||||||
@ -759,7 +755,7 @@ int slsReceiverFuncs::reset_frames_caught(){
|
|||||||
|
|
||||||
int slsReceiverFuncs::read_frame(){
|
int slsReceiverFuncs::read_frame(){
|
||||||
ret=OK;
|
ret=OK;
|
||||||
char fName[MAX_STR_LENGTH];
|
char fName[MAX_STR_LENGTH]="";
|
||||||
int arg = -1,i;
|
int arg = -1,i;
|
||||||
|
|
||||||
//retval is a full frame
|
//retval is a full frame
|
||||||
@ -777,7 +773,6 @@ int slsReceiverFuncs::read_frame(){
|
|||||||
int bufferSize = BUFFER_SIZE;
|
int bufferSize = BUFFER_SIZE;
|
||||||
if(shortFrame!=-1)
|
if(shortFrame!=-1)
|
||||||
bufferSize=SHORT_BUFFER_SIZE;
|
bufferSize=SHORT_BUFFER_SIZE;
|
||||||
int nel = bufferSize/(sizeof(int));
|
|
||||||
char* raw = new char[bufferSize];
|
char* raw = new char[bufferSize];
|
||||||
int* origVal = new int[rnel];
|
int* origVal = new int[rnel];
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){slsReceiverList->registerCallBackAcquisitionFinished(func,arg);};
|
void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){slsReceiverList->registerCallBackAcquisitionFinished(func,arg);};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ public:
|
|||||||
guidatapointer (NULL, no data required)
|
guidatapointer (NULL, no data required)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg){slsReceiverList->registerCallBackRawDataReady(func,arg);};
|
void registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg){slsReceiverList->registerCallBackRawDataReady(func,arg);};
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user