From d94c0d0e72606e3ea4ebf91eb41720b41b3be607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Tue, 12 May 2026 12:01:09 +0200 Subject: [PATCH] removed unused function readDataFile/writeDataFile (#1456) * removed unused function readDataFile/writeDataFile * release notes --- RELEASE.md | 2 + slsSupportLib/include/sls/file_utils.h | 27 ----------- slsSupportLib/src/file_utils.cpp | 66 -------------------------- 3 files changed, 2 insertions(+), 93 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 927793b37..0f1ad4af4 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -41,6 +41,8 @@ Detector.pattern (python) accepts also a pattern object, not only a pattern file added patternstart to python (ctb, xilinx_ctb , mythen3), only the detector class api was exposed (startPattern()) +removed unused function readDataFile/writeDataFile from file_utils.h + 2 On-board Detector Server Compatibility ========================================== diff --git a/slsSupportLib/include/sls/file_utils.h b/slsSupportLib/include/sls/file_utils.h index 010fc640c..81aa3d19b 100644 --- a/slsSupportLib/include/sls/file_utils.h +++ b/slsSupportLib/include/sls/file_utils.h @@ -11,37 +11,10 @@ namespace sls { -/** - * @param data array of data values - * @param nch number of channels - * @param offset start channel value - */ -int readDataFile(std::ifstream &infile, short int *data, int nch, - int offset = 0); - -/** - * @param data array of data value - * @param nch number of channels - */ -int readDataFile(std::string fname, short int *data, int nch); std::vector readBinaryFile(const std::string &fname, const std::string &errorPrefix); -/** - * @param nch number of channels - * @param data array of data values - * @param offset start channel number - */ -int writeDataFile(std::ofstream &outfile, int nch, short int *data, - int offset = 0); - -/** - * @param nch number of channels - * @param data array of data values - */ -int writeDataFile(std::string fname, int nch, short int *data); - // mkdir -p path implemented by recursive calls void mkdir_p(const std::string &path, std::string dir = ""); diff --git a/slsSupportLib/src/file_utils.cpp b/slsSupportLib/src/file_utils.cpp index 6751d489d..bc375ba9d 100644 --- a/slsSupportLib/src/file_utils.cpp +++ b/slsSupportLib/src/file_utils.cpp @@ -22,48 +22,6 @@ namespace sls { -int readDataFile(std::ifstream &infile, short int *data, int nch, int offset) { - int ichan, iline = 0; - short int idata; - int interrupt = 0; - std::string str; - while (infile.good() and interrupt == 0) { - getline(infile, str); - std::istringstream ssstr(str); - ssstr >> ichan >> idata; - if (ssstr.fail() || ssstr.bad()) { - interrupt = 1; - break; - } - if (iline < nch) { - if (ichan >= offset) { - data[iline] = idata; - iline++; - } - } else { - interrupt = 1; - break; - } - return iline; - }; - return iline; -} - -int readDataFile(std::string fname, short int *data, int nch) { - std::ifstream infile; - int iline = 0; - std::string str; - infile.open(fname.c_str(), std::ios_base::in); - if (infile.is_open()) { - iline = readDataFile(infile, data, nch, 0); - infile.close(); - } else { - LOG(logERROR) << "Could not read file " << fname; - return -1; - } - return iline; -} - std::vector readBinaryFile(const std::string &fname, const std::string &errorPrefix) { // check if it exists @@ -96,30 +54,6 @@ std::vector readBinaryFile(const std::string &fname, return buffer; } -int writeDataFile(std::ofstream &outfile, int nch, short int *data, - int offset) { - if (data == nullptr) - return slsDetectorDefs::FAIL; - for (int ichan = 0; ichan < nch; ichan++) - outfile << ichan + offset << " " << *(data + ichan) << std::endl; - return slsDetectorDefs::OK; -} - -int writeDataFile(std::string fname, int nch, short int *data) { - std::ofstream outfile; - if (data == nullptr) - return slsDetectorDefs::FAIL; - outfile.open(fname.c_str(), std::ios_base::out); - if (outfile.is_open()) { - writeDataFile(outfile, nch, data, 0); - outfile.close(); - return slsDetectorDefs::OK; - } else { - LOG(logERROR) << "Could not open file " << fname << "for writing"; - return slsDetectorDefs::FAIL; - } -} - void mkdir_p(const std::string &path, std::string dir) { if (path.length() == 0) return;