ChimeraTK-DeviceAccess
03.18.00
|
Group multiple data accessors to efficiently trigger data transfers on the whole group. More...
#include <TransferGroup.h>
Public Member Functions | |
void | addAccessor (TransferElementAbstractor &accessor) |
Add a register accessor to the group. More... | |
void | addAccessor (const boost::shared_ptr< TransferElement > &accessor) |
See the other signature of addAccessor() More... | |
void | read () |
Trigger read transfer for all accessors in the group. More... | |
void | write (VersionNumber versionNumber={}) |
Trigger write transfer for all accessors in the group. More... | |
bool | isReadOnly () |
Check if transfer group is read-only. More... | |
bool | isReadable () |
Check if transfer group is readable. More... | |
bool | isWriteable () |
Check if transfer group is writeable. More... | |
void | dump () |
Print information about the accessors in this group to screen, which might help to understand which transfers were merged and which were not. More... | |
Protected Member Functions | |
void | updateIsReadableWriteable () |
Helper function to update the cached state variables. More... | |
void | runPostReads (const std::set< boost::shared_ptr< TransferElement >> &elements, const std::exception_ptr &firstDetectedRuntimeError) noexcept |
Protected Attributes | |
std::map< boost::shared_ptr< TransferElement >, bool > | _lowLevelElementsAndExceptionFlags |
List of low-level TransferElements in this group, which are directly responsible for the hardware access, and a flag whether there has been an exception in pre-read. More... | |
std::set< boost::shared_ptr< TransferElement > > | _copyDecorators |
List of all CopyRegisterDecorators in the group. More... | |
std::set< boost::shared_ptr< TransferElement > > | _highLevelElements |
List of high-level TransferElements in this group which are directly used by the user. More... | |
std::set< boost::shared_ptr< DeviceBackend > > | _exceptionBackends |
List of all exception backends. More... | |
bool | _isReadable {false} |
Cached value whether all elements are readable. More... | |
bool | _isWriteable {false} |
Cached value whether all elements are writeable. More... | |
bool | _cachedReadableWriteableIsValid {false} |
Flag whether to update the cached information. More... | |
size_t | _nRuntimeErrors |
Group multiple data accessors to efficiently trigger data transfers on the whole group.
In case of some backends like the LogicalNameMappingBackend, grouping data accessors can avoid unnecessary transfers of the same data. This happens in particular, if accessing the data of one accessor requires transfer of a bigger block of data containing also data of another accessor (e.g. channel accessors for multiplexed 2D registers).
Note that read() and write() of the accessors put into the group can no longer be used. Instead, read() and write() of the TransferGroup should be called.
Important note: If accessors pointing to the same values are added to the TransferGroup, the behaviour will be undefined when writing. Depending on the backend and on the exact scenario, the accessors might appear like a copy sharing the internal buffers, thus writing to one accessor may (or may not) change the content of the other. Also calling write() has then undefined behaviour, since it is not defined from which accessor the values will be written to the device (maybe both in an undefined order).
Definition at line 26 of file TransferGroup.h.
void ChimeraTK::TransferGroup::addAccessor | ( | const boost::shared_ptr< TransferElement > & | accessor | ) |
See the other signature of addAccessor()
Definition at line 297 of file TransferGroup.cc.
void ChimeraTK::TransferGroup::addAccessor | ( | TransferElementAbstractor & | accessor | ) |
Add a register accessor to the group.
The register accessor might internally be altered so that accessors accessing the same hardware register will share their buffers. Register accessors must not be placed into multiple TransferGroups.
Definition at line 305 of file TransferGroup.cc.
void ChimeraTK::TransferGroup::dump | ( | ) |
Print information about the accessors in this group to screen, which might help to understand which transfers were merged and which were not.
Definition at line 323 of file TransferGroup.cc.
bool ChimeraTK::TransferGroup::isReadable | ( | ) |
Check if transfer group is readable.
A transfer group is readable, if all its transfer elements are readable.
Definition at line 192 of file TransferGroup.cc.
bool ChimeraTK::TransferGroup::isReadOnly | ( | ) |
Check if transfer group is read-only.
A transfer group is read-only, if at least one of its transfer elements is read-only.
Definition at line 186 of file TransferGroup.cc.
bool ChimeraTK::TransferGroup::isWriteable | ( | ) |
Check if transfer group is writeable.
A transfer group is writeable, if all its transfer elements are writeable.
Definition at line 201 of file TransferGroup.cc.
void ChimeraTK::TransferGroup::read | ( | ) |
Trigger read transfer for all accessors in the group.
Definition at line 44 of file TransferGroup.cc.
|
protectednoexcept |
|
protected |
Helper function to update the cached state variables.
Definition at line 311 of file TransferGroup.cc.
void ChimeraTK::TransferGroup::write | ( | VersionNumber | versionNumber = {} | ) |
Trigger write transfer for all accessors in the group.
Definition at line 123 of file TransferGroup.cc.
|
protected |
Flag whether to update the cached information.
Definition at line 95 of file TransferGroup.h.
|
protected |
List of all CopyRegisterDecorators in the group.
On these elements, postRead() has to be executed before all other elements.
Definition at line 77 of file TransferGroup.h.
|
protected |
List of all exception backends.
We check on them whether they are opened, and we want to do it for all accessors of the same backend just once.
Definition at line 86 of file TransferGroup.h.
|
protected |
List of high-level TransferElements in this group which are directly used by the user.
Definition at line 80 of file TransferGroup.h.
|
protected |
Cached value whether all elements are readable.
Definition at line 89 of file TransferGroup.h.
|
protected |
Cached value whether all elements are writeable.
Definition at line 92 of file TransferGroup.h.
|
protected |
List of low-level TransferElements in this group, which are directly responsible for the hardware access, and a flag whether there has been an exception in pre-read.
Definition at line 71 of file TransferGroup.h.
|
protected |
Definition at line 105 of file TransferGroup.h.