mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-20 00:37:12 +02:00
removed setframeindexenable from being set by client, redundant. removed read_frame from list of functions, obsolete.
This commit is contained in:
@ -15,11 +15,10 @@ using namespace std;
|
||||
FILE* BinaryFile::masterfd = 0;
|
||||
|
||||
BinaryFile::BinaryFile(int ind, uint32_t maxf, const uint32_t* ppf,
|
||||
int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
bool* frindexenable, bool* owenable,
|
||||
int* nd, char* fname, char* fpath, uint64_t* findex, bool* owenable,
|
||||
int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno):
|
||||
|
||||
File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno),
|
||||
File(ind, maxf, ppf, nd, fname, fpath, findex, owenable, dindex, nunits, nf, dr, portno),
|
||||
filefd(0),
|
||||
numFramesInFile(0),
|
||||
numActualPacketsInFile(0)
|
||||
@ -49,7 +48,7 @@ int BinaryFile::CreateFile(uint64_t fnum) {
|
||||
numActualPacketsInFile = 0;
|
||||
|
||||
currentFileName = BinaryFileStatic::CreateFileName(filePath, fileNamePrefix, *fileIndex,
|
||||
*frameIndexEnable, fnum, *detIndex, *numUnitsPerDetector, index);
|
||||
(*numImages > 1), fnum, *detIndex, *numUnitsPerDetector, index);
|
||||
|
||||
if (BinaryFileStatic::CreateDataFile(filefd, *overWriteEnable, currentFileName, FILE_BUFFER_SIZE) == FAIL)
|
||||
return FAIL;
|
||||
|
@ -211,18 +211,18 @@ void DataProcessor::SetFileFormat(const fileFormat f) {
|
||||
if (file->GetFileType() != f) {
|
||||
//remember the pointer values before they are destroyed
|
||||
int nd[MAX_DIMENSIONS];nd[0] = 0; nd[1] = 0;
|
||||
char* fname=0; char* fpath=0; uint64_t* findex=0; bool* frindexenable=0;
|
||||
char* fname=0; char* fpath=0; uint64_t* findex=0;
|
||||
bool* owenable=0; int* dindex=0; int* nunits=0; uint64_t* nf = 0; uint32_t* dr = 0; uint32_t* port = 0;
|
||||
file->GetMemberPointerValues(nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, port);
|
||||
file->GetMemberPointerValues(nd, fname, fpath, findex, owenable, dindex, nunits, nf, dr, port);
|
||||
//create file writer with same pointers
|
||||
SetupFileWriter(nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, port);
|
||||
SetupFileWriter(nd, fname, fpath, findex, owenable, dindex, nunits, nf, dr, port);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DataProcessor::SetupFileWriter(int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
bool* frindexenable, bool* owenable, int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno,
|
||||
bool* owenable, int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno,
|
||||
GeneralData* g)
|
||||
{
|
||||
if (g)
|
||||
@ -235,16 +235,14 @@ void DataProcessor::SetupFileWriter(int* nd, char* fname, char* fpath, uint64_t*
|
||||
#ifdef HDF5C
|
||||
case HDF5:
|
||||
file = new HDF5File(index, generalData->maxFramesPerFile, &generalData->packetsPerFrame,
|
||||
nd, fname, fpath, findex,
|
||||
frindexenable, owenable,
|
||||
nd, fname, fpath, findex, owenable,
|
||||
dindex, nunits, nf, dr, portno,
|
||||
generalData->nPixelsX, generalData->nPixelsY);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
file = new BinaryFile(index, generalData->maxFramesPerFile, &generalData->packetsPerFrame,
|
||||
nd, fname, fpath, findex,
|
||||
frindexenable, owenable,
|
||||
nd, fname, fpath, findex, owenable,
|
||||
dindex, nunits, nf, dr, portno);
|
||||
break;
|
||||
}
|
||||
|
@ -11,8 +11,7 @@ using namespace std;
|
||||
|
||||
|
||||
File::File(int ind, uint32_t maxf, const uint32_t* ppf,
|
||||
int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
bool* frindexenable, bool* owenable,
|
||||
int* nd, char* fname, char* fpath, uint64_t* findex, bool* owenable,
|
||||
int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno):
|
||||
index(ind),
|
||||
maxFramesPerFile(maxf),
|
||||
@ -22,7 +21,6 @@ File::File(int ind, uint32_t maxf, const uint32_t* ppf,
|
||||
fileNamePrefix(fname),
|
||||
filePath(fpath),
|
||||
fileIndex(findex),
|
||||
frameIndexEnable(frindexenable),
|
||||
overWriteEnable(owenable),
|
||||
detIndex(dindex),
|
||||
numUnitsPerDetector(nunits),
|
||||
@ -50,7 +48,6 @@ void File::PrintMembers() {
|
||||
<< "File Name Prefix: " << fileNamePrefix << endl
|
||||
<< "File Path: " << filePath << endl
|
||||
<< "File Index: " << *fileIndex << endl
|
||||
<< "Frame Index Enable: " << *frameIndexEnable << endl
|
||||
<< "Over Write Enable: " << *overWriteEnable << endl
|
||||
|
||||
<< "Detector Index: " << *detIndex << endl
|
||||
@ -63,8 +60,7 @@ void File::PrintMembers() {
|
||||
}
|
||||
|
||||
|
||||
void File::GetMemberPointerValues(int* nd, char*& fname, char*& fpath, uint64_t*& findex,
|
||||
bool*& frindexenable, bool*& owenable,
|
||||
void File::GetMemberPointerValues(int* nd, char*& fname, char*& fpath, uint64_t*& findex, bool*& owenable,
|
||||
int*& dindex, int*& nunits, uint64_t*& nf, uint32_t*& dr, uint32_t*& portno)
|
||||
{
|
||||
nd[0] = numDetX;
|
||||
@ -72,7 +68,6 @@ void File::GetMemberPointerValues(int* nd, char*& fname, char*& fpath, uint64_t*
|
||||
fname = fileNamePrefix;
|
||||
fpath = filePath;
|
||||
findex = fileIndex;
|
||||
frindexenable = frameIndexEnable;
|
||||
owenable = overWriteEnable;
|
||||
dindex = detIndex;
|
||||
nunits = numUnitsPerDetector;
|
||||
|
@ -91,14 +91,14 @@ int HDF5File::CreateFile(uint64_t fnum) {
|
||||
numFramesInFile = 0;
|
||||
numActualPacketsInFile = 0;
|
||||
currentFileName = HDF5FileStatic::CreateFileName(filePath, fileNamePrefix, *fileIndex,
|
||||
*frameIndexEnable, fnum, *detIndex, *numUnitsPerDetector, index);
|
||||
(*numImages > 1), fnum, *detIndex, *numUnitsPerDetector, index);
|
||||
|
||||
//first time
|
||||
if(!fnum) UpdateDataType();
|
||||
|
||||
uint64_t framestosave = ((*numImages - fnum) > maxFramesPerFile) ? maxFramesPerFile : (*numImages-fnum);
|
||||
pthread_mutex_lock(&Mutex);
|
||||
if (HDF5FileStatic::CreateDataFile(index, *overWriteEnable, currentFileName, *frameIndexEnable,
|
||||
if (HDF5FileStatic::CreateDataFile(index, *overWriteEnable, currentFileName, (*numImages > 1),
|
||||
fnum, framestosave, nPixelsY, ((*dynamicRange==4) ? (nPixelsX/2) : nPixelsX),
|
||||
datatype, filefd, dataspace, dataset,
|
||||
HDF5_WRITER_VERSION, MAX_CHUNKED_IMAGES,
|
||||
@ -191,7 +191,7 @@ void HDF5File::EndofAcquisition(uint64_t numf) {
|
||||
//dataset name
|
||||
ostringstream osfn;
|
||||
osfn << "/data";
|
||||
if (*frameIndexEnable) osfn << "_f" << setfill('0') << setw(12) << 0;
|
||||
if ((*numImages > 1)) osfn << "_f" << setfill('0') << setw(12) << 0;
|
||||
string dsetname = osfn.str();
|
||||
pthread_mutex_lock(&Mutex);
|
||||
HDF5FileStatic::LinkVirtualInMaster(masterFileName, currentFileName, dsetname);
|
||||
@ -212,7 +212,7 @@ int HDF5File::CreateVirtualFile(uint64_t numf) {
|
||||
pthread_mutex_lock(&Mutex);
|
||||
int ret = HDF5FileStatic::CreateVirtualDataFile(
|
||||
virtualfd, masterFileName,
|
||||
filePath, fileNamePrefix, *fileIndex, *frameIndexEnable,
|
||||
filePath, fileNamePrefix, *fileIndex, (*numImages > 1),
|
||||
*detIndex, *numUnitsPerDetector,
|
||||
maxFramesPerFile, numf,
|
||||
"data", datatype,
|
||||
|
@ -70,7 +70,6 @@ void UDPBaseImplementation::initializeMembers(){
|
||||
strcpy(filePath,"");
|
||||
fileIndex = 0;
|
||||
scanTag = 0;
|
||||
frameIndexEnable = false;
|
||||
fileWriteEnable = true;
|
||||
overwriteEnable = true;
|
||||
dataCompressionEnable = false;
|
||||
@ -151,8 +150,6 @@ uint64_t UDPBaseImplementation::getFileIndex() const{ FILE_LOG(logDEBUG) << __AT
|
||||
|
||||
int UDPBaseImplementation::getScanTag() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return scanTag;}
|
||||
|
||||
bool UDPBaseImplementation::getFrameIndexEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return frameIndexEnable;}
|
||||
|
||||
bool UDPBaseImplementation::getFileWriteEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return fileWriteEnable;}
|
||||
|
||||
bool UDPBaseImplementation::getOverwriteEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return overwriteEnable;}
|
||||
@ -317,13 +314,6 @@ void UDPBaseImplementation::setScanTag(const int i){
|
||||
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFrameIndexEnable(const bool b){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
frameIndexEnable = b;
|
||||
FILE_LOG(logINFO) << "Frame Index Enable: " << stringEnable(frameIndexEnable);
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFileWriteEnable(const bool b){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
@ -548,11 +538,6 @@ void UDPBaseImplementation::shutDownUDPSockets(){
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::readFrame(int ithread, char* c,char** raw, int64_t &startAcquisitionIndex, int64_t &startFrameIndex){
|
||||
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
|
||||
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
|
||||
}
|
||||
|
||||
|
||||
//FIXME: needed, isnt stopReceiver enough?
|
||||
void UDPBaseImplementation::abort(){
|
||||
|
@ -369,36 +369,8 @@ void UDPRESTImplementation::shutDownUDPSockets(){
|
||||
|
||||
|
||||
|
||||
/* FIXME
|
||||
* do you really need this, this is called if registerDataCallback() is activated
|
||||
* in your gui to get data from receiver. you probably have a different way
|
||||
* of reconstructing complete data set from all receivers
|
||||
*/
|
||||
/*
|
||||
void UDPRESTImplementation::readFrame(char* c,char** raw, uint64_t &startAcq, uint64_t &startFrame){
|
||||
FILE_LOG(logDEBUG1) << " called";
|
||||
strcpy(c,"");
|
||||
*raw = NULL;
|
||||
>>>>>>> 3.0-rcrest
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/* FIXME
|
||||
* Its called by TCP in case of illegal shut down such as Ctrl + c.
|
||||
* Upto you what you want to do with it.
|
||||
*/
|
||||
|
||||
// Leo: not in the base class
|
||||
/*
|
||||
void UDPRESTImplementation::closeFiles(){
|
||||
FILE_LOG(logDEBUG1) << "called for thread ";
|
||||
FILE_LOG(logDEBUG1) << "exited for thread ";
|
||||
}
|
||||
*/
|
||||
|
||||
uint64_t UDPRESTImplementation::getTotalFramesCaught() const{
|
||||
FILE_LOG(logDEBUG1) << " starting";
|
||||
return (0);
|
||||
|
@ -360,7 +360,7 @@ void UDPStandardImplementation::setDetectorPositionId(const int i){
|
||||
detID = i;
|
||||
FILE_LOG(logINFO) << "Detector Position Id:" << detID;
|
||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
|
||||
dataProcessor[i]->SetupFileWriter((int*)numDet, fileName, filePath, &fileIndex, &frameIndexEnable,
|
||||
dataProcessor[i]->SetupFileWriter((int*)numDet, fileName, filePath, &fileIndex,
|
||||
&overwriteEnable, &detID, &numThreads, &numberOfFrames, &dynamicRange, &udpPortNum[i], generalData);
|
||||
}
|
||||
}
|
||||
|
@ -261,11 +261,9 @@ const char* slsReceiverTCPIPInterface::getFunctionName(enum recFuncs func) {
|
||||
case F_START_RECEIVER: return "F_START_RECEIVER";
|
||||
case F_STOP_RECEIVER: return "F_STOP_RECEIVER";
|
||||
case F_START_RECEIVER_READOUT: return "F_START_RECEIVER_READOUT";
|
||||
case F_READ_RECEIVER_FRAME: return "F_READ_RECEIVER_FRAME";
|
||||
case F_SET_RECEIVER_FILE_PATH: return "F_SET_RECEIVER_FILE_PATH";
|
||||
case F_SET_RECEIVER_FILE_NAME: return "F_SET_RECEIVER_FILE_NAME";
|
||||
case F_SET_RECEIVER_FILE_INDEX: return "F_SET_RECEIVER_FILE_INDEX";
|
||||
case F_SET_RECEIVER_FRAME_INDEX: return "F_SET_RECEIVER_FRAME_INDEX";
|
||||
case F_GET_RECEIVER_FRAME_INDEX: return "F_GET_RECEIVER_FRAME_INDEX";
|
||||
case F_GET_RECEIVER_FRAMES_CAUGHT: return "F_GET_RECEIVER_FRAMES_CAUGHT";
|
||||
case F_RESET_RECEIVER_FRAMES_CAUGHT:return "F_RESET_RECEIVER_FRAMES_CAUGHT";
|
||||
@ -308,11 +306,9 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
flist[F_START_RECEIVER] = &slsReceiverTCPIPInterface::start_receiver;
|
||||
flist[F_STOP_RECEIVER] = &slsReceiverTCPIPInterface::stop_receiver;
|
||||
flist[F_START_RECEIVER_READOUT] = &slsReceiverTCPIPInterface::start_readout;
|
||||
flist[F_READ_RECEIVER_FRAME] = &slsReceiverTCPIPInterface::read_frame;
|
||||
flist[F_SET_RECEIVER_FILE_PATH] = &slsReceiverTCPIPInterface::set_file_dir;
|
||||
flist[F_SET_RECEIVER_FILE_NAME] = &slsReceiverTCPIPInterface::set_file_name;
|
||||
flist[F_SET_RECEIVER_FILE_INDEX] = &slsReceiverTCPIPInterface::set_file_index;
|
||||
flist[F_SET_RECEIVER_FRAME_INDEX] = &slsReceiverTCPIPInterface::set_frame_index;
|
||||
flist[F_GET_RECEIVER_FRAME_INDEX] = &slsReceiverTCPIPInterface::get_frame_index;
|
||||
flist[F_GET_RECEIVER_FRAMES_CAUGHT] = &slsReceiverTCPIPInterface::get_frames_caught;
|
||||
flist[F_RESET_RECEIVER_FRAMES_CAUGHT] = &slsReceiverTCPIPInterface::reset_frames_caught;
|
||||
@ -1374,26 +1370,6 @@ int slsReceiverTCPIPInterface::start_readout(){
|
||||
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::read_frame(){
|
||||
ret=FAIL;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int n = 0;
|
||||
// to receive any arguments
|
||||
while (n > 0)
|
||||
n = mySock->ReceiveDataOnly(mess,MAX_STR_LENGTH);
|
||||
|
||||
sprintf(mess,"This function (%s) is not implemented anymore\n", getFunctionName((enum recFuncs)fnum));
|
||||
FILE_LOG(logERROR) << mess;
|
||||
|
||||
// send ok / fail
|
||||
mySock->SendDataOnly(&ret,sizeof(ret));
|
||||
// send return argument
|
||||
mySock->SendDataOnly(mess,sizeof(mess));
|
||||
// return ok / fail
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::set_file_dir() {
|
||||
ret = OK;
|
||||
@ -1572,62 +1548,6 @@ int slsReceiverTCPIPInterface::set_file_index() {
|
||||
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::set_frame_index() {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int index = -1;
|
||||
int retval = -1;
|
||||
|
||||
strcpy(mess,"Could not set frame index\n");
|
||||
// receive arguments
|
||||
if (mySock->ReceiveDataOnly(&index,sizeof(index)) < 0 )
|
||||
return printSocketReadError();
|
||||
|
||||
// execute action
|
||||
// only a set, not a get
|
||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
if (receiverBase == NULL)
|
||||
invalidReceiverObject();
|
||||
else if (mySock->differentClients && lockStatus)
|
||||
receiverlocked();
|
||||
else if (receiverBase->getStatus() != IDLE)
|
||||
receiverNotIdle();
|
||||
else{
|
||||
//client sets to 0, but for receiver it is just an enable
|
||||
//client uses this value for other detectors not using receiver,
|
||||
//so implement the interface here
|
||||
|
||||
switch(index){
|
||||
case -1: index=0; break;
|
||||
default: index=1; break; //value is 0
|
||||
}
|
||||
receiverBase->setFrameIndexEnable(index);
|
||||
retval=receiverBase->getFrameIndexEnable();
|
||||
switch(retval){
|
||||
case 0: retval=-1; break;
|
||||
case 1: retval=0; break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
FILE_LOG(logDEBUG1) << "frame index:" << retval;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (ret == OK && mySock->differentClients)
|
||||
ret = FORCE_UPDATE;
|
||||
|
||||
// send answer
|
||||
mySock->SendDataOnly(&ret,sizeof(ret));
|
||||
if (ret == FAIL)
|
||||
mySock->SendDataOnly(mess,sizeof(mess));
|
||||
mySock->SendDataOnly(&retval,sizeof(retval));
|
||||
|
||||
// return ok/fail
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int slsReceiverTCPIPInterface::get_frame_index(){
|
||||
|
Reference in New Issue
Block a user