ChimeraTK-DeviceAccess  03.18.00
LNMBackendRegisterInfo.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 
7 #include "ForwardDeclarations.h"
8 #include "RegisterInfo.h"
9 #include "TransferElement.h"
10 
11 #include <boost/shared_ptr.hpp>
12 
13 #include <mutex>
14 
15 namespace ChimeraTK {
16 
17  namespace LNMBackend {
18  class AccessorPluginBase;
19  } // namespace LNMBackend
20 
23  public:
26 
28  LNMBackendRegisterInfo() = default;
31 
32  [[nodiscard]] RegisterPath getRegisterName() const override { return name; }
33 
34  [[nodiscard]] unsigned int getNumberOfElements() const override { return length; }
35 
36  [[nodiscard]] unsigned int getNumberOfChannels() const override { return nChannels; }
37 
38  [[nodiscard]] const DataDescriptor& getDataDescriptor() const override { return _dataDescriptor; }
39 
40  [[nodiscard]] bool isReadable() const override { return readable; }
41 
42  [[nodiscard]] bool isWriteable() const override { return writeable; }
43 
44  [[nodiscard]] AccessModeFlags getSupportedAccessModes() const override { return supportedFlags; }
45 
48 
50  TargetType targetType{TargetType::INVALID};
51 
53  std::string deviceName;
54 
56  std::string registerName;
57 
59  unsigned int firstIndex{};
60 
62  unsigned int length{};
63 
65  unsigned int channel{};
66 
68  unsigned int bit{};
69 
71  unsigned int nChannels{};
72 
75 
76  // /** Hold values of CONSTANT or VARIABLE types in a type-dependent table. Only the entry matching the valueType
77  // * is actually valid.
78  // * Note: We cannot directly put the std::vector in a TemplateUserTypeMap, since it has more than one template
79  // * arguments (with defaults). */
80  // template<typename T>
81  // struct ValueTable {
82  // std::vector<T> latestValue;
83  // DataValidity latestValidity;
84  // VersionNumber latestVersion;
85  // struct QueuedValue {
86  // std::vector<T> value;
87  // DataValidity validity;
88  // VersionNumber version;
89  // };
90  // std::map<TransferElementID, cppext::future_queue<QueuedValue>> subscriptions;
91  // };
92  // TemplateUserTypeMap<ValueTable> valueTable;
93 
94  // /** Mutex one needs to hold while accessing valueTable. */
95  // std::mutex valueTable_mutex;
96 
99  bool readable{};
100 
103  bool writeable{};
104 
107 
109  std::vector<boost::shared_ptr<LNMBackend::AccessorPluginBase>> plugins;
110 
112 
113  [[nodiscard]] std::unique_ptr<BackendRegisterInfoBase> clone() const override {
114  return std::make_unique<LNMBackendRegisterInfo>(*this);
115  }
116  };
117  /********************************************************************************************************************/
118 
119  /*class LNMRegisterCatalogue : public BackendRegisterCatalogue<LNMBackendRegisterInfo> {
120  public:
121  LNMRegisterCatalogue() = default;
122  LNMRegisterCatalogue& operator=(const LNMRegisterCatalogue& other) = default;
123  LNMRegisterCatalogue(const LNMRegisterCatalogue&) = default;
124  };*/
125 
126  /********************************************************************************************************************/
127 } /* namespace ChimeraTK */
ChimeraTK::LNMBackendRegisterInfo::BIT
@ BIT
Definition: LNMBackendRegisterInfo.h:25
ChimeraTK::LNMBackendRegisterInfo::channel
unsigned int channel
The channel of the target 2D register (if TargetType::CHANNEL)
Definition: LNMBackendRegisterInfo.h:65
ChimeraTK::LNMBackendRegisterInfo::registerName
std::string registerName
The target register name.
Definition: LNMBackendRegisterInfo.h:56
ChimeraTK::LNMBackendRegisterInfo::REGISTER
@ REGISTER
Definition: LNMBackendRegisterInfo.h:25
ChimeraTK::LNMBackendRegisterInfo::operator=
LNMBackendRegisterInfo & operator=(const LNMBackendRegisterInfo &other)=default
ForwardDeclarations.h
ChimeraTK::LNMBackendRegisterInfo::getRegisterName
RegisterPath getRegisterName() const override
Return full path name of the register (including modules)
Definition: LNMBackendRegisterInfo.h:32
ChimeraTK::LNMBackendRegisterInfo::CHANNEL
@ CHANNEL
Definition: LNMBackendRegisterInfo.h:25
ChimeraTK::LNMBackendRegisterInfo::plugins
std::vector< boost::shared_ptr< LNMBackend::AccessorPluginBase > > plugins
List of accessor plugins enabled for this register.
Definition: LNMBackendRegisterInfo.h:109
TransferElement.h
BackendRegisterCatalogue.h
ChimeraTK::LNMBackendRegisterInfo::name
RegisterPath name
Name of the registrer.
Definition: LNMBackendRegisterInfo.h:47
ChimeraTK::LNMBackendRegisterInfo::getDataDescriptor
const DataDescriptor & getDataDescriptor() const override
Return desciption of the actual payload data for this register.
Definition: LNMBackendRegisterInfo.h:38
ChimeraTK::LNMBackendRegisterInfo::nChannels
unsigned int nChannels
The number of channels of the logical register.
Definition: LNMBackendRegisterInfo.h:71
ChimeraTK::LNMBackendRegisterInfo::writeable
bool writeable
Flag if the register is writeable.
Definition: LNMBackendRegisterInfo.h:103
ChimeraTK::DataDescriptor
Class describing the actual payload data format of a register in an abstract manner.
Definition: DataDescriptor.h:19
ChimeraTK::LNMBackendRegisterInfo::firstIndex
unsigned int firstIndex
The first index in the range.
Definition: LNMBackendRegisterInfo.h:59
ChimeraTK::LNMBackendRegisterInfo::bit
unsigned int bit
The bit of the target register (if TargetType::BIT)
Definition: LNMBackendRegisterInfo.h:68
ChimeraTK::LNMBackendRegisterInfo
RegisterInfo structure for the LogicalNameMappingBackend.
Definition: LNMBackendRegisterInfo.h:22
ChimeraTK::LNMBackendRegisterInfo::getNumberOfChannels
unsigned int getNumberOfChannels() const override
Return number of channels in register.
Definition: LNMBackendRegisterInfo.h:36
ChimeraTK::LNMBackendRegisterInfo::deviceName
std::string deviceName
The target device alias.
Definition: LNMBackendRegisterInfo.h:53
ChimeraTK::LNMBackendRegisterInfo::isReadable
bool isReadable() const override
Return whether the register is readable.
Definition: LNMBackendRegisterInfo.h:40
ChimeraTK::LNMBackendRegisterInfo::targetType
TargetType targetType
Type of the target.
Definition: LNMBackendRegisterInfo.h:50
ChimeraTK::LNMBackendRegisterInfo::VARIABLE
@ VARIABLE
Definition: LNMBackendRegisterInfo.h:25
ChimeraTK::LNMBackendRegisterInfo::INVALID
@ INVALID
Definition: LNMBackendRegisterInfo.h:25
RegisterInfo.h
ChimeraTK::DataType
A class to describe which of the supported data types is used.
Definition: SupportedUserTypes.h:599
ChimeraTK::LNMBackendRegisterInfo::TargetType
TargetType
Potential target types.
Definition: LNMBackendRegisterInfo.h:25
ChimeraTK::LNMBackendRegisterInfo::_dataDescriptor
DataDescriptor _dataDescriptor
Definition: LNMBackendRegisterInfo.h:111
ChimeraTK::LNMBackendRegisterInfo::valueType
DataType valueType
Data type of CONSTANT or VARIABLE type.
Definition: LNMBackendRegisterInfo.h:74
ChimeraTK::LNMBackendRegisterInfo::LNMBackendRegisterInfo
LNMBackendRegisterInfo()=default
constructor: initialise values
ChimeraTK::LNMBackendRegisterInfo::CONSTANT
@ CONSTANT
Definition: LNMBackendRegisterInfo.h:25
ChimeraTK::LNMBackendRegisterInfo::getNumberOfElements
unsigned int getNumberOfElements() const override
Return number of elements per channel.
Definition: LNMBackendRegisterInfo.h:34
ChimeraTK::LNMBackendRegisterInfo::getSupportedAccessModes
AccessModeFlags getSupportedAccessModes() const override
Return all supported AccessModes for this register.
Definition: LNMBackendRegisterInfo.h:44
ChimeraTK::RegisterPath
Class to store a register path name.
Definition: RegisterPath.h:16
ChimeraTK::LNMBackendRegisterInfo::supportedFlags
AccessModeFlags supportedFlags
Supported AccessMode flags.
Definition: LNMBackendRegisterInfo.h:106
ChimeraTK::LNMBackendRegisterInfo::length
unsigned int length
The length of the range (i.e.
Definition: LNMBackendRegisterInfo.h:62
ChimeraTK::AccessModeFlags
Set of AccessMode flags with additional functionality for an easier handling.
Definition: AccessMode.h:48
BackendRegisterInfoBase.h
ChimeraTK
Definition: DummyBackend.h:16
ChimeraTK::BackendRegisterInfoBase
DeviceBackend-independent register description.
Definition: BackendRegisterInfoBase.h:16
ChimeraTK::LNMBackendRegisterInfo::isWriteable
bool isWriteable() const override
Return whether the register is writeable.
Definition: LNMBackendRegisterInfo.h:42
ChimeraTK::LNMBackendRegisterInfo::readable
bool readable
Flag if the register is readable.
Definition: LNMBackendRegisterInfo.h:99
ChimeraTK::LNMBackendRegisterInfo::clone
std::unique_ptr< BackendRegisterInfoBase > clone() const override
Create copy of the object.
Definition: LNMBackendRegisterInfo.h:113