mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 11:20:04 +02:00
static_assert enum size
This commit is contained in:
parent
b51290d0fe
commit
132043a70d
@ -141,8 +141,7 @@ void Module::updateNumberOfDetector(slsDetectorDefs::xy det) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
slsDetectorDefs::detectorSettings Module::getSettings() const {
|
slsDetectorDefs::detectorSettings Module::getSettings() const {
|
||||||
auto r = sendToDetector<int>(F_SET_SETTINGS, GET_FLAG);
|
return sendToDetector<detectorSettings>(F_SET_SETTINGS, GET_FLAG);
|
||||||
return static_cast<detectorSettings>(r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setSettings(detectorSettings isettings) {
|
void Module::setSettings(detectorSettings isettings) {
|
||||||
@ -150,7 +149,7 @@ void Module::setSettings(detectorSettings isettings) {
|
|||||||
throw RuntimeError(
|
throw RuntimeError(
|
||||||
"Cannot set settings for Eiger. Use threshold energy.");
|
"Cannot set settings for Eiger. Use threshold energy.");
|
||||||
}
|
}
|
||||||
sendToDetector<int>(F_SET_SETTINGS, static_cast<int>(isettings));
|
sendToDetector<int>(F_SET_SETTINGS, isettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::loadSettingsFile(const std::string &fname) {
|
void Module::loadSettingsFile(const std::string &fname) {
|
||||||
@ -293,7 +292,7 @@ slsDetectorDefs::timingMode Module::getTimingMode() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Module::setTimingMode(timingMode value) {
|
void Module::setTimingMode(timingMode value) {
|
||||||
sendToDetector<int>(F_SET_TIMING_MODE, static_cast<int>(value));
|
sendToDetector<int>(F_SET_TIMING_MODE, value);
|
||||||
if (shm()->useReceiverFlag) {
|
if (shm()->useReceiverFlag) {
|
||||||
sendToReceiver(F_SET_RECEIVER_TIMING_MODE, value, nullptr);
|
sendToReceiver(F_SET_RECEIVER_TIMING_MODE, value, nullptr);
|
||||||
}
|
}
|
||||||
@ -358,7 +357,7 @@ void Module::setImageTestMode(const int value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Module::getADC(dacIndex index) const {
|
int Module::getADC(dacIndex index) const {
|
||||||
return sendToDetectorStop<int>(F_GET_ADC, static_cast<int>(index));
|
return sendToDetectorStop<int>(F_GET_ADC, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getOnChipDAC(slsDetectorDefs::dacIndex index, int chipIndex) const {
|
int Module::getOnChipDAC(slsDetectorDefs::dacIndex index, int chipIndex) const {
|
||||||
@ -873,14 +872,12 @@ std::array<pid_t, NUM_RX_THREAD_IDS> Module::getReceiverThreadIds() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// File
|
// File
|
||||||
|
|
||||||
slsDetectorDefs::fileFormat Module::getFileFormat() const {
|
slsDetectorDefs::fileFormat Module::getFileFormat() const {
|
||||||
return static_cast<fileFormat>(
|
return sendToReceiver<fileFormat>(F_GET_RECEIVER_FILE_FORMAT);
|
||||||
sendToReceiver<int>(F_GET_RECEIVER_FILE_FORMAT));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setFileFormat(fileFormat f) {
|
void Module::setFileFormat(fileFormat f) {
|
||||||
sendToReceiver(F_SET_RECEIVER_FILE_FORMAT, static_cast<int>(f), nullptr);
|
sendToReceiver(F_SET_RECEIVER_FILE_FORMAT, f, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Module::getFilePath() const {
|
std::string Module::getFilePath() const {
|
||||||
|
@ -135,6 +135,8 @@ class slsDetectorDefs {
|
|||||||
} sls_detector_header;
|
} sls_detector_header;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
//For sending and receiving data
|
||||||
|
static_assert(sizeof(detectorType) == sizeof(int), "enum and int differ in size");
|
||||||
#define MAX_NUM_PACKETS 512
|
#define MAX_NUM_PACKETS 512
|
||||||
using sls_bitset = std::bitset<MAX_NUM_PACKETS>;
|
using sls_bitset = std::bitset<MAX_NUM_PACKETS>;
|
||||||
using bitset_storage = uint8_t[MAX_NUM_PACKETS / 8];
|
using bitset_storage = uint8_t[MAX_NUM_PACKETS / 8];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user