ChimeraTK-DeviceAccess 03.27.00
Loading...
Searching...
No Matches
SubdeviceConvertingDecorator.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3#pragma once
4
6#include "RawConverter.h"
7
8namespace ChimeraTK {
9
10 /********************************************************************************************************************/
11
12 template<typename UserType, typename TargetUserType>
13 class ConvertingDecorator : public NDRegisterAccessorDecorator<UserType, TargetUserType> {
14 public:
15 explicit ConvertingDecorator(const boost::shared_ptr<ChimeraTK::NDRegisterAccessor<TargetUserType>>& target,
16 NumericAddressedRegisterInfo const& registerInfo);
17
18 void doPreRead(TransferType type) override;
19
20 void doPostRead(TransferType type, bool hasNewData) override;
21
22 // Callback for ConverterLoopHelper, see documentation there.
23 template<class CookedType, typename RawType, RawConverter::SignificantBitsCase sc, RawConverter::FractionalCase fc,
24 bool isSigned>
26 [[maybe_unused]] size_t implParameter);
27
28 void doPreWrite(TransferType type, VersionNumber versionNumber) override;
29
30 // Callback for ConverterLoopHelper, see documentation there.
31 template<class CookedType, typename RawType, RawConverter::SignificantBitsCase sc, RawConverter::FractionalCase fc,
32 bool isSigned>
34 [[maybe_unused]] size_t implParameter);
35
36 void doPostWrite(TransferType type, VersionNumber versionNumber) override;
37
38 [[nodiscard]] bool mayReplaceOther(const boost::shared_ptr<ChimeraTK::TransferElement const>& other) const override;
39
40 protected:
41 std::unique_ptr<RawConverter::ConverterLoopHelper> _converterLoopHelper;
43
44 using NDRegisterAccessorDecorator<UserType, TargetUserType>::_target;
45 using NDRegisterAccessor<UserType>::buffer_2D;
46 };
47
48 /********************************************************************************************************************/
49
54
55 // FIXME: get rid of the signed ints!
57
58} // namespace ChimeraTK
#define DECLARE_MULTI_TEMPLATE_FOR_CHIMERATK_USER_TYPES(TemplateClass,...)
Macro to declare a template class with multiple template parameters for all supported user types.
void doPostReadImpl(RawConverter::Converter< CookedType, RawType, sc, fc, isSigned > converter, size_t implParameter)
void doPreWriteImpl(RawConverter::Converter< CookedType, RawType, sc, fc, isSigned > converter, size_t implParameter)
NumericAddressedRegisterInfo _registerInfo
void doPostWrite(TransferType type, VersionNumber versionNumber) override
Backend specific implementation of postWrite().
std::unique_ptr< RawConverter::ConverterLoopHelper > _converterLoopHelper
bool mayReplaceOther(const boost::shared_ptr< ChimeraTK::TransferElement const > &other) const override
void doPostRead(TransferType type, bool hasNewData) override
Backend specific implementation of postRead().
void doPreRead(TransferType type) override
Backend specific implementation of preRead().
void doPreWrite(TransferType type, VersionNumber versionNumber) override
Backend specific implementation of preWrite().
Base class for decorators of the NDRegisterAccessor.
N-dimensional register accessor.
std::vector< std::vector< UserType > > buffer_2D
Buffer of converted data elements.
Converter class for conversions from raw to cooked values.
Class for generating and holding version numbers without exposing a numeric representation.
TransferType
Used to indicate the applicable operation on a Transferelement.