ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
TriggeredPollDistributor.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
5
7#include "async/SubDomain.h"
9
10namespace ChimeraTK::async {
11
12 /********************************************************************************************************************/
13
14 TriggeredPollDistributor::TriggeredPollDistributor(boost::shared_ptr<DeviceBackend> backend,
15 boost::shared_ptr<SubDomain<std::nullptr_t>> parent, boost::shared_ptr<Domain> asyncDomain)
16 : SourceTypedAsyncAccessorManager<std::nullptr_t>(std::move(backend), std::move(asyncDomain)),
17 _parent(std::move(parent)) {
19
20 // get DataConsistencyRealm from backend catalogue
21 _dataConsistencyRealm = _backend->getRegisterCatalogue().getImpl().getDataConsistencyRealm(_parent->getId());
23 // get accessor for the DataConsistencyKey from the backend and add it to our TransferGroup
24 auto path = _backend->getRegisterCatalogue().getImpl().getDataConsistencyKeyRegisterPath(_parent->getId());
25 _dataConsistencyKeyAccessor.replace(_backend->getRegisterAccessor<DataConsistencyKey::BaseType>(path, 0, 0, {}));
27 }
28 }
29
30 /********************************************************************************************************************/
31
33 try {
35 }
37 // Nothing to do. Backend's set exception has already been called by the accessor in the transfer group that
38 // raised it.
39 return false;
40 }
41
42 // update version number
45 if(newVersion >= _lastVersion) {
46 _version = newVersion;
48 _forceFaulty = false;
49 }
50 else {
52 _forceFaulty = true;
53 }
54 }
55
56 return true;
57 }
58
59 /********************************************************************************************************************/
60
61} // namespace ChimeraTK::async
#define FILL_VIRTUAL_FUNCTION_TEMPLATE_VTABLE(functionName)
Fill the vtable of a virtual function template defined with DEFINE_VIRTUAL_FUNCTION_TEMPLATE.
void replace(const NDRegisterAccessorAbstractor< UserType > &newAccessor)
Assign a new accessor to this NDRegisterAccessorAbstractor.
void addAccessor(TransferElementAbstractor &accessor)
Add a register accessor to the group.
void read()
Trigger read transfer for all accessors in the group.
boost::shared_ptr< DeviceBackend > _backend
uint64_t BaseType
Numeric data type for the key. Must be a valid UserType for the register accessors.
Send backend-specific asynchronous data to different distributors:
Definition SubDomain.h:33
std::shared_ptr< DataConsistencyRealm > _dataConsistencyRealm
TriggeredPollDistributor(boost::shared_ptr< DeviceBackend > backend, boost::shared_ptr< SubDomain< std::nullptr_t > > parent, boost::shared_ptr< Domain > asyncDomain)
ScalarRegisterAccessor< DataConsistencyKey::BaseType > _dataConsistencyKeyAccessor
boost::shared_ptr< SubDomain< std::nullptr_t > > _parent
bool prepareIntermediateBuffers() override
Poll all sync variables.
std::unique_ptr< AsyncVariable > createAsyncVariable(AccessorInstanceDescriptor const &descriptor)
Exception thrown when a runtime error has occured.
Definition Exception.h:18
STL namespace.