diff --git a/include/ExceptionHandlingDecorator.h b/include/ExceptionHandlingDecorator.h index cc96917894906baa51e91e51283bd04c9b5f881e..6906293ba1b1386b6debf21abe3d68de8329c6b3 100644 --- a/include/ExceptionHandlingDecorator.h +++ b/include/ExceptionHandlingDecorator.h @@ -18,18 +18,14 @@ namespace ChimeraTK { template<typename UserType> class ExceptionHandlingDecorator : public ChimeraTK::NDRegisterAccessorDecorator<UserType> { public: - - /// Basic constructor, inititalizes the base decorator and the reference to the DeviceModule - ExceptionHandlingDecorator( - boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> accessor, DeviceModule& devMod); - /** - * Constructor for writeable registers, allows also setting the recoveryAccessor. - * Deletgates to the basic contructor for member initialization. + * Decorate the accessors which is handed in the constuctor. It needs the device module to implement + * the exception handling. Accessors which write to the device in addition need a recovery accessor + * so the variables can be written again after a device has recovered from an error. Accessors + * which only read don't specify the third parameter. */ - ExceptionHandlingDecorator( - boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> accessor, DeviceModule& devMod, - boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> recoveryAccessor); + ExceptionHandlingDecorator(boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> accessor, + DeviceModule& devMod, boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> recoveryAccessor = {nullptr}); bool doWriteTransfer(ChimeraTK::VersionNumber versionNumber = {}) override; diff --git a/src/ExceptionHandlingDecorator.cc b/src/ExceptionHandlingDecorator.cc index 6ef4d3c849a57f68bef4b9fffdd39149199fe750..fd5cad90d27d949d604531503c5b539d74c18aef 100644 --- a/src/ExceptionHandlingDecorator.cc +++ b/src/ExceptionHandlingDecorator.cc @@ -7,16 +7,11 @@ constexpr useconds_t DeviceOpenTimeout = 500; namespace ChimeraTK { - template<typename UserType> - ExceptionHandlingDecorator<UserType>::ExceptionHandlingDecorator( - boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> accessor, DeviceModule& devMod) - : ChimeraTK::NDRegisterAccessorDecorator<UserType>(accessor), dm(devMod) {} - template<typename UserType> ExceptionHandlingDecorator<UserType>::ExceptionHandlingDecorator( boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> accessor, DeviceModule& devMod, boost::shared_ptr<ChimeraTK::NDRegisterAccessor<UserType>> recoveryAccessor) - : ExceptionHandlingDecorator<UserType>(accessor, devMod) { + : ChimeraTK::NDRegisterAccessorDecorator<UserType>(accessor), dm(devMod) { // Register recoveryAccessor at the DeviceModule if(recoveryAccessor != nullptr) { _recoveryAccessor = recoveryAccessor;