From 8aec50d556014daff7e5454ce69a7f4dba4bb007 Mon Sep 17 00:00:00 2001 From: Martin Killenberg <martin.killenberg@desy.de> Date: Tue, 21 Jan 2020 18:27:42 +0100 Subject: [PATCH] fixed typo left from manual merging --- src/ExceptionHandlingDecorator.cc | 37 +++++++++++++++++-------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/ExceptionHandlingDecorator.cc b/src/ExceptionHandlingDecorator.cc index b96498fc..aaf96e31 100644 --- a/src/ExceptionHandlingDecorator.cc +++ b/src/ExceptionHandlingDecorator.cc @@ -11,39 +11,41 @@ namespace ChimeraTK { ExceptionHandlingDecorator<UserType>::ExceptionHandlingDecorator( boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> accessor, DeviceModule& devMod, boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> recoveryAccessor) - : ChimeraTK::NDRegisterAccessorDecorator<UserType>(accessor), dm(devMod) { + : ChimeraTK::NDRegisterAccessorDecorator<UserType>(accessor), deviceModule(devMod) { // Register recoveryAccessor at the DeviceModule if(recoveryAccessor != nullptr) { _recoveryAccessor = recoveryAccessor; - dm.addRecoveryAccessor(_recoveryAccessor); + deviceModule.addRecoveryAccessor(_recoveryAccessor); } } template<typename UserType> void ExceptionHandlingDecorator<UserType>::setOwnerValidity(DataValidity newValidity) { - if (newValidity != localValidity) { + if(newValidity != localValidity) { localValidity = newValidity; - if (!_owner) return; - if (newValidity == DataValidity::faulty) { + if(!_owner) return; + if(newValidity == DataValidity::faulty) { _owner->incrementDataFaultCounter(); - } else { + } + else { _owner->decrementDataFaultCounter(); } } } - + template<typename UserType> bool ExceptionHandlingDecorator<UserType>::genericTransfer( - std::function<bool(void)> callable, bool updateOwnerValidityFlag) { - + std::function<bool(void)> callable, bool updateOwnerValidityFlag) { std::function<void(DataValidity)> setOwnerValidityFunction{}; if(updateOwnerValidityFlag) { - setOwnerValidityFunction = std::bind(&ExceptionHandlingDecorator<UserType>::setOwnerValidity, this, std::placeholders::_1); - } + setOwnerValidityFunction = + std::bind(&ExceptionHandlingDecorator<UserType>::setOwnerValidity, this, std::placeholders::_1); + } else { - setOwnerValidityFunction = [](DataValidity) {}; // do nothing if user does // not want to invalidate data. + setOwnerValidityFunction = [](DataValidity) { + }; // do nothing if user does // not want to invalidate data. } - + while(true) { try { if(!deviceModule.device.isOpened()) { @@ -90,7 +92,8 @@ namespace ChimeraTK { template<typename UserType> bool ExceptionHandlingDecorator<UserType>::doReadTransferNonBlocking() { - return genericTransfer( [this]() { return ChimeraTK::NDRegisterAccessorDecorator<UserType>::doReadTransferNonBlocking(); }); + return genericTransfer( + [this]() { return ChimeraTK::NDRegisterAccessorDecorator<UserType>::doReadTransferNonBlocking(); }); } template<typename UserType> @@ -130,7 +133,7 @@ namespace ChimeraTK { * modify the recoveryAcessor's user buffer while data is written to the device. */ { - auto lock{dm.getRecoverySharedLock()}; + auto lock{deviceModule.getRecoverySharedLock()}; if(_recoveryAccessor != nullptr) { // Access to _recoveryAccessor is only possible channel-wise @@ -170,12 +173,12 @@ namespace ChimeraTK { deviceModule.notify(); ChimeraTK::NDRegisterAccessorDecorator<UserType>::interrupt(); } - + template<typename UserType> void ExceptionHandlingDecorator<UserType>::setOwner(EntityOwner* owner) { _owner = owner; } - + INSTANTIATE_TEMPLATE_FOR_CHIMERATK_USER_TYPES(ExceptionHandlingDecorator); } /* namespace ChimeraTK */ -- GitLab