Skip to content
Snippets Groups Projects
Commit 02917214 authored by Christoph Kampmeyer's avatar Christoph Kampmeyer
Browse files

Merge branch 'master' into wip/ckampm/wip-fix-compatibility-da

parents fa859729 31c841d8
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,10 @@ namespace ChimeraTK {
/** value of validity flag from last read operation */
DataValidity lastValidity{DataValidity::ok};
using TransferElement::_dataValidity;
using NDRegisterAccessorDecorator<T>::_target;
using NDRegisterAccessorDecorator<T>::buffer_2D;
};
DECLARE_TEMPLATE_FOR_CHIMERATK_USER_TYPES(MetaDataPropagatingRegisterDecorator);
......
......@@ -13,26 +13,30 @@ namespace ChimeraTK {
}
// Check if the data validity flag changed. If yes, propagate this information to the owning module.
auto valid = ChimeraTK::NDRegisterAccessorDecorator<T>::dataValidity();
if(valid != lastValidity) {
if(valid == DataValidity::faulty)
if(_dataValidity != lastValidity) {
if(_dataValidity == DataValidity::faulty)
_owner->incrementDataFaultCounter();
else
_owner->decrementDataFaultCounter();
lastValidity = valid;
lastValidity = _dataValidity;
}
}
template<typename T>
void MetaDataPropagatingRegisterDecorator<T>::doPreWrite(TransferType type, VersionNumber versionNumber) {
if(TransferElement::_dataValidity == DataValidity::faulty) { // the application has manualy set the validity to faulty
ChimeraTK::NDRegisterAccessorDecorator<T>::setDataValidity(DataValidity::faulty);
// We cannot use NDRegisterAccessorDecorator<T> here because we need a different implementation of setting the target data validity.
// So we have a complete implemetation here.
if(_dataValidity == DataValidity::faulty) { // the application has manualy set the validity to faulty
_target->setDataValidity(DataValidity::faulty);
}
else { // automatic propagation of the owner validity
ChimeraTK::NDRegisterAccessorDecorator<T>::setDataValidity(_owner->getDataValidity());
_target->setDataValidity(_owner->getDataValidity());
}
NDRegisterAccessorDecorator<T, T>::doPreWrite(type, versionNumber);
for(unsigned int i = 0; i < _target->getNumberOfChannels(); ++i) {
buffer_2D[i].swap(_target->accessChannel(i));
}
_target->preWrite(type, versionNumber);
}
} // 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