Skip to content
Snippets Groups Projects
Commit 8aec50d5 authored by Martin Killenberg's avatar Martin Killenberg
Browse files

fixed typo left from manual merging

parent 7808212a
No related branches found
No related tags found
No related merge requests found
......@@ -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 */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment