mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
added getPatternLoop
This commit is contained in:
@ -109,6 +109,19 @@ minusOneIfDifferent(const std::vector<std::vector<T>> &container) {
|
||||
return std::vector<T>{-1};
|
||||
}
|
||||
|
||||
template <typename T, size_t size>
|
||||
std::array<T, size>
|
||||
minusOneIfDifferent(const std::vector<std::array<T,size>> &container) {
|
||||
if (allEqual(container))
|
||||
return container.front();
|
||||
|
||||
std::array<T,size> arr;
|
||||
arr.fill(static_cast<T>(-1));
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace sls
|
||||
|
||||
#endif // CONTAINER_UTILS_H
|
||||
|
@ -1040,7 +1040,6 @@ typedef struct {
|
||||
int *chanregs; /**< is the pointer to the array of the channel registers */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
sls_detector_module()
|
||||
: serialnumber(0), nchan(0), nchip(0), ndac(0), reg(0), iodelay(0),
|
||||
tau(0), eV(0), dacs(nullptr), chanregs(nullptr) {}
|
||||
@ -1049,8 +1048,6 @@ typedef struct {
|
||||
detParameters parameters{type};
|
||||
int nch = parameters.nChanX * parameters.nChanY;
|
||||
int nc = parameters.nChipX * parameters.nChipY;
|
||||
// int nd = parameters.nDacs;
|
||||
|
||||
ndac = parameters.nDacs;
|
||||
nchip = nc;
|
||||
nchan = nch * nc;
|
||||
|
@ -122,4 +122,16 @@ TEST_CASE("vector of bool", "[support]"){
|
||||
CHECK(minusOneIfDifferent(a) == 1);
|
||||
CHECK(minusOneIfDifferent(b) == 0);
|
||||
CHECK(minusOneIfDifferent(c) == -1);
|
||||
}
|
||||
|
||||
TEST_CASE("compare a vector of arrays", "[support]"){
|
||||
|
||||
std::vector<std::array<uint64_t, 3>> vec0{{5,6,8},{5,6,8},{5,6,8}};
|
||||
CHECK(minusOneIfDifferent(vec0) == std::array<uint64_t, 3>{5,6,8});
|
||||
|
||||
std::array<uint64_t, 3> arr;
|
||||
arr.fill(-1);
|
||||
std::vector<std::array<uint64_t, 3>> vec1{{5,90,8},{5,6,8},{5,6,8}};
|
||||
CHECK(minusOneIfDifferent(vec1) == arr);
|
||||
|
||||
}
|
Reference in New Issue
Block a user