mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 10:30:41 +02:00
WIP
This commit is contained in:
parent
903ebb2679
commit
f87e8d3c19
@ -88,7 +88,8 @@ int BinaryFile::WriteData(char* buf, int bsize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BinaryFile::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t nump) {
|
void BinaryFile::WriteToFile(char* buffer, int buffersize, uint64_t currentFrameNumber,
|
||||||
|
uint32_t numPacketsCaught) {
|
||||||
// check if maxframesperfile = 0 for infinite
|
// check if maxframesperfile = 0 for infinite
|
||||||
if ((*maxFramesPerFile) && (numFramesInFile >= (*maxFramesPerFile))) {
|
if ((*maxFramesPerFile) && (numFramesInFile >= (*maxFramesPerFile))) {
|
||||||
CloseCurrentFile();
|
CloseCurrentFile();
|
||||||
@ -96,7 +97,7 @@ void BinaryFile::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32
|
|||||||
CreateFile();
|
CreateFile();
|
||||||
}
|
}
|
||||||
numFramesInFile++;
|
numFramesInFile++;
|
||||||
numActualPacketsInFile += nump;
|
numActualPacketsInFile += numPacketsCaught;
|
||||||
|
|
||||||
// write to file
|
// write to file
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -127,17 +128,18 @@ void BinaryFile::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32
|
|||||||
|
|
||||||
// if write error
|
// if write error
|
||||||
if (ret != buffersize) {
|
if (ret != buffersize) {
|
||||||
throw sls::RuntimeError(std::to_string(index) + " : Write to file failed for image number " + std::to_string(fnum));
|
throw sls::RuntimeError(std::to_string(index) + " : Write to file failed for image number " +
|
||||||
|
std::to_string(currentFrameNumber));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BinaryFile::CreateMasterFile(bool mfwenable, masterAttributes& attr) {
|
void BinaryFile::CreateMasterFile(bool masterFileWriteEnable, masterAttributes& masterFileAttributes) {
|
||||||
//beginning of every acquisition
|
//beginning of every acquisition
|
||||||
numFramesInFile = 0;
|
numFramesInFile = 0;
|
||||||
numActualPacketsInFile = 0;
|
numActualPacketsInFile = 0;
|
||||||
|
|
||||||
if (mfwenable && master) {
|
if (masterFileWriteEnable && master) {
|
||||||
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << *filePath << "/" << *fileNamePrefix << "_master"
|
os << *filePath << "/" << *fileNamePrefix << "_master"
|
||||||
@ -146,7 +148,7 @@ void BinaryFile::CreateMasterFile(bool mfwenable, masterAttributes& attr) {
|
|||||||
if(!(*silentMode)) {
|
if(!(*silentMode)) {
|
||||||
LOG(logINFO) << "Master File: " << masterFileName;
|
LOG(logINFO) << "Master File: " << masterFileName;
|
||||||
}
|
}
|
||||||
attr.version = BINARY_WRITER_VERSION;
|
masterFileAttributes.version = BINARY_WRITER_VERSION;
|
||||||
|
|
||||||
// create master file
|
// create master file
|
||||||
if (!(*overWriteEnable)){
|
if (!(*overWriteEnable)){
|
||||||
@ -202,27 +204,27 @@ void BinaryFile::CreateMasterFile(bool mfwenable, masterAttributes& attr) {
|
|||||||
"Header Version : 1 byte\n"
|
"Header Version : 1 byte\n"
|
||||||
"Packets Caught Mask : 64 bytes\n"
|
"Packets Caught Mask : 64 bytes\n"
|
||||||
,
|
,
|
||||||
attr.version,
|
masterFileAttributes.version,
|
||||||
attr.detectorType,
|
masterFileAttributes.detectorType,
|
||||||
attr.dynamicRange,
|
masterFileAttributes.dynamicRange,
|
||||||
attr.tenGiga,
|
masterFileAttributes.tenGiga,
|
||||||
attr.imageSize,
|
masterFileAttributes.imageSize,
|
||||||
attr.nPixelsX,
|
masterFileAttributes.nPixelsX,
|
||||||
attr.nPixelsY,
|
masterFileAttributes.nPixelsY,
|
||||||
attr.maxFramesPerFile,
|
masterFileAttributes.maxFramesPerFile,
|
||||||
(long long int)attr.totalFrames,
|
(long long int)masterFileAttributes.totalFrames,
|
||||||
(long long int)attr.exptimeNs,
|
(long long int)masterFileAttributes.exptimeNs,
|
||||||
(long long int)attr.subExptimeNs,
|
(long long int)masterFileAttributes.subExptimeNs,
|
||||||
(long long int)attr.subPeriodNs,
|
(long long int)masterFileAttributes.subPeriodNs,
|
||||||
(long long int)attr.periodNs,
|
(long long int)masterFileAttributes.periodNs,
|
||||||
attr.quadEnable,
|
masterFileAttributes.quadEnable,
|
||||||
attr.analogFlag,
|
masterFileAttributes.analogFlag,
|
||||||
attr.digitalFlag,
|
masterFileAttributes.digitalFlag,
|
||||||
attr.adcmask,
|
masterFileAttributes.adcmask,
|
||||||
attr.dbitoffset,
|
masterFileAttributes.dbitoffset,
|
||||||
(long long int)attr.dbitlist,
|
(long long int)masterFileAttributes.dbitlist,
|
||||||
attr.roiXmin,
|
masterFileAttributes.roiXmin,
|
||||||
attr.roiXmax,
|
masterFileAttributes.roiXmax,
|
||||||
ctime(&t));
|
ctime(&t));
|
||||||
if (strlen(message) > maxMasterFileSize) {
|
if (strlen(message) > maxMasterFileSize) {
|
||||||
throw sls::RuntimeError("Master File Size " + std::to_string(strlen(message)) +
|
throw sls::RuntimeError("Master File Size " + std::to_string(strlen(message)) +
|
||||||
|
@ -41,22 +41,19 @@ class BinaryFile : private virtual slsDetectorDefs, public File {
|
|||||||
|
|
||||||
void PrintMembers(TLogLevel level = logDEBUG1) override;
|
void PrintMembers(TLogLevel level = logDEBUG1) override;
|
||||||
void CreateFile() override;
|
void CreateFile() override;
|
||||||
/**
|
void CreateMasterFile(bool masterFileWriteEnable,
|
||||||
* Create master file
|
masterAttributes& masterFileAttributes) override;
|
||||||
* @param mfwenable master file write enable
|
|
||||||
* @param attr master file attributes
|
|
||||||
*/
|
|
||||||
void CreateMasterFile(bool mfwenable, masterAttributes& attr) override;
|
|
||||||
void CloseCurrentFile() override;
|
void CloseCurrentFile() override;
|
||||||
void CloseAllFiles() override;
|
void CloseAllFiles() override;
|
||||||
/**
|
/**
|
||||||
* Write data to file
|
* Write data to file
|
||||||
* @param buffer buffer to write from
|
* @param buffer buffer to write from
|
||||||
* @param buffersize size of buffer
|
* @param buffersize size of buffer
|
||||||
* @param fnum current image number
|
* @param currentFrameNumber current image number
|
||||||
* @param nump number of packets caught
|
* @param numPacketsCaught number of packets caught
|
||||||
*/
|
*/
|
||||||
void WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t nump) override;
|
void WriteToFile(char* buffer, int buffersize, uint64_t currentFrameNumber,
|
||||||
|
uint32_t numPacketsCaught) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user