ChimeraTK-DeviceAccess  03.18.00
LNMForcePollingReadPlugin.cc
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 
4 #include "LNMAccessorPlugin.h"
6 #include "NDRegisterAccessor.h"
7 
8 #include <boost/make_shared.hpp>
9 
10 namespace ChimeraTK::LNMBackend {
11 
12  /********************************************************************************************************************/
13 
15  const LNMBackendRegisterInfo& info, size_t pluginIndex, const std::map<std::string, std::string>&)
16  : AccessorPlugin(info, pluginIndex) {}
17 
18  /********************************************************************************************************************/
19 
23  }
24  }
25 
26  /********************************************************************************************************************/
27 
28  template<typename UserType, typename TargetType>
29  boost::shared_ptr<NDRegisterAccessor<UserType>> ForcePollingReadPlugin::decorateAccessor(
30  boost::shared_ptr<LogicalNameMappingBackend>&, boost::shared_ptr<NDRegisterAccessor<TargetType>>& target,
31  const UndecoratedParams&) {
32  if(target->getAccessModeFlags().has(AccessMode::wait_for_new_data)) {
34  "AccessMode::wait_for_new_data is disallowed through ForcePollingReadPlugin for register '" +
35  target->getName() + "'.");
36  }
37 
38  if constexpr(std::is_same<UserType, TargetType>::value) {
39  return target;
40  }
41 
42  assert(false);
43 
44  return {};
45  }
46 } // namespace ChimeraTK::LNMBackend
ChimeraTK::LNMBackend::AccessorPlugin
Base class for plugins that modify the behaviour of accessors in the logical name mapping backend.
Definition: LNMAccessorPlugin.h:104
ChimeraTK::LNMBackend
Definition: LNMMathPluginFormulaHelper.h:16
ChimeraTK::AccessModeFlags::remove
void remove(AccessMode flag)
Remove the given flag from the set.
Definition: AccessMode.cc:56
ChimeraTK::LNMBackend::UndecoratedParams
Helper struct to hold extra parameters needed by some plugins, used in decorateAccessor()
Definition: LNMAccessorPlugin.h:13
ChimeraTK::AccessModeFlags::has
bool has(AccessMode flag) const
Check if a certain flag is in the set.
Definition: AccessMode.cc:20
NDRegisterAccessor.h
ChimeraTK::AccessMode::wait_for_new_data
@ wait_for_new_data
Make any read blocking until new data has arrived since the last read.
ChimeraTK::LNMBackendRegisterInfo
RegisterInfo structure for the LogicalNameMappingBackend.
Definition: LNMBackendRegisterInfo.h:22
ChimeraTK::LNMBackend::AccessorPluginBase::_info
LNMBackendRegisterInfo _info
RegisterInfo describing the the target register for which this plugin instance should work.
Definition: LNMAccessorPlugin.h:93
ChimeraTK::LNMBackend::ForcePollingReadPlugin::decorateAccessor
boost::shared_ptr< NDRegisterAccessor< UserType > > decorateAccessor(boost::shared_ptr< LogicalNameMappingBackend > &backend, boost::shared_ptr< NDRegisterAccessor< TargetType >> &target, const UndecoratedParams &accessorParams)
Definition: LNMForcePollingReadPlugin.cc:29
ChimeraTK::LNMBackend::ForcePollingReadPlugin::doRegisterInfoUpdate
void doRegisterInfoUpdate() override
Implementation of the plugin specific register information update.
Definition: LNMForcePollingReadPlugin.cc:20
ChimeraTK::LNMBackend::ForcePollingReadPlugin::ForcePollingReadPlugin
ForcePollingReadPlugin(const LNMBackendRegisterInfo &info, size_t pluginIndex, const std::map< std::string, std::string > &parameters)
Definition: LNMForcePollingReadPlugin.cc:14
ChimeraTK::LNMBackendRegisterInfo::supportedFlags
AccessModeFlags supportedFlags
Supported AccessMode flags.
Definition: LNMBackendRegisterInfo.h:106
LNMBackendRegisterInfo.h
ChimeraTK::NDRegisterAccessor
N-dimensional register accessor.
Definition: ForwardDeclarations.h:17
LNMAccessorPlugin.h
ChimeraTK::logic_error
Exception thrown when a logic error has occured.
Definition: Exception.h:51