ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
TransferGroup.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
6
7#include <set>
8
9namespace ChimeraTK {
10
27 public:
34
36 void addAccessor(const boost::shared_ptr<TransferElement>& accessor);
37
39 void read();
40
42 void write(VersionNumber versionNumber = {});
43
48 [[nodiscard]] bool isReadOnly();
49
53 [[nodiscard]] bool isReadable();
54
58 [[nodiscard]] bool isWriteable();
59
64 void dump();
65
66 protected:
71 std::map<boost::shared_ptr<TransferElement>, bool /*hasSeenException*/> _lowLevelElementsAndExceptionFlags;
72
77 std::set<boost::shared_ptr<TransferElement>> _copyDecorators;
78
80 std::set<boost::shared_ptr<TransferElement>> _highLevelElements;
81
83 bool _isReadable{false};
84
86 bool _isWriteable{false};
87
90
93
94 // Helper function to avoid code duplication. Needs to be run for two lists.
95 void runPostReads(const std::set<boost::shared_ptr<TransferElement>>& elements,
96 const std::exception_ptr& firstDetectedRuntimeError);
97
98 // Counter how many runtime errors have been thrown.
100
101 private:
102 void addAccessorImpl(TransferElementAbstractor& accessor, bool isTemporaryAbstractor);
103 };
104
105} /* namespace ChimeraTK */
Base class for register accessors abstractors independent of the UserType.
Group multiple data accessors to efficiently trigger data transfers on the whole group.
std::set< boost::shared_ptr< TransferElement > > _copyDecorators
List of all CopyRegisterDecorators in the group.
void addAccessor(TransferElementAbstractor &accessor)
Add a register accessor to the group.
bool _isReadable
Cached value whether all elements are readable.
bool _isWriteable
Cached value whether all elements are writeable.
std::set< boost::shared_ptr< TransferElement > > _highLevelElements
List of high-level TransferElements in this group which are directly used by the user.
bool _cachedReadableWriteableIsValid
Flag whether to update the cached information.
bool isReadOnly()
Check if transfer group is read-only.
std::map< boost::shared_ptr< TransferElement >, bool > _lowLevelElementsAndExceptionFlags
List of low-level TransferElements in this group, which are directly responsible for the hardware acc...
bool isWriteable()
Check if transfer group is writeable.
bool isReadable()
Check if transfer group is readable.
void dump()
Print information about the accessors in this group to screen, which might help to understand which t...
void updateIsReadableWriteable()
Helper function to update the cached state variables.
void runPostReads(const std::set< boost::shared_ptr< TransferElement > > &elements, const std::exception_ptr &firstDetectedRuntimeError)
void read()
Trigger read transfer for all accessors in the group.
Class for generating and holding version numbers without exposing a numeric representation.