bitwise operators for gain caps

This commit is contained in:
Erik Frojdh 2022-02-02 18:35:44 +01:00
parent 6793f5e530
commit 6c662b1370
3 changed files with 22 additions and 4 deletions

View File

@ -13,8 +13,8 @@ import subprocess
from parse import remove_comments
allow_bitwise_op = ["M3_GainCaps"]
allow_bitwise_op = ["streamingInterface"]
allow_bitwise_op = ["streamingInterface", "M3_GainCaps"]
op_key = {"operator|": "|",
"operator&" : "&"}

View File

@ -273,14 +273,17 @@ void init_enums(py::module &m) {
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
.export_values();
py::enum_<slsDetectorDefs::M3_GainCaps>(Defs, "M3_GainCaps")
py::enum_<slsDetectorDefs::M3_GainCaps>(Defs, "M3_GainCaps",
py::arithmetic())
.value("M3_C10pre", slsDetectorDefs::M3_GainCaps::M3_C10pre)
.value("M3_C15sh", slsDetectorDefs::M3_GainCaps::M3_C15sh)
.value("M3_C30sh", slsDetectorDefs::M3_GainCaps::M3_C30sh)
.value("M3_C50sh", slsDetectorDefs::M3_GainCaps::M3_C50sh)
.value("M3_C225ACsh", slsDetectorDefs::M3_GainCaps::M3_C225ACsh)
.value("M3_C15pre", slsDetectorDefs::M3_GainCaps::M3_C15pre)
.export_values();
.export_values()
.def(py::self | slsDetectorDefs::M3_GainCaps())
.def(py::self & slsDetectorDefs::M3_GainCaps());
py::enum_<slsDetectorDefs::portPosition>(Defs, "portPosition")
.value("LEFT", slsDetectorDefs::portPosition::LEFT)

View File

@ -576,6 +576,21 @@ operator&(const slsDetectorDefs::streamingInterface &a,
return slsDetectorDefs::streamingInterface(static_cast<int32_t>(a) &
static_cast<int32_t>(b));
};
inline slsDetectorDefs::M3_GainCaps
operator|(const slsDetectorDefs::M3_GainCaps &a,
const slsDetectorDefs::M3_GainCaps &b) {
return slsDetectorDefs::M3_GainCaps(static_cast<int32_t>(a) |
static_cast<int32_t>(b));
};
inline slsDetectorDefs::M3_GainCaps
operator&(const slsDetectorDefs::M3_GainCaps &a,
const slsDetectorDefs::M3_GainCaps &b) {
return slsDetectorDefs::M3_GainCaps(static_cast<int32_t>(a) &
static_cast<int32_t>(b));
};
#endif
#ifdef __cplusplus