mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
Merge branch 'developer' into gotthard2
This commit is contained in:
@ -9,9 +9,9 @@
|
||||
|
||||
#include "TimeHelper.h"
|
||||
#include "TypeTraits.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "string_utils.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include <chrono>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
@ -10,15 +10,15 @@
|
||||
#include "ansi.h"
|
||||
#include "sls_detector_exceptions.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <zmq.h>
|
||||
#include <errno.h>
|
||||
#include <netdb.h> //gethostbyname()
|
||||
#include <arpa/inet.h> //inet_ntoa
|
||||
#include <errno.h>
|
||||
#include <iostream>
|
||||
#include <netdb.h> //gethostbyname()
|
||||
#include <rapidjson/document.h> //json header in zmq stream
|
||||
#include <string.h>
|
||||
#include <unistd.h> //usleep in some machines
|
||||
#include <vector>
|
||||
#include <zmq.h>
|
||||
using namespace rapidjson;
|
||||
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
|
||||
/** (used by multi and sls)
|
||||
|
@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <ansi.h>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@ inline std::string NowTime()
|
||||
strftime(buffer, buffer_len, "%X", localtime_r(&t, &r));
|
||||
buffer[buffer_len - 1] = 0;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
gettimeofday(&tv, nullptr);
|
||||
char result[100];
|
||||
const int result_len = sizeof(result);
|
||||
snprintf(result, result_len, "%s.%03ld", buffer, (long)tv.tv_usec / 1000);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <array>
|
||||
|
||||
namespace sls {
|
||||
|
||||
@ -10,10 +10,10 @@ class IpAddr {
|
||||
uint32_t addr_{0};
|
||||
|
||||
public:
|
||||
constexpr IpAddr() noexcept{}
|
||||
constexpr IpAddr(uint32_t address) noexcept : addr_{address} {}
|
||||
IpAddr(const std::string &address);
|
||||
IpAddr(const char *address);
|
||||
constexpr IpAddr() noexcept = default;
|
||||
explicit constexpr IpAddr(uint32_t address) noexcept : addr_{address} {}
|
||||
explicit IpAddr(const std::string &address);
|
||||
explicit IpAddr(const char *address);
|
||||
std::string str() const;
|
||||
std::string hex() const;
|
||||
std::array<char, 16u> arr() const;
|
||||
@ -38,8 +38,8 @@ class MacAddr {
|
||||
std::string to_hex(const char delimiter = 0) const;
|
||||
|
||||
public:
|
||||
constexpr MacAddr() noexcept{}
|
||||
constexpr MacAddr(uint64_t mac) noexcept : addr_{mac} {}
|
||||
constexpr MacAddr() noexcept = default;
|
||||
explicit constexpr MacAddr(uint64_t mac) noexcept : addr_{mac} {}
|
||||
MacAddr(std::string mac);
|
||||
MacAddr(const char *address);
|
||||
std::string str() const;
|
||||
|
@ -14,14 +14,20 @@
|
||||
#define __cplusplus
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include "ansi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
//C++ includes
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include <algorithm>
|
||||
#include <bitset>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#else
|
||||
//C includes
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include "ansi.h"
|
||||
|
||||
|
||||
#define BIT32_MASK 0xFFFFFFFF
|
||||
#define MAX_RX_DBIT 64
|
||||
@ -72,7 +78,6 @@
|
||||
#ifdef __cplusplus
|
||||
class slsDetectorDefs {
|
||||
public:
|
||||
slsDetectorDefs(){};
|
||||
#endif
|
||||
|
||||
/** Type of the detector */
|
||||
@ -146,20 +151,13 @@ class slsDetectorDefs {
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define MAX_NUM_PACKETS 512
|
||||
|
||||
typedef std::bitset<MAX_NUM_PACKETS> sls_bitset;
|
||||
|
||||
typedef struct {
|
||||
using sls_bitset = std::bitset<MAX_NUM_PACKETS>;
|
||||
using bitset_storage = uint8_t[MAX_NUM_PACKETS / 8];
|
||||
struct sls_receiver_header{
|
||||
sls_detector_header detHeader; /**< is the detector header */
|
||||
sls_bitset packetsMask; /**< is the packets caught bit mask */
|
||||
} sls_receiver_header;
|
||||
|
||||
typedef uint8_t bitset_storage[MAX_NUM_PACKETS / 8];
|
||||
|
||||
};
|
||||
#endif
|
||||
/**
|
||||
* frameDiscardPolicy
|
||||
*/
|
||||
enum frameDiscardPolicy {
|
||||
GET_FRAME_DISCARD_POLICY = -1, /**< to get the missing packet mode */
|
||||
NO_DISCARD, /**< pad incomplete packets with -1, default mode */
|
||||
@ -171,9 +169,6 @@ class slsDetectorDefs {
|
||||
NUM_DISCARD_POLICIES
|
||||
};
|
||||
|
||||
/**
|
||||
format
|
||||
*/
|
||||
enum fileFormat {
|
||||
GET_FILE_FORMAT = -1, /**< the receiver will return its file format */
|
||||
BINARY, /**< binary format */
|
||||
@ -214,8 +209,8 @@ format
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct xy {
|
||||
int x;
|
||||
int y;
|
||||
int x{0};
|
||||
int y{0};
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -466,8 +461,8 @@ struct detParameters {
|
||||
int nGappixelsX{0};
|
||||
int nGappixelsY{0};
|
||||
|
||||
detParameters() {}
|
||||
detParameters(slsDetectorDefs::detectorType type) {
|
||||
detParameters() = default;
|
||||
explicit detParameters(slsDetectorDefs::detectorType type) {
|
||||
switch (type) {
|
||||
case slsDetectorDefs::detectorType::GOTTHARD:
|
||||
nChanX = 128;
|
||||
@ -582,7 +577,7 @@ typedef struct {
|
||||
: serialnumber(0), nchan(0), nchip(0), ndac(0), reg(0), iodelay(0),
|
||||
tau(0), eV(0), dacs(nullptr), chanregs(nullptr) {}
|
||||
|
||||
sls_detector_module(slsDetectorDefs::detectorType type)
|
||||
explicit sls_detector_module(slsDetectorDefs::detectorType type)
|
||||
: sls_detector_module() {
|
||||
detParameters parameters{type};
|
||||
int nch = parameters.nChanX * parameters.nChanY;
|
||||
@ -633,5 +628,5 @@ typedef struct {
|
||||
namespace sls{
|
||||
using Positions = const std::vector<int> &;
|
||||
using defs = slsDetectorDefs;
|
||||
}
|
||||
} // namespace sls
|
||||
#endif
|
||||
|
@ -11,7 +11,7 @@ public:
|
||||
RuntimeError(): runtime_error("SLS Detector Package Failed") {
|
||||
FILE_LOG(logERROR) << "SLS Detector Package Failed";
|
||||
}
|
||||
RuntimeError(std::string msg): runtime_error(msg) {
|
||||
RuntimeError(const std::string& msg): runtime_error(msg) {
|
||||
FILE_LOG(logERROR) << msg;
|
||||
}
|
||||
RuntimeError(const char* msg): runtime_error(msg) {
|
||||
@ -21,40 +21,40 @@ public:
|
||||
|
||||
struct SharedMemoryError : public RuntimeError {
|
||||
public:
|
||||
SharedMemoryError(std::string msg):RuntimeError(msg) {}
|
||||
SharedMemoryError(const std::string& msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
struct SocketError : public RuntimeError {
|
||||
public:
|
||||
SocketError(std::string msg):RuntimeError(msg) {}
|
||||
SocketError(const std::string& msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
struct ZmqSocketError : public RuntimeError {
|
||||
public:
|
||||
ZmqSocketError(std::string msg):RuntimeError(msg) {}
|
||||
ZmqSocketError(const std::string& msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
struct NotImplementedError : public RuntimeError {
|
||||
public:
|
||||
NotImplementedError(std::string msg):RuntimeError(msg) {}
|
||||
NotImplementedError(const std::string& msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
struct DetectorError : public RuntimeError {
|
||||
public:
|
||||
DetectorError(std::string msg):RuntimeError(msg) {}
|
||||
DetectorError(const std::string& msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
struct ReceiverError : public RuntimeError {
|
||||
public:
|
||||
ReceiverError(std::string msg):RuntimeError(msg) {}
|
||||
ReceiverError(const std::string& msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
struct GuiError : public RuntimeError {
|
||||
public:
|
||||
GuiError(std::string msg):RuntimeError(msg) {}
|
||||
GuiError(const std::string& msg):RuntimeError(msg) {}
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace sls
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user