mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 07:38:04 +01:00
clang format
This commit is contained in:
@@ -53,7 +53,7 @@ class DataSocket {
|
||||
int Send(const std::string &s);
|
||||
|
||||
// Variadic template to send all arguments
|
||||
template <class... Args> int SendAll(Args &&... args) {
|
||||
template <class... Args> int SendAll(Args &&...args) {
|
||||
auto l = std::initializer_list<int>{Send(args)...};
|
||||
auto sum = std::accumulate(begin(l), end(l), 0);
|
||||
return sum;
|
||||
@@ -86,7 +86,7 @@ class DataSocket {
|
||||
|
||||
private:
|
||||
int sockfd_ = -1;
|
||||
int fnum_ {0};
|
||||
int fnum_{0};
|
||||
};
|
||||
|
||||
}; // namespace sls
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace sls {
|
||||
// already available as std::make_unique in C++14
|
||||
template <typename T, typename... Args>
|
||||
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
|
||||
make_unique(Args &&... args) {
|
||||
make_unique(Args &&...args) {
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,36 +13,34 @@
|
||||
* Removed most of the code that is not relevant for our scope.
|
||||
* Snippets copied from md5_local.h or md32_common.h has been marked
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HEADER_MD5_H
|
||||
# define HEADER_MD5_H
|
||||
#define HEADER_MD5_H
|
||||
|
||||
# include <stddef.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
/*
|
||||
* Modifications 2021 Paul Scherrer Institut
|
||||
* namespace sls added
|
||||
*/
|
||||
namespace sls {
|
||||
extern "C" {
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* ! MD5_LONG has to be at least 32 bits wide. !
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*/
|
||||
# define MD5_LONG unsigned int
|
||||
# define MD5_CBLOCK 64
|
||||
# define MD5_LBLOCK (MD5_CBLOCK/4)
|
||||
# define MD5_DIGEST_LENGTH 16
|
||||
#define MD5_LONG unsigned int
|
||||
#define MD5_CBLOCK 64
|
||||
#define MD5_LBLOCK (MD5_CBLOCK / 4)
|
||||
#define MD5_DIGEST_LENGTH 16
|
||||
|
||||
/**
|
||||
* Modification 2021 Paul Scherrer Institut
|
||||
* Comment from md32_common.h
|
||||
/**
|
||||
* Modification 2021 Paul Scherrer Institut
|
||||
* Comment from md32_common.h
|
||||
*/
|
||||
/*-
|
||||
* This is a generic 32 bit "collector" for message digest algorithms.
|
||||
@@ -99,65 +97,68 @@ extern "C" {
|
||||
* #define HASH_FINAL MD5_Final_SLS
|
||||
* #define HASH_BLOCK_DATA_ORDER md5_block_data_order
|
||||
*/
|
||||
# define MD32_REG_T int
|
||||
#define MD32_REG_T int
|
||||
|
||||
/**
|
||||
* Modification 2021 Paul Scherrer Institut
|
||||
* Made default little endian if big endian not defined
|
||||
/**
|
||||
* Modification 2021 Paul Scherrer Institut
|
||||
* Made default little endian if big endian not defined
|
||||
*/
|
||||
#ifndef DATA_ORDER_IS_BIG_ENDIAN
|
||||
#define DATA_ORDER_IS_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Modification 2021 Paul Scherrer Institut
|
||||
/**
|
||||
* Modification 2021 Paul Scherrer Institut
|
||||
* Macros exported from md32_common.h
|
||||
*/
|
||||
#define HASH_LONG MD5_LONG
|
||||
#define HASH_CTX MD5_CTX
|
||||
#define HASH_CBLOCK MD5_CBLOCK
|
||||
#define HASH_UPDATE MD5_Update_SLS
|
||||
#define HASH_TRANSFORM MD5_Transform
|
||||
#define HASH_FINAL MD5_Final_SLS
|
||||
#define HASH_BLOCK_DATA_ORDER md5_block_data_order
|
||||
#define HASH_MAKE_STRING(c,s) do { \
|
||||
unsigned long ll; \
|
||||
ll=(c)->A; (void)HOST_l2c(ll,(s)); \
|
||||
ll=(c)->B; (void)HOST_l2c(ll,(s)); \
|
||||
ll=(c)->C; (void)HOST_l2c(ll,(s)); \
|
||||
ll=(c)->D; (void)HOST_l2c(ll,(s)); \
|
||||
} while (0)
|
||||
#define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n))))
|
||||
#define HASH_LONG MD5_LONG
|
||||
#define HASH_CTX MD5_CTX
|
||||
#define HASH_CBLOCK MD5_CBLOCK
|
||||
#define HASH_UPDATE MD5_Update_SLS
|
||||
#define HASH_TRANSFORM MD5_Transform
|
||||
#define HASH_FINAL MD5_Final_SLS
|
||||
#define HASH_BLOCK_DATA_ORDER md5_block_data_order
|
||||
#define HASH_MAKE_STRING(c, s) \
|
||||
do { \
|
||||
unsigned long ll; \
|
||||
ll = (c)->A; \
|
||||
(void)HOST_l2c(ll, (s)); \
|
||||
ll = (c)->B; \
|
||||
(void)HOST_l2c(ll, (s)); \
|
||||
ll = (c)->C; \
|
||||
(void)HOST_l2c(ll, (s)); \
|
||||
ll = (c)->D; \
|
||||
(void)HOST_l2c(ll, (s)); \
|
||||
} while (0)
|
||||
#define ROTATE(a, n) (((a) << (n)) | (((a)&0xffffffff) >> (32 - (n))))
|
||||
#if defined(DATA_ORDER_IS_BIG_ENDIAN)
|
||||
|
||||
# define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++)))<<24), \
|
||||
l|=(((unsigned long)(*((c)++)))<<16), \
|
||||
l|=(((unsigned long)(*((c)++)))<< 8), \
|
||||
l|=(((unsigned long)(*((c)++))) ) )
|
||||
# define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>16)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l) )&0xff), \
|
||||
l)
|
||||
#define HOST_c2l(c, l) \
|
||||
(l = (((unsigned long)(*((c)++))) << 24), \
|
||||
l |= (((unsigned long)(*((c)++))) << 16), \
|
||||
l |= (((unsigned long)(*((c)++))) << 8), \
|
||||
l |= (((unsigned long)(*((c)++)))))
|
||||
#define HOST_l2c(l, c) \
|
||||
(*((c)++) = (unsigned char)(((l) >> 24) & 0xff), \
|
||||
*((c)++) = (unsigned char)(((l) >> 16) & 0xff), \
|
||||
*((c)++) = (unsigned char)(((l) >> 8) & 0xff), \
|
||||
*((c)++) = (unsigned char)(((l)) & 0xff), l)
|
||||
|
||||
#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
|
||||
|
||||
# define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \
|
||||
l|=(((unsigned long)(*((c)++)))<< 8), \
|
||||
l|=(((unsigned long)(*((c)++)))<<16), \
|
||||
l|=(((unsigned long)(*((c)++)))<<24) )
|
||||
# define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>16)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>24)&0xff), \
|
||||
l)
|
||||
#define HOST_c2l(c, l) \
|
||||
(l = (((unsigned long)(*((c)++)))), \
|
||||
l |= (((unsigned long)(*((c)++))) << 8), \
|
||||
l |= (((unsigned long)(*((c)++))) << 16), \
|
||||
l |= (((unsigned long)(*((c)++))) << 24))
|
||||
#define HOST_l2c(l, c) \
|
||||
(*((c)++) = (unsigned char)(((l)) & 0xff), \
|
||||
*((c)++) = (unsigned char)(((l) >> 8) & 0xff), \
|
||||
*((c)++) = (unsigned char)(((l) >> 16) & 0xff), \
|
||||
*((c)++) = (unsigned char)(((l) >> 24) & 0xff), l)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct MD5state_st {
|
||||
MD5_LONG A, B, C, D;
|
||||
MD5_LONG Nl, Nh;
|
||||
@@ -169,15 +170,14 @@ int MD5_Init_SLS(MD5_CTX *c);
|
||||
int MD5_Update_SLS(MD5_CTX *c, const void *data, size_t len);
|
||||
int MD5_Final_SLS(unsigned char *md, MD5_CTX *c);
|
||||
|
||||
/**
|
||||
* Modification 2021 Paul Scherrer Institut
|
||||
* from md32_common.h
|
||||
/**
|
||||
* Modification 2021 Paul Scherrer Institut
|
||||
* from md32_common.h
|
||||
*/
|
||||
void md5_block_data_order(MD5_CTX *c, const void *p, size_t num);
|
||||
# ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
} // namespace sls
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -73,7 +73,7 @@ struct UdpDestination {
|
||||
|
||||
constexpr bool operator==(const UdpDestination &other) const {
|
||||
return ((entry == other.entry) && (port == other.port) &&
|
||||
(port2 == other.port2) && (ip== other.ip) &&
|
||||
(port2 == other.port2) && (ip == other.ip) &&
|
||||
(ip2 == other.ip2) && (mac == other.mac) &&
|
||||
(mac2 == other.mac2));
|
||||
}
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
#define MAX_RX_DBIT 64
|
||||
|
||||
/** default ports */
|
||||
#define DEFAULT_PORTNO 1952
|
||||
#define DEFAULT_UDP_PORTNO 50001
|
||||
#define DEFAULT_ZMQ_CL_PORTNO 30001
|
||||
#define DEFAULT_ZMQ_RX_PORTNO 30001
|
||||
#define DEFAULT_PORTNO 1952
|
||||
#define DEFAULT_UDP_PORTNO 50001
|
||||
#define DEFAULT_ZMQ_CL_PORTNO 30001
|
||||
#define DEFAULT_ZMQ_RX_PORTNO 30001
|
||||
#define DEFAULT_UDP_SRC_PORTNO 32410
|
||||
#define DEFAULT_UDP_DST_PORTNO 50001
|
||||
|
||||
@@ -379,7 +379,13 @@ typedef struct {
|
||||
enum readoutMode { ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL };
|
||||
|
||||
/** chip speed */
|
||||
enum speedLevel { FULL_SPEED, HALF_SPEED, QUARTER_SPEED, G2_108MHZ, G2_144MHZ };
|
||||
enum speedLevel {
|
||||
FULL_SPEED,
|
||||
HALF_SPEED,
|
||||
QUARTER_SPEED,
|
||||
G2_108MHZ,
|
||||
G2_144MHZ
|
||||
};
|
||||
|
||||
/**
|
||||
* burst mode for gotthard2
|
||||
@@ -412,7 +418,7 @@ typedef struct {
|
||||
#ifdef __cplusplus
|
||||
enum class streamingInterface {
|
||||
#else
|
||||
enum streamingInterface {
|
||||
enum streamingInterface {
|
||||
#endif
|
||||
NONE = 0,
|
||||
LOW_LATENCY_LINK = 1 << 0,
|
||||
@@ -470,8 +476,7 @@ typedef struct {
|
||||
uint64_t select;
|
||||
|
||||
/** [Gotthard2][Jungfrau] disable */
|
||||
currentSrcParameters()
|
||||
: enable(0), fix(-1), normal(-1), select(0) {}
|
||||
currentSrcParameters() : enable(0), fix(-1), normal(-1), select(0) {}
|
||||
|
||||
/** [Gotthard2] enable or disable */
|
||||
explicit currentSrcParameters(bool srcEnable)
|
||||
@@ -487,7 +492,8 @@ typedef struct {
|
||||
/** [Jungfrau](chipv1.1) enable current src, fix[fix|no fix],
|
||||
* select is a mask of 63 bits (muliple columns can be selected
|
||||
* simultaneously, normal [normal|low] */
|
||||
currentSrcParameters(bool fixCurrent, uint64_t selectCurrent, bool normalCurrent)
|
||||
currentSrcParameters(bool fixCurrent, uint64_t selectCurrent,
|
||||
bool normalCurrent)
|
||||
: enable(1), fix(static_cast<int>(fixCurrent)),
|
||||
normal(static_cast<int>(normalCurrent)), select(selectCurrent) {}
|
||||
|
||||
@@ -562,14 +568,14 @@ inline slsDetectorDefs::streamingInterface
|
||||
operator|(const slsDetectorDefs::streamingInterface &a,
|
||||
const slsDetectorDefs::streamingInterface &b) {
|
||||
return slsDetectorDefs::streamingInterface(static_cast<int32_t>(a) |
|
||||
static_cast<int32_t>(b));
|
||||
static_cast<int32_t>(b));
|
||||
};
|
||||
|
||||
inline slsDetectorDefs::streamingInterface
|
||||
operator&(const slsDetectorDefs::streamingInterface &a,
|
||||
const slsDetectorDefs::streamingInterface &b) {
|
||||
return slsDetectorDefs::streamingInterface(static_cast<int32_t>(a) &
|
||||
static_cast<int32_t>(b));
|
||||
static_cast<int32_t>(b));
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -647,7 +653,7 @@ struct detParameters {
|
||||
#ifdef __cplusplus
|
||||
struct sls_detector_module {
|
||||
#else
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
#endif
|
||||
int serialnumber; /**< is the module serial number */
|
||||
int nchan; /**< is the number of channels on the module*/
|
||||
@@ -718,4 +724,3 @@ using Positions = const std::vector<int> &;
|
||||
using defs = slsDetectorDefs;
|
||||
} // namespace sls
|
||||
#endif
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ std::string RemoveUnit(std::string &str);
|
||||
|
||||
bool is_int(const std::string &s);
|
||||
|
||||
bool replace_first(std::string *s, const std::string& substr, const std::string& repl);
|
||||
bool replace_first(std::string *s, const std::string &substr,
|
||||
const std::string &repl);
|
||||
|
||||
} // namespace sls
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
/** API versions */
|
||||
#define GITBRANCH "6.0.0-rc1"
|
||||
#define GITBRANCH "6.0.0-rc1"
|
||||
|
||||
#define APILIB 0x211008
|
||||
#define APIRECEIVER 0x211007
|
||||
#define APIGUI 0x210819
|
||||
#define APICTB 0x211019
|
||||
#define APIGOTTHARD 0x211019
|
||||
#define APILIB 0x211008
|
||||
#define APIRECEIVER 0x211007
|
||||
#define APIGUI 0x210819
|
||||
#define APICTB 0x211019
|
||||
#define APIGOTTHARD 0x211019
|
||||
#define APIGOTTHARD2 0x211019
|
||||
#define APIMYTHEN3 0x211019
|
||||
#define APIMOENCH 0x211019
|
||||
#define APIEIGER 0x211019
|
||||
#define APIJUNGFRAU 0x211019
|
||||
#define APIMYTHEN3 0x211019
|
||||
#define APIMOENCH 0x211019
|
||||
#define APIEIGER 0x211019
|
||||
#define APIJUNGFRAU 0x211019
|
||||
|
||||
Reference in New Issue
Block a user