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

ExceptionHandlingDecorator: unifies both constructors

parent 38fd10f9
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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;
......
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