ChimeraTK-DeviceAccess  03.18.00
LNMBackendVariableAccessor.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 
5 #include "Device.h"
6 #include "FixedPointConverter.h"
7 #include "LNMAccessorPlugin.h"
8 #include "LNMMathPlugin.h"
10 #include "NDRegisterAccessor.h"
11 
12 #include <ChimeraTK/cppext/finally.hpp>
13 
14 #include <algorithm>
15 
16 namespace ChimeraTK {
17 
18  /********************************************************************************************************************/
19 
20  template<typename UserType>
22  public:
23  LNMBackendVariableAccessor(const boost::shared_ptr<DeviceBackend>& dev, const RegisterPath& registerPathName,
24  size_t numberOfWords, size_t wordOffsetInRegister, AccessModeFlags flags);
25 
26  ~LNMBackendVariableAccessor() override;
27 
28  void doReadTransferSynchronously() override;
29 
30  void doPreWrite(TransferType type, VersionNumber) override;
31 
32  void doPostWrite(TransferType type, VersionNumber versionNumber) override;
33 
35 
36  [[nodiscard]] bool mayReplaceOther(const boost::shared_ptr<TransferElement const>&) const override;
37 
38  [[nodiscard]] bool isReadOnly() const override;
39 
40  [[nodiscard]] bool isReadable() const override;
41 
42  [[nodiscard]] bool isWriteable() const override;
43 
44  void doPreRead(TransferType) override;
45 
46  void doPostRead(TransferType, bool hasNewData) override;
47 
48  void interrupt() override;
49 
50  protected:
53 
55  boost::shared_ptr<LogicalNameMappingBackend> _dev;
56 
60  // RegisterInfo _info;
63 
67 
70 
73 
75  std::list<boost::shared_ptr<LNMBackend::MathPluginFormulaHelper>> _formulaHelpers;
76 
77  std::vector<boost::shared_ptr<TransferElement>> getHardwareAccessingElements() override {
78  return {boost::enable_shared_from_this<TransferElement>::shared_from_this()};
79  }
80 
81  std::list<boost::shared_ptr<TransferElement>> getInternalElements() override { return {}; }
82 
83  void replaceTransferElement(boost::shared_ptr<TransferElement> /*newElement*/) override {} // LCOV_EXCL_LINE
84  };
85 
86  DECLARE_TEMPLATE_FOR_CHIMERATK_USER_TYPES(LNMBackendVariableAccessor);
87 
88  /********************************************************************************************************************/
89 
90 } // namespace ChimeraTK
LNMMathPlugin.h
ChimeraTK::LNMBackendVariableAccessor::interrupt
void interrupt() override
Definition: LNMBackendVariableAccessor.cc:251
ChimeraTK::LNMBackendVariableAccessor::isWriteable
bool isWriteable() const override
Definition: LNMBackendVariableAccessor.cc:203
ChimeraTK::LNMBackendVariableAccessor::doWriteTransfer
bool doWriteTransfer(ChimeraTK::VersionNumber) override
Definition: LNMBackendVariableAccessor.cc:140
ChimeraTK::LNMBackendVariableAccessor::_formulaHelpers
std::list< boost::shared_ptr< LNMBackend::MathPluginFormulaHelper > > _formulaHelpers
in case a MathPlugin formulas are using this variable, references to the FormulaHelpers
Definition: LNMBackendVariableAccessor.h:75
FixedPointConverter.h
ChimeraTK::LNMBackendVariableAccessor::doPostRead
void doPostRead(TransferType, bool hasNewData) override
Definition: LNMBackendVariableAccessor.cc:219
ChimeraTK::LNMBackendVariableAccessor::_info
LNMBackendRegisterInfo _info
register information.
Definition: LNMBackendVariableAccessor.h:59
LogicalNameMappingBackend.h
ChimeraTK::LNMBackendVariableAccessor::~LNMBackendVariableAccessor
~LNMBackendVariableAccessor() override
Definition: LNMBackendVariableAccessor.cc:103
ChimeraTK::LNMBackendVariableAccessor::replaceTransferElement
void replaceTransferElement(boost::shared_ptr< TransferElement >) override
Definition: LNMBackendVariableAccessor.h:83
ChimeraTK::LNMVariable::ValueTable::QueuedValue
Definition: LNMVariable.h:27
ChimeraTK::LNMBackendVariableAccessor::getInternalElements
std::list< boost::shared_ptr< TransferElement > > getInternalElements() override
Definition: LNMBackendVariableAccessor.h:81
ChimeraTK::LNMBackendVariableAccessor::_flags
AccessModeFlags _flags
access mode flags
Definition: LNMBackendVariableAccessor.h:72
ChimeraTK::LNMBackendVariableAccessor::mayReplaceOther
bool mayReplaceOther(const boost::shared_ptr< TransferElement const > &) const override
Definition: LNMBackendVariableAccessor.cc:182
ChimeraTK::LNMBackendVariableAccessor::doPostWrite
void doPostWrite(TransferType type, VersionNumber versionNumber) override
Definition: LNMBackendVariableAccessor.cc:168
ChimeraTK::LNMBackendVariableAccessor::doPreWrite
void doPreWrite(TransferType type, VersionNumber) override
Definition: LNMBackendVariableAccessor.cc:126
ChimeraTK::LNMBackendVariableAccessor::doPreRead
void doPreRead(TransferType) override
Definition: LNMBackendVariableAccessor.cc:210
NDRegisterAccessor.h
ChimeraTK::LNMBackendVariableAccessor::doReadTransferSynchronously
void doReadTransferSynchronously() override
Definition: LNMBackendVariableAccessor.cc:119
ChimeraTK::LNMBackendRegisterInfo
RegisterInfo structure for the LogicalNameMappingBackend.
Definition: LNMBackendRegisterInfo.h:22
Device.h
ChimeraTK::LNMBackendVariableAccessor::LNMBackendVariableAccessor
LNMBackendVariableAccessor(const boost::shared_ptr< DeviceBackend > &dev, const RegisterPath &registerPathName, size_t numberOfWords, size_t wordOffsetInRegister, AccessModeFlags flags)
Definition: LNMBackendVariableAccessor.cc:13
ChimeraTK::TransferType
TransferType
Used to indicate the applicable operation on a Transferelement.
Definition: TransferElement.h:51
ChimeraTK::LNMBackendVariableAccessor::getHardwareAccessingElements
std::vector< boost::shared_ptr< TransferElement > > getHardwareAccessingElements() override
Definition: LNMBackendVariableAccessor.h:77
ChimeraTK::LNMBackendVariableAccessor::isReadOnly
bool isReadOnly() const override
Definition: LNMBackendVariableAccessor.cc:189
ChimeraTK::LNMBackendVariableAccessor::_queueValue
LNMVariable::ValueTable< UserType >::QueuedValue _queueValue
Intermediate buffer used when receiving value from queue, as writing to application buffer must only ...
Definition: LNMBackendVariableAccessor.h:66
ChimeraTK::RegisterPath
Class to store a register path name.
Definition: RegisterPath.h:16
ChimeraTK::LNMBackendVariableAccessor::currentVersion
VersionNumber currentVersion
Version number of the last transfer.
Definition: LNMBackendVariableAccessor.h:69
ChimeraTK::LNMBackendVariableAccessor::_dev
boost::shared_ptr< LogicalNameMappingBackend > _dev
backend device
Definition: LNMBackendVariableAccessor.h:55
ChimeraTK::VersionNumber
Class for generating and holding version numbers without exposing a numeric representation.
Definition: VersionNumber.h:23
ChimeraTK::AccessModeFlags
Set of AccessMode flags with additional functionality for an easier handling.
Definition: AccessMode.h:48
ChimeraTK::LNMBackendVariableAccessor
Definition: LNMBackendVariableAccessor.h:21
ChimeraTK::DECLARE_TEMPLATE_FOR_CHIMERATK_USER_TYPES
DECLARE_TEMPLATE_FOR_CHIMERATK_USER_TYPES(DummyInterruptTriggerAccessor)
ChimeraTK
Definition: DummyBackend.h:16
ChimeraTK::LNMBackendVariableAccessor::_registerPathName
RegisterPath _registerPathName
register and module name
Definition: LNMBackendVariableAccessor.h:52
ChimeraTK::LNMBackendVariableAccessor::isReadable
bool isReadable() const override
Definition: LNMBackendVariableAccessor.cc:196
ChimeraTK::LNMBackendVariableAccessor::_wordOffsetInRegister
size_t _wordOffsetInRegister
Word offset when reading.
Definition: LNMBackendVariableAccessor.h:62
ChimeraTK::NDRegisterAccessor
N-dimensional register accessor.
Definition: ForwardDeclarations.h:17
LNMAccessorPlugin.h