Formatted package
This commit is contained in:
Dhanya Thattil
2022-08-05 15:39:34 +02:00
committed by GitHub
parent 7173785b29
commit 6bf9dbf6d3
89 changed files with 1366 additions and 1210 deletions

View File

@ -15,7 +15,6 @@
#include <stdexcept>
#include <unistd.h>
namespace sls {
#define DEFAULT_PACKET_SIZE 1286

View File

@ -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) {

View File

@ -417,4 +417,3 @@ void ZmqSocket::mySocketDescriptors::Close() {
};
} // namespace sls

View File

@ -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";