mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-07-05 21:21:22 +02:00
Build on RHEL9 docker image / build (push) Successful in 4m1s
Build on RHEL8 docker image / build (push) Successful in 5m1s
Build and Deploy on local RHEL9 / build (push) Successful in 2m1s
Build and Deploy on local RHEL8 / build (push) Successful in 5m7s
Run Simulator Tests on local RHEL9 / build (push) Successful in 18m37s
Run Simulator Tests on local RHEL8 / build (push) Successful in 22m10s
* refactoring * wip * refactored, yet to take out checkers * checker added * wip acquire ctb state * wip acquire ctb state * wip, acq test * acquire moved out * fix * wip, To fix masterattribtues * wip, masterfilecheks * wip, at ctbexpectedstate * wip, fixing acquire * wip, acquire done * wip * compiles * refactoring * minor * minor * reduced unnecessary includes * fix in tests * removed ctb state check * ctb fix with ctb state * fixed ctb guard tests * minor debug * work for xilinx ctb --------- Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
|
|
#pragma once
|
|
|
|
#include "sls/Detector.h"
|
|
#include "sls/logger.h"
|
|
|
|
namespace sls::test::acquire {
|
|
|
|
class FileState;
|
|
|
|
// at the moment, only number of frames
|
|
struct AcquisitionState {
|
|
int64_t num_frames;
|
|
};
|
|
|
|
inline AcquisitionState default_acquisition_state() { return {1}; }
|
|
|
|
inline AcquisitionState get_acquisition_state(const Detector &det) {
|
|
return AcquisitionState{
|
|
det.getNumberOfFrames().tsquash("Inconsistent number of frames")};
|
|
}
|
|
|
|
inline void set_acquisition_state(Detector &det, const AcquisitionState &s) {
|
|
det.setNumberOfFrames(s.num_frames);
|
|
}
|
|
|
|
inline std::ostream &operator<<(std::ostream &os, const AcquisitionState &s) {
|
|
os << "Acquisition State:"
|
|
<< "\n Number of Frames: " << s.num_frames;
|
|
return os;
|
|
}
|
|
|
|
/**
|
|
* @brief RAII guard for restoring the acquisition state of a detector.
|
|
* The constructor saves the current acquisition state and sets a new state,
|
|
* while the destructor restores the original state.
|
|
*
|
|
*/
|
|
class AcquisitionStateGuard {
|
|
public:
|
|
explicit AcquisitionStateGuard(Detector &det,
|
|
const AcquisitionState &new_state)
|
|
: det(det), saved_(get_acquisition_state(det)) {
|
|
set_acquisition_state(det, new_state);
|
|
}
|
|
~AcquisitionStateGuard() { set_acquisition_state(det, saved_); }
|
|
|
|
private:
|
|
Detector &det;
|
|
AcquisitionState saved_;
|
|
};
|
|
|
|
void wait_until_idle(const Detector &det);
|
|
void run_acquisition(Detector &det);
|
|
void run(Detector &det, const AcquisitionState &acq_state,
|
|
const FileState &file_state);
|
|
|
|
} // namespace sls::test::acquire
|