mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 08:17:13 +02:00
@ -15,7 +15,6 @@
|
||||
#include <stdexcept>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
namespace sls {
|
||||
|
||||
#define DEFAULT_PACKET_SIZE 1286
|
||||
|
@ -123,8 +123,7 @@ std::ostream &operator<<(std::ostream &os,
|
||||
std::string ToString(const slsDetectorDefs::currentSrcParameters &r) {
|
||||
std::ostringstream oss;
|
||||
if (r.fix < -1 || r.fix > 1 || r.normal < -1 || r.normal > 1) {
|
||||
throw RuntimeError(
|
||||
"Invalid current source parameters. Cannot print.");
|
||||
throw RuntimeError("Invalid current source parameters. Cannot print.");
|
||||
}
|
||||
oss << '[';
|
||||
if (r.enable) {
|
||||
|
@ -417,4 +417,3 @@ void ZmqSocket::mySocketDescriptors::Close() {
|
||||
};
|
||||
|
||||
} // namespace sls
|
||||
|
||||
|
@ -60,15 +60,14 @@ std::vector<char> readBinaryFile(const std::string &fname,
|
||||
// check if it exists
|
||||
struct stat st;
|
||||
if (stat(fname.c_str(), &st) != 0) {
|
||||
throw RuntimeError(errorPrefix +
|
||||
std::string(" (file does not exist)"));
|
||||
throw RuntimeError(errorPrefix + std::string(" (file does not exist)"));
|
||||
}
|
||||
|
||||
FILE *fp = fopen(fname.c_str(), "rb");
|
||||
if (fp == nullptr) {
|
||||
throw RuntimeError(errorPrefix +
|
||||
std::string(" (Could not open file: ") + fname +
|
||||
std::string(")"));
|
||||
std::string(" (Could not open file: ") + fname +
|
||||
std::string(")"));
|
||||
}
|
||||
|
||||
// get file size to print progress
|
||||
@ -76,13 +75,12 @@ std::vector<char> readBinaryFile(const std::string &fname,
|
||||
|
||||
std::vector<char> buffer(filesize, 0);
|
||||
if ((ssize_t)fread(buffer.data(), sizeof(char), filesize, fp) != filesize) {
|
||||
throw RuntimeError(errorPrefix +
|
||||
std::string(" (Could not read file)"));
|
||||
throw RuntimeError(errorPrefix + std::string(" (Could not read file)"));
|
||||
}
|
||||
|
||||
if (fclose(fp) != 0) {
|
||||
throw RuntimeError(errorPrefix +
|
||||
std::string(" (Could not close file)"));
|
||||
std::string(" (Could not close file)"));
|
||||
}
|
||||
|
||||
LOG(logDEBUG1) << "Read file into memory";
|
||||
|
Reference in New Issue
Block a user