Newer
Older
Martin Christoph Hierholzer
committed
#ifndef VERSIONNUMBERUPDATINGREGISTERDECORATOR_H
#define VERSIONNUMBERUPDATINGREGISTERDECORATOR_H
#include <ChimeraTK/NDRegisterAccessorDecorator.h>
/********************************************************************************************************************/
namespace ChimeraTK {
* NDRegisterAccessorDecorator which propagates meta data attached to input process variables through the owning
* ApplicationModule. It will set the current version number of the owning ApplicationModule in postRead. At the
* same time it will also propagate the DataValidity flag to/from the owning module.
class MetaDataPropagatingRegisterDecorator : public NDRegisterAccessorDecorator<T, T> {
Martin Christoph Hierholzer
committed
public:
MetaDataPropagatingRegisterDecorator(const boost::shared_ptr<NDRegisterAccessor<T>>& target, EntityOwner* owner)
: NDRegisterAccessorDecorator<T, T>(target), _owner(owner) {}
void doPreRead(TransferType type) override {
Martin Christoph Hierholzer
committed
isNonblockingRead = false;
NDRegisterAccessorDecorator<T, T>::doPreRead(type);
Martin Christoph Hierholzer
committed
}
void doPostRead(TransferType type, bool hasNewData) override;
void doPreWrite(TransferType type, VersionNumber versionNumber) override;
Martin Christoph Hierholzer
committed
/** value of validity flag from last read operation */
DataValidity lastValidity{DataValidity::ok};
/** value of validity flag from user */
DataValidity localValidity{DataValidity::ok};
Martin Christoph Hierholzer
committed
bool isNonblockingRead{false};
Martin Christoph Hierholzer
committed
DECLARE_TEMPLATE_FOR_CHIMERATK_USER_TYPES(MetaDataPropagatingRegisterDecorator);
Martin Christoph Hierholzer
committed
Martin Christoph Hierholzer
committed
} /* namespace ChimeraTK */
#endif // VERSIONNUMBERUPDATINGREGISTERDECORATOR_H