From 99fb253038468b7227407b07bb3ad9ae87fa5f77 Mon Sep 17 00:00:00 2001 From: vargheseg <19566373+vargheseg@users.noreply.github.com> Date: Wed, 13 May 2020 12:39:18 +0200 Subject: [PATCH] BugFix: checkSourceConsistency - Revised logic for checkSourceConsistency - invoke set_ro_access if all ifff sources are readonly. --- src/DoocsIfff.cc | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/DoocsIfff.cc b/src/DoocsIfff.cc index f411e5a..41f6b68 100644 --- a/src/DoocsIfff.cc +++ b/src/DoocsIfff.cc @@ -5,6 +5,7 @@ #include <ChimeraTK/OneDRegisterAccessor.h> #include <ChimeraTK/ScalarRegisterAccessor.h> #include <doocs/EventId.h> +#include <functional> namespace ChimeraTK { DoocsIfff::DoocsIfff(EqFct* eqFct, std::string const& doocsPropertyName, @@ -17,6 +18,9 @@ namespace ChimeraTK { _f2Value->isWriteable() && _f3Value->isWriteable()) { checkSourceConsistency(); registerIfffSources(); + if(_i1Value->isReadOnly() && _f1Value->isReadOnly() && _f2Value->isReadOnly() && _f3Value->isReadOnly()) { + this->set_ro_access(); + } } // Constructor without history @@ -30,18 +34,19 @@ namespace ChimeraTK { _f2Value->isWriteable() && _f3Value->isWriteable()) { checkSourceConsistency(); registerIfffSources(); - } - void DoocsIfff::checkSourceConsistency() { - bool areAllSourcesReadable = - (_i1Value->isReadable() && _f1Value->isReadable() && _f2Value->isReadable() && _f3Value->isReadable()); - if(not areAllSourcesReadable) { - ChimeraTK::logic_error("Doocs Adapter IFFF configuration Error: not all IFFF sources are readable"); + if(_i1Value->isReadOnly() && _f1Value->isReadOnly() && _f2Value->isReadOnly() && _f3Value->isReadOnly()) { + this->set_ro_access(); } + } + void DoocsIfff::checkSourceConsistency() { bool areAllSourcesWritable = (_i1Value->isWriteable() && _f1Value->isWriteable() && _f2Value->isWriteable() && _f3Value->isWriteable()); - if(not areAllSourcesWritable) { - ChimeraTK::logic_error("Doocs Adapter IFFF configuration Error: not all IFFF sources are writable"); + bool areAllSourcesReadOnly = + (_i1Value->isReadOnly() && _f1Value->isReadOnly() && _f2Value->isReadOnly() && _f3Value->isReadOnly()); + + if(!areAllSourcesWritable && !areAllSourcesReadOnly) { + ChimeraTK::logic_error("Doocs Adapter IFFF configuration Error: some IFFF sources are not writable"); } } -- GitLab