changed BitPosition to BitAddress
All checks were successful
Build on RHEL9 / build (push) Successful in 3m44s
Build on RHEL8 / build (push) Successful in 5m17s

This commit is contained in:
2025-12-11 13:04:13 +01:00
parent ee3222e56b
commit 654c16b52b
21 changed files with 161 additions and 165 deletions

View File

@@ -1,17 +1,17 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
/*
This file contains Python bindings for the RegisterAddr, BitPosition and RegisterValue
classes.
This file contains Python bindings for the RegisterAddr, BitAddress and
RegisterValue classes.
*/
#include "py_headers.h"
#include "sls/bit_utils.h"
namespace py = pybind11;
using sls::BitAddress;
using sls::RegisterAddress;
using sls::RegisterValue;
using sls::BitPosition;
void init_bit(py::module &m) {
@@ -26,15 +26,15 @@ void init_bit(py::module &m) {
.def(py::self == py::self)
.def(py::self != py::self);
py::class_<BitPosition>(m, "BitPosition")
py::class_<BitAddress>(m, "BitAddress")
.def(py::init())
.def(py::init<RegisterAddress, int>())
.def("__repr__", &BitPosition::str)
.def("str", &BitPosition::str)
.def("address", &BitPosition::address)
.def("bitPosition", &BitPosition::bitPosition)
.def("setAddress", &BitPosition::setAddress)
.def("setBitPosition", &BitPosition::setBitPosition)
.def("__repr__", &BitAddress::str)
.def("str", &BitAddress::str)
.def("address", &BitAddress::address)
.def("bitPosition", &BitAddress::bitPosition)
.def("setAddress", &BitAddress::setAddress)
.def("setBitPosition", &BitAddress::setBitPosition)
.def(py::self == py::self)
.def(py::self != py::self);

View File

@@ -16,7 +16,7 @@
#include <chrono>
namespace py = pybind11;
void init_det(py::module &m) {
using sls::BitPosition;
using sls::BitAddress;
using sls::defs;
using sls::Detector;
using sls::ns;
@@ -1842,34 +1842,34 @@ void init_det(py::module &m) {
Detector::getBitDefinitionsCount);
CppDetectorApi.def(
"setBitDefinition",
(void (Detector::*)(const std::string &, sls::BitPosition)) &
Detector::setBitDefinition,
(void (Detector::*)(const std::string &,
sls::BitAddress))&Detector::setBitDefinition,
py::arg(), py::arg());
CppDetectorApi.def("hasBitDefinition",
(bool (Detector::*)(const std::string &) const) &
Detector::hasBitDefinition,
py::arg());
CppDetectorApi.def("hasBitDefinition",
(bool (Detector::*)(sls::BitPosition) const) &
(bool (Detector::*)(sls::BitAddress) const) &
Detector::hasBitDefinition,
py::arg());
CppDetectorApi.def(
"getBitDefinition",
(sls::BitPosition(Detector::*)(const std::string &) const) &
(sls::BitAddress (Detector::*)(const std::string &) const) &
Detector::getBitDefinition,
py::arg());
CppDetectorApi.def("getBitDefinition",
(std::string(Detector::*)(sls::BitPosition) const) &
(std::string (Detector::*)(sls::BitAddress) const) &
Detector::getBitDefinition,
py::arg());
CppDetectorApi.def("clearBitDefinitions",
(void (Detector::*)()) & Detector::clearBitDefinitions);
CppDetectorApi.def(
"setBitDefinitions",
(void (Detector::*)(const std::map<std::string, BitPosition> &)) &
Detector::setBitDefinitions,
(void (Detector::*)(const std::map<std::string, BitAddress>
&))&Detector::setBitDefinitions,
py::arg());
CppDetectorApi.def("getBitDefinitions", (std::map<std::string, BitPosition>(
CppDetectorApi.def("getBitDefinitions", (std::map<std::string, BitAddress> (
Detector::*)() const) &
Detector::getBitDefinitions);
CppDetectorApi.def("configureTransceiver",
@@ -2066,21 +2066,19 @@ void init_det(py::module &m) {
(void (Detector::*)(uint32_t, uint32_t, bool, sls::Positions)) &
Detector::writeRegister,
py::arg(), py::arg(), py::arg() = false, py::arg() = Positions{});
CppDetectorApi.def(
"setBit",
(void (Detector::*)(sls::BitPosition, bool, sls::Positions)) &
Detector::setBit,
py::arg(), py::arg() = false, py::arg() = Positions{});
CppDetectorApi.def("setBit",
(void (Detector::*)(sls::BitAddress, bool,
sls::Positions))&Detector::setBit,
py::arg(), py::arg() = false, py::arg() = Positions{});
CppDetectorApi.def(
"setBit",
(void (Detector::*)(uint32_t, int, bool, sls::Positions)) &
Detector::setBit,
py::arg(), py::arg(), py::arg() = false, py::arg() = Positions{});
CppDetectorApi.def(
"clearBit",
(void (Detector::*)(sls::BitPosition, bool, sls::Positions)) &
Detector::clearBit,
py::arg(), py::arg() = false, py::arg() = Positions{});
CppDetectorApi.def("clearBit",
(void (Detector::*)(sls::BitAddress, bool,
sls::Positions))&Detector::clearBit,
py::arg(), py::arg() = false, py::arg() = Positions{});
CppDetectorApi.def(
"clearBit",
(void (Detector::*)(uint32_t, int, bool, sls::Positions)) &
@@ -2088,7 +2086,7 @@ void init_det(py::module &m) {
py::arg(), py::arg(), py::arg() = false, py::arg() = Positions{});
CppDetectorApi.def(
"getBit",
(Result<int>(Detector::*)(sls::BitPosition, sls::Positions) const) &
(Result<int> (Detector::*)(sls::BitAddress, sls::Positions) const) &
Detector::getBit,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def(

View File

@@ -13,14 +13,14 @@
#include <chrono>
namespace py = pybind11;
void init_det(py::module &m) {
using sls::BitAddress;
using sls::defs;
using sls::Detector;
using sls::ns;
using sls::Positions;
using sls::Result;
using sls::RegisterAddress;
using sls::RegisterValue;
using sls::BitPosition;
using sls::Result;
m.def("freeSharedMemory", (void (*)(const int, const int)) &sls::freeSharedMemory, py::arg() = 0, py::arg() = -1);