mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
New filename structure (#38)
* WIP * WIP * linking names * define for hdf5 * minor * addressed comments
This commit is contained in:

committed by
Dhanya Thattil

parent
6b7d9445aa
commit
1a9755ad0b
@ -42,12 +42,12 @@ slsDetectorDefs::fileFormat BinaryFile::GetFileType() {
|
||||
}
|
||||
|
||||
|
||||
int BinaryFile::CreateFile(uint64_t fnum) {
|
||||
int BinaryFile::CreateFile() {
|
||||
numFramesInFile = 0;
|
||||
numActualPacketsInFile = 0;
|
||||
|
||||
currentFileName = BinaryFileStatic::CreateFileName(filePath, fileNamePrefix, *fileIndex,
|
||||
(*numImages > 1), fnum, *detIndex, *numUnitsPerDetector, index);
|
||||
subFileIndex, *detIndex, *numUnitsPerDetector, index);
|
||||
|
||||
if (BinaryFileStatic::CreateDataFile(filefd, *overWriteEnable, currentFileName, FILE_BUFFER_SIZE) == FAIL)
|
||||
return FAIL;
|
||||
@ -72,7 +72,8 @@ int BinaryFile::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_
|
||||
// check if maxframesperfile = 0 for infinite
|
||||
if ((*maxFramesPerFile) && (numFramesInFile >= (*maxFramesPerFile))) {
|
||||
CloseCurrentFile();
|
||||
CreateFile(fnum);
|
||||
++subFileIndex;
|
||||
CreateFile();
|
||||
}
|
||||
numFramesInFile++;
|
||||
numActualPacketsInFile += nump;
|
||||
|
@ -252,11 +252,12 @@ int DataProcessor::CreateNewFile(bool en, uint64_t nf, uint64_t at, uint64_t st,
|
||||
if (file == nullptr)
|
||||
return FAIL;
|
||||
file->CloseAllFiles();
|
||||
file->resetSubFileIndex();
|
||||
if (file->CreateMasterFile(*masterFileWriteEnable, en, generalData->imageSize,
|
||||
generalData->nPixelsX, generalData->nPixelsY,
|
||||
at, st, sp, ap) == FAIL)
|
||||
return FAIL;
|
||||
if (file->CreateFile(currentFrameIndex) == FAIL)
|
||||
if (file->CreateFile() == FAIL)
|
||||
return FAIL;
|
||||
return OK;
|
||||
}
|
||||
|
@ -38,6 +38,10 @@ std::string File::GetCurrentFileName() {
|
||||
return currentFileName;
|
||||
}
|
||||
|
||||
void File::resetSubFileIndex(){
|
||||
subFileIndex = 0u;
|
||||
}
|
||||
|
||||
void File::PrintMembers(TLogLevel level) {
|
||||
FILE_LOG(level) << "\nGeneral Writer Variables:" << std::endl
|
||||
<< "Index: " << index << std::endl
|
||||
|
@ -128,22 +128,23 @@ void HDF5File::UpdateDataType() {
|
||||
}
|
||||
|
||||
|
||||
int HDF5File::CreateFile(uint64_t fnum) {
|
||||
int HDF5File::CreateFile() {
|
||||
numFilesinAcquisition++;
|
||||
numFramesInFile = 0;
|
||||
numActualPacketsInFile = 0;
|
||||
currentFileName = HDF5FileStatic::CreateFileName(filePath, fileNamePrefix, *fileIndex,
|
||||
(*numImages > 1), fnum, *detIndex, *numUnitsPerDetector, index);
|
||||
subFileIndex, *detIndex, *numUnitsPerDetector, index);
|
||||
|
||||
//first time
|
||||
if(!fnum) UpdateDataType();
|
||||
if(subFileIndex == 0u)
|
||||
UpdateDataType();
|
||||
|
||||
uint64_t framestosave = ((*maxFramesPerFile == 0) ? *numImages : // infinite images
|
||||
(((extNumImages - fnum) > (*maxFramesPerFile)) ? // save up to maximum at a time
|
||||
(*maxFramesPerFile) : (extNumImages-fnum)));
|
||||
(((extNumImages - subFileIndex) > (*maxFramesPerFile)) ? // save up to maximum at a time
|
||||
(*maxFramesPerFile) : (extNumImages-subFileIndex)));
|
||||
pthread_mutex_lock(&Mutex);
|
||||
if (HDF5FileStatic::CreateDataFile(index, *overWriteEnable, currentFileName, (*numImages > 1),
|
||||
fnum, framestosave, nPixelsY, ((*dynamicRange==4) ? (nPixelsX/2) : nPixelsX),
|
||||
subFileIndex, framestosave, nPixelsY, ((*dynamicRange==4) ? (nPixelsX/2) : nPixelsX),
|
||||
datatype, filefd, dataspace, dataset,
|
||||
HDF5_WRITER_VERSION, MAX_CHUNKED_IMAGES,
|
||||
dataspace_para, dataset_para,
|
||||
@ -199,7 +200,8 @@ int HDF5File::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t
|
||||
// check if maxframesperfile = 0 for infinite
|
||||
if ((*maxFramesPerFile) && (numFramesInFile >= (*maxFramesPerFile))) {
|
||||
CloseCurrentFile();
|
||||
CreateFile(fnum);
|
||||
++subFileIndex;
|
||||
CreateFile();
|
||||
}
|
||||
numFramesInFile++;
|
||||
numActualPacketsInFile += nump;
|
||||
|
Reference in New Issue
Block a user