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

@ -192,8 +192,7 @@ bool operator!=(const std::vector<T> &lhs,
}
template <typename T, size_t Capacity>
std::ostream &operator<<(std::ostream &os,
const StaticVector<T, Capacity> &c) {
std::ostream &operator<<(std::ostream &os, const StaticVector<T, Capacity> &c) {
return os << ToString(c);
}

View File

@ -9,8 +9,8 @@
*@short functions to open/close zmq sockets
*/
#include "sls/sls_detector_exceptions.h"
#include "sls/container_utils.h"
#include "sls/sls_detector_exceptions.h"
#include <map>
#include <memory>
@ -23,7 +23,6 @@ namespace sls {
// #define ZMQ_DETAIL
#define ROIVERBOSITY
/** zmq header structure */
struct zmqHeader {
/** true if incoming data, false if end of acquisition */
@ -224,8 +223,7 @@ class ZmqSocket {
/** Socket descriptor */
mySocketDescriptors sockfd;
std::unique_ptr<char[]> header_buffer =
make_unique<char[]>(MAX_STR_LENGTH);
std::unique_ptr<char[]> header_buffer = make_unique<char[]>(MAX_STR_LENGTH);
};
} // namespace sls

View File

@ -69,8 +69,8 @@
#define MAX_STR_LENGTH 1000
#define SHORT_STR_LENGTH 20
#define MAX_PATTERN_LENGTH 0x2000
#define MAX_PATTERN_LEVELS 6
#define MAX_PATTERN_LENGTH 0x2000
#define MAX_PATTERN_LEVELS 6
#define M3_MAX_PATTERN_LEVELS 3
#define DEFAULT_STREAMING_TIMER_IN_MS 500
@ -179,8 +179,8 @@ class slsDetectorDefs {
ROI(int xmin, int xmax, int ymin, int ymax)
: xmin(xmin), xmax(xmax), ymin(ymin), ymax(ymax){};
constexpr std::array<int, 4> getIntArray() const {
return std::array<int, 4> ({xmin, xmax, ymin, ymax});
}
return std::array<int, 4>({xmin, xmax, ymin, ymax});
}
constexpr bool completeRoi() const {
return (xmin == -1 && xmax == -1 && ymin == -1 && ymax == -1);
}

View File

@ -2,13 +2,13 @@
// Copyright (C) 2021 Contributors to the SLS Detector Package
/** API versions */
#define GITBRANCH "developer"
#define APILIB 0x220609
#define APIRECEIVER 0x220609
#define APIGUI 0x220609
#define APICTB 0x220714
#define APIGOTTHARD 0x220714
#define APILIB 0x220609
#define APIRECEIVER 0x220609
#define APIGUI 0x220609
#define APICTB 0x220714
#define APIGOTTHARD 0x220714
#define APIGOTTHARD2 0x220714
#define APIJUNGFRAU 0x220714
#define APIMYTHEN3 0x220714
#define APIMOENCH 0x220714
#define APIEIGER 0x220714
#define APIJUNGFRAU 0x220714
#define APIMYTHEN3 0x220714
#define APIMOENCH 0x220714
#define APIEIGER 0x220714

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

View File

@ -333,8 +333,7 @@ TEST_CASE("streamingInterface") {
REQUIRE(ToString(defs::streamingInterface::ETHERNET_10GB) == "10gbe");
REQUIRE(ToString(defs::streamingInterface::LOW_LATENCY_LINK) == "lll");
REQUIRE(ToString(defs::streamingInterface::LOW_LATENCY_LINK |
defs::streamingInterface::ETHERNET_10GB) ==
"lll, 10gbe");
defs::streamingInterface::ETHERNET_10GB) == "lll, 10gbe");
}
// Speed level
@ -353,10 +352,8 @@ TEST_CASE("string to speedLevel") {
defs::speedLevel::HALF_SPEED);
REQUIRE(StringTo<defs::speedLevel>("quarter_speed") ==
defs::speedLevel::QUARTER_SPEED);
REQUIRE(StringTo<defs::speedLevel>("108") ==
defs::speedLevel::G2_108MHZ);
REQUIRE(StringTo<defs::speedLevel>("144") ==
defs::speedLevel::G2_144MHZ);
REQUIRE(StringTo<defs::speedLevel>("108") == defs::speedLevel::G2_108MHZ);
REQUIRE(StringTo<defs::speedLevel>("144") == defs::speedLevel::G2_144MHZ);
}
} // namespace sls

View File

@ -33,8 +33,7 @@ int open_socket(int port) {
const std::string portname = std::to_string(port);
if (getaddrinfo(host, portname.c_str(), &hints, &res)) {
throw RuntimeError("Failed at getaddrinfo with " +
std::string(host));
throw RuntimeError("Failed at getaddrinfo with " + std::string(host));
}
int fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (fd == -1) {

View File

@ -5,7 +5,6 @@
namespace sls {
TEST_CASE("Throws when cannot create socket") {
REQUIRE_THROWS(ZmqSocket("sdiasodjajpvv", 5076001));
}
@ -118,4 +117,4 @@ TEST_CASE("Send header and data") {
}
}
} //namespace
} // namespace sls