mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
file writer class should be created only if file write enabled, x coord fixed to reflect hardcoded values as detector does not send this value yet
This commit is contained in:
parent
c37d3feae9
commit
d30a839eff
@ -311,6 +311,9 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** timer beginning stamp for random streaming */
|
||||
struct timespec timerBegin;
|
||||
|
||||
/** x coord hardcoded, as detector does not send them yet **/
|
||||
uint16_t xcoord;
|
||||
|
||||
|
||||
|
||||
//acquisition start
|
||||
|
@ -47,6 +47,7 @@ DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool* fwenable, bool*
|
||||
streamingFrequency(freq),
|
||||
streamingTimerInMs(timer),
|
||||
currentFreqCount(0),
|
||||
xcoord(0),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
firstAcquisitionIndex(0),
|
||||
@ -208,7 +209,7 @@ int DataProcessor::SetThreadPriority(int priority) {
|
||||
|
||||
|
||||
void DataProcessor::SetFileFormat(const fileFormat f) {
|
||||
if (file->GetFileType() != f) {
|
||||
if (file && 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;
|
||||
@ -228,9 +229,13 @@ void DataProcessor::SetupFileWriter(int* nd, char* fname, char* fpath, uint64_t*
|
||||
if (g)
|
||||
generalData = g;
|
||||
|
||||
// fix xcoord as detector is not providing it right now
|
||||
xcoord = ((NumberofDataProcessors > (*nunits)) ? index : ((*dindex) * (*nunits)) + index);
|
||||
|
||||
if (file)
|
||||
delete file;
|
||||
|
||||
if (*fileWriteEnable) {
|
||||
switch(*fileFormatType){
|
||||
#ifdef HDF5C
|
||||
case HDF5:
|
||||
@ -249,9 +254,12 @@ void DataProcessor::SetupFileWriter(int* nd, char* fname, char* fpath, uint64_t*
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// only the first file
|
||||
int DataProcessor::CreateNewFile(bool en, uint64_t nf, uint64_t at, uint64_t st, uint64_t ap) {
|
||||
if (file == NULL)
|
||||
return FAIL;
|
||||
file->CloseAllFiles();
|
||||
if (file->CreateMasterFile(en, generalData->imageSize, generalData->nPixelsX, generalData->nPixelsY,
|
||||
at, st, ap) == FAIL)
|
||||
@ -268,7 +276,7 @@ void DataProcessor::CloseFiles() {
|
||||
}
|
||||
|
||||
void DataProcessor::EndofAcquisition(uint64_t numf) {
|
||||
if (*fileWriteEnable && file->GetFileType() == HDF5) {
|
||||
if (file && file->GetFileType() == HDF5) {
|
||||
file->EndofAcquisition(numf);
|
||||
}
|
||||
}
|
||||
@ -312,6 +320,7 @@ void DataProcessor::StopProcessing(char* buf) {
|
||||
else
|
||||
fifo->FreeAddress(buf);
|
||||
|
||||
if (file)
|
||||
file->CloseCurrentFile();
|
||||
StopRunning();
|
||||
#ifdef VERBOSE
|
||||
@ -355,7 +364,10 @@ void DataProcessor::ProcessAnImage(char* buf) {
|
||||
}
|
||||
|
||||
|
||||
if (*fileWriteEnable)
|
||||
// fix x coord that is currently not provided by detector
|
||||
header->xCoord = xcoord;
|
||||
|
||||
if (file)
|
||||
file->WriteToFile(buf, generalData->imageSize + sizeof(sls_detector_header), fnum-firstMeasurementIndex, nump);
|
||||
|
||||
if (rawDataReadyCallBack) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user