ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
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"
7
8#include <boost/make_shared.hpp>
9
10namespace 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
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
void remove(AccessMode flag)
Remove the given flag from the set.
Definition AccessMode.cc:56
bool has(AccessMode flag) const
Check if a certain flag is in the set.
Definition AccessMode.cc:20
LNMBackendRegisterInfo _info
RegisterInfo describing the the target register for which this plugin instance should work.
Base class for plugins that modify the behaviour of accessors in the logical name mapping backend.
boost::shared_ptr< NDRegisterAccessor< UserType > > decorateAccessor(boost::shared_ptr< LogicalNameMappingBackend > &backend, boost::shared_ptr< NDRegisterAccessor< TargetType > > &target, const UndecoratedParams &accessorParams)
void doRegisterInfoUpdate() override
Implementation of the plugin specific register information update.
ForcePollingReadPlugin(const LNMBackendRegisterInfo &info, size_t pluginIndex, const std::map< std::string, std::string > &parameters)
RegisterInfo structure for the LogicalNameMappingBackend.
AccessModeFlags supportedFlags
Supported AccessMode flags.
N-dimensional register accessor.
Exception thrown when a logic error has occured.
Definition Exception.h:51
@ wait_for_new_data
Make any read blocking until new data has arrived since the last read.
Helper struct to hold extra parameters needed by some plugins, used in decorateAccessor()