mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-05 11:58:42 +01:00
wip
This commit is contained in:
@@ -87,15 +87,37 @@ void DataProcessor::SetGeneralData(GeneralData *generalData) {
|
|||||||
generalData_ = generalData;
|
generalData_ = generalData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataProcessor::CloseFiles() {
|
||||||
|
if (dataFile_)
|
||||||
|
dataFile_->CloseFile();
|
||||||
|
if (masterFile_)
|
||||||
|
masterFile_->CloseFile();
|
||||||
|
/*
|
||||||
|
#ifdef HDF5C
|
||||||
|
if(virtualFile_)
|
||||||
|
virtualFile_->CloseFile();
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
void DataProcessor::DeleteFiles() {
|
void DataProcessor::DeleteFiles() {
|
||||||
if (dataFile_ != nullptr) {
|
CloseFiles();
|
||||||
|
if (dataFile_) {
|
||||||
delete dataFile_;
|
delete dataFile_;
|
||||||
dataFile_ = nullptr;
|
dataFile_ = nullptr;
|
||||||
}
|
}
|
||||||
if (masterFile_ != nullptr) {
|
if (masterFile_) {
|
||||||
delete masterFile_;
|
delete masterFile_;
|
||||||
masterFile_ = nullptr;
|
masterFile_ = nullptr;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
#ifdef HDF5C
|
||||||
|
if(virtualFile_) {
|
||||||
|
delete virtualFile_;
|
||||||
|
virtualFile_ = nullptr;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
void DataProcessor::SetupFileWriter(const bool filewriteEnable,
|
void DataProcessor::SetupFileWriter(const bool filewriteEnable,
|
||||||
const bool masterFilewriteEnable,
|
const bool masterFilewriteEnable,
|
||||||
@@ -134,7 +156,6 @@ void DataProcessor::CreateFirstFiles(
|
|||||||
const bool overWriteEnable, const bool silentMode, const int modulePos,
|
const bool overWriteEnable, const bool silentMode, const int modulePos,
|
||||||
const int numUnitsPerReadout, const uint32_t udpPortNumber,
|
const int numUnitsPerReadout, const uint32_t udpPortNumber,
|
||||||
const uint32_t maxFramesPerFile, const uint64_t numImages,
|
const uint32_t maxFramesPerFile, const uint64_t numImages,
|
||||||
const uint32_t nPIxelsX, const uint32_t nPIxelsY,
|
|
||||||
const uint32_t dynamicRange) {
|
const uint32_t dynamicRange) {
|
||||||
if (dataFile_ == nullptr) {
|
if (dataFile_ == nullptr) {
|
||||||
throw sls::RuntimeError("file object not contstructed");
|
throw sls::RuntimeError("file object not contstructed");
|
||||||
@@ -160,7 +181,8 @@ void DataProcessor::CreateFirstFiles(
|
|||||||
dataFile_->CreateFirstHDF5DataFile(
|
dataFile_->CreateFirstHDF5DataFile(
|
||||||
filePath, fileNamePrefix, fileIndex, overWriteEnable, silentMode,
|
filePath, fileNamePrefix, fileIndex, overWriteEnable, silentMode,
|
||||||
modulePos, numUnitsPerReadout, udpPortNumber, maxFramesPerFile,
|
modulePos, numUnitsPerReadout, udpPortNumber, maxFramesPerFile,
|
||||||
numImages, nPIxelsX, nPIxelsY, dynamicRange);
|
numImages, generalData_->nPixelsX, generalData_->nPixelsY,
|
||||||
|
dynamicRange);
|
||||||
/*if (virtualFile_) {
|
/*if (virtualFile_) {
|
||||||
virtualFile_->CreateFile();
|
virtualFile_->CreateFile();
|
||||||
}*/
|
}*/
|
||||||
@@ -223,6 +245,7 @@ void DataProcessor::StopProcessing(char *buf) {
|
|||||||
else
|
else
|
||||||
fifo_->FreeAddress(buf);
|
fifo_->FreeAddress(buf);
|
||||||
|
|
||||||
|
CloseFiles();
|
||||||
StopRunning();
|
StopRunning();
|
||||||
LOG(logDEBUG1) << index << ": Processing Completed";
|
LOG(logDEBUG1) << index << ": Processing Completed";
|
||||||
}
|
}
|
||||||
@@ -289,6 +312,20 @@ uint64_t DataProcessor::ProcessAnImage(char *buf) {
|
|||||||
std::string(e.what()));
|
std::string(e.what()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// write to file
|
||||||
|
if (dataFile_ != nullptr) {
|
||||||
|
try {
|
||||||
|
dataFile_->WriteToFile(
|
||||||
|
buf + FIFO_HEADER_NUMBYTES,
|
||||||
|
sizeof(sls_receiver_header) +
|
||||||
|
(uint32_t)(*((uint32_t *)buf)), //+ size of data (resizable
|
||||||
|
// from previous call back
|
||||||
|
fnum - firstIndex_, nump);
|
||||||
|
} catch (const sls::RuntimeError &e) {
|
||||||
|
; // ignore write exception for now (TODO: send error message
|
||||||
|
// via stopReceiver tcp)
|
||||||
|
}
|
||||||
|
}
|
||||||
return fnum;
|
return fnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
void ResetParametersforNewAcquisition();
|
void ResetParametersforNewAcquisition();
|
||||||
void SetGeneralData(GeneralData *generalData);
|
void SetGeneralData(GeneralData *generalData);
|
||||||
|
|
||||||
|
void CloseFiles();
|
||||||
void DeleteFiles();
|
void DeleteFiles();
|
||||||
void SetupFileWriter(const bool filewriteEnable,
|
void SetupFileWriter(const bool filewriteEnable,
|
||||||
const bool masterFilewriteEnable,
|
const bool masterFilewriteEnable,
|
||||||
@@ -58,8 +59,8 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
const int numUnitsPerReadout,
|
const int numUnitsPerReadout,
|
||||||
const uint32_t udpPortNumber,
|
const uint32_t udpPortNumber,
|
||||||
const uint32_t maxFramesPerFile,
|
const uint32_t maxFramesPerFile,
|
||||||
const uint64_t numImages, const uint32_t nPIxelsX,
|
const uint64_t numImages,
|
||||||
const uint32_t nPIxelsY, const uint32_t dynamicRange);
|
const uint32_t dynamicRange);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call back for raw data
|
* Call back for raw data
|
||||||
|
|||||||
Reference in New Issue
Block a user