diff --git a/include/ConstantAccessor.h b/include/ConstantAccessor.h index c0391da9855d9d10e2a3d5006baf2720c97d1ff7..62c597a8a8e7edea7f1d4e2c7b5c235fb3d23d99 100644 --- a/include/ConstantAccessor.h +++ b/include/ConstantAccessor.h @@ -52,7 +52,7 @@ namespace ChimeraTK { bool doReadTransferLatest() override { return doReadTransferNonBlocking(); } - void doPostRead() override { ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D[0] = _value; } + void doPostRead(TransferType /*type*/) override { ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D[0] = _value; } bool doWriteTransfer(ChimeraTK::VersionNumber /*versionNumber*/ = {}) override { return true; } diff --git a/include/ConsumingFanOut.h b/include/ConsumingFanOut.h index d3bba3e70d8927e9687f920d80be8d93898c5b17..7ccbff1a1f8efd54f538f785ffe4d14819d7ae8b 100644 --- a/include/ConsumingFanOut.h +++ b/include/ConsumingFanOut.h @@ -26,8 +26,8 @@ namespace ChimeraTK { assert(feedingImpl->isReadable()); } - void doPostRead() override { - ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPostRead(); + void doPostRead(TransferType type) override { + ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPostRead(type); for(auto& slave : FanOut<UserType>::slaves) { // send out copies to slaves // do not send copy if no data is expected (e.g. trigger) if(slave->getNumberOfSamples() != 0) { diff --git a/include/DebugPrintAccessorDecorator.h b/include/DebugPrintAccessorDecorator.h index 44e597915afa6722fe59c0476d8ea46ad10d1dfb..9c25ec4b14555b5720277bcc3ebd9c437172ac76 100644 --- a/include/DebugPrintAccessorDecorator.h +++ b/include/DebugPrintAccessorDecorator.h @@ -55,24 +55,24 @@ namespace ChimeraTK { return ChimeraTK::NDRegisterAccessorDecorator<UserType>::doReadTransferAsync(); } - void doPreRead() override { + void doPreRead(TransferType type) override { std::cout << "preRead() called on '" << _fullyQualifiedName << "'." << std::endl; - ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPreRead(); + ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPreRead(type); } - void doPostRead() override { + void doPostRead(TransferType type) override { std::cout << "postRead() called on '" << _fullyQualifiedName << "'." << std::endl; - ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPostRead(); + ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPostRead(type); } - void doPreWrite() override { + void doPreWrite(TransferType type) override { std::cout << "preWrite() called on '" << _fullyQualifiedName << "'." << std::endl; - ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPreWrite(); + ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPreWrite(type); } - void doPostWrite() override { + void doPostWrite(TransferType type) override { std::cout << "postWrite() called on '" << _fullyQualifiedName << "'." << std::endl; - ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPostWrite(); + ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPostWrite(type); } protected: diff --git a/include/ExceptionHandlingDecorator.h b/include/ExceptionHandlingDecorator.h index c7b6c23331477f5eabaa25f28efd9b5bbd293e06..2859cf875a2f4cf294e5bcce1add5fb3eef86167 100644 --- a/include/ExceptionHandlingDecorator.h +++ b/include/ExceptionHandlingDecorator.h @@ -40,7 +40,7 @@ namespace ChimeraTK { TransferFuture doReadTransferAsync() override; - void doPreWrite() override; + void doPreWrite(TransferType type) override; DataValidity dataValidity() const override; diff --git a/include/FeedingFanOut.h b/include/FeedingFanOut.h index bd2ce6e5e1c64e711827d4ee5b749985a15a3ea3..aa2e3fac8fd6153556c4bb53e15ea2eb73e0b4f7 100644 --- a/include/FeedingFanOut.h +++ b/include/FeedingFanOut.h @@ -83,16 +83,16 @@ namespace ChimeraTK { return _returnSlave->readTransferLatest(); } - void doPreRead() override { + void doPreRead(TransferType type) override { if(!_withReturn) throw ChimeraTK::logic_error("Read operation called on write-only variable."); _returnSlave->accessChannel(0).swap(ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D[0]); - _returnSlave->preRead(); + _returnSlave->preRead(type); } - void doPostRead() override { + void doPostRead(TransferType type) override { if(!_withReturn) throw ChimeraTK::logic_error("Read operation called on write-only variable."); assert(_hasReturnSlave); - _returnSlave->postRead(); + _returnSlave->postRead(type); _returnSlave->accessChannel(0).swap(ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D[0]); // distribute return-channel update to the other slaves for(auto& slave : FanOut<UserType>::slaves) { // send out copies to slaves @@ -109,7 +109,7 @@ namespace ChimeraTK { return {_returnSlave->readTransferAsync(), this}; } - void doPreWrite() override { + void doPreWrite(TransferType type) override { for(auto& slave : FanOut<UserType>::slaves) { // send out copies to slaves if(slave->getNumberOfSamples() != 0) { // do not send copy if no data is expected (e.g. trigger) if(slave == FanOut<UserType>::slaves.front()) { // in case of first slave, swap instead of copy @@ -124,7 +124,7 @@ namespace ChimeraTK { // pre write may only be called on the target accessors after we have filled // them all, otherwise the first accessor might take us the data away... for(auto& slave : FanOut<UserType>::slaves) { - slave->preWrite(); + slave->preWrite(type); } } @@ -154,9 +154,9 @@ namespace ChimeraTK { return dataLost; } - void doPostWrite() override { + void doPostWrite(TransferType type) override { for(auto& slave : FanOut<UserType>::slaves) { - slave->postWrite(); + slave->postWrite(type); } FanOut<UserType>::slaves.front()->accessChannel(0).swap(ChimeraTK::NDRegisterAccessor<UserType>::buffer_2D[0]); } diff --git a/include/MetaDataPropagatingRegisterDecorator.h b/include/MetaDataPropagatingRegisterDecorator.h index 01eb4a1aed67cab9277fabecf65712ba0d986c71..77e6e41f1c2065b123d53f6ce9efc784fd3837be 100644 --- a/include/MetaDataPropagatingRegisterDecorator.h +++ b/include/MetaDataPropagatingRegisterDecorator.h @@ -28,13 +28,13 @@ namespace ChimeraTK { isNonblockingRead = true; return NDRegisterAccessorDecorator<T, T>::doReadTransferLatest(); } - void doPreRead() override { + void doPreRead(TransferType type) override { isNonblockingRead = false; - NDRegisterAccessorDecorator<T, T>::doPreRead(); + NDRegisterAccessorDecorator<T, T>::doPreRead(type); } - void doPostRead() override; - void doPreWrite() override; + void doPostRead(TransferType type) override; + void doPreWrite(TransferType type) override; protected: EntityOwner* _owner; diff --git a/include/TestableModeAccessorDecorator.h b/include/TestableModeAccessorDecorator.h index b41f83f23f61bdc709bb297dd559b2fb75ca6607..f396953530cd8b074b6a6fe8ab638de1a3de8374 100644 --- a/include/TestableModeAccessorDecorator.h +++ b/include/TestableModeAccessorDecorator.h @@ -175,9 +175,9 @@ namespace ChimeraTK { return true; } - void doPostRead() override { + void doPostRead(TransferType type) override { if(_handleRead) obtainLockAndDecrementCounter(); - ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPostRead(); + ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPostRead(type); } protected: diff --git a/src/ExceptionHandlingDecorator.cc b/src/ExceptionHandlingDecorator.cc index 46e2dd3f4f5bdc2e18ff4f895f19d4aeefd7a099..500bad807bcbb3dda3d36b3a8c08ccb2e9f2b611 100644 --- a/src/ExceptionHandlingDecorator.cc +++ b/src/ExceptionHandlingDecorator.cc @@ -130,7 +130,7 @@ namespace ChimeraTK { } template<typename UserType> - void ExceptionHandlingDecorator<UserType>::doPreWrite() { + void ExceptionHandlingDecorator<UserType>::doPreWrite(TransferType type) { /* For writable accessors, copy data to the recoveryAcessor before perfroming the write. * Otherwise, the decorated accessor may have swapped the data out of the user buffer already. * This obtains a shared lock from the DeviceModule, hence, the regular writing happeniin here @@ -154,7 +154,7 @@ namespace ChimeraTK { } // lock guard goes out of scope // Now delegate call to the generic decorator, which swaps the buffer, without adding our exception handling with the generic transfer - ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPreWrite(); + ChimeraTK::NDRegisterAccessorDecorator<UserType>::doPreWrite(type); } template<typename UserType> diff --git a/src/MetaDataPropagatingRegisterDecorator.cc b/src/MetaDataPropagatingRegisterDecorator.cc index 32323e90dcbc36bf7b2729fdaead0551bfa5cccf..45981e01f737026f8df3a43350c46d9b1b29d253 100644 --- a/src/MetaDataPropagatingRegisterDecorator.cc +++ b/src/MetaDataPropagatingRegisterDecorator.cc @@ -4,8 +4,8 @@ namespace ChimeraTK { template<typename T> - void MetaDataPropagatingRegisterDecorator<T>::doPostRead() { - NDRegisterAccessorDecorator<T, T>::doPostRead(); + void MetaDataPropagatingRegisterDecorator<T>::doPostRead(TransferType type) { + NDRegisterAccessorDecorator<T, T>::doPostRead(type); // update the version number if(!isNonblockingRead) { @@ -24,9 +24,9 @@ namespace ChimeraTK { } template<typename T> - void MetaDataPropagatingRegisterDecorator<T>::doPreWrite() { + void MetaDataPropagatingRegisterDecorator<T>::doPreWrite(TransferType type) { ChimeraTK::NDRegisterAccessorDecorator<T>::setDataValidity(_owner->getDataValidity()); - NDRegisterAccessorDecorator<T, T>::doPreWrite(); + NDRegisterAccessorDecorator<T, T>::doPreWrite(type); } } // namespace ChimeraTK