![]() |
ChimeraTK-DeviceAccess 03.20.00
|
Group several registers (= TransferElement) which ensures data consistency across multiple variables through an algorithm which matches the VersionNumber. More...
#include <DataConsistencyGroup.h>
Public Types | |
enum class | MatchingMode { none , exact , historized } |
Enum describing the matching mode of a DataConsistencyGroup. More... | |
Public Member Functions | |
DataConsistencyGroup (MatchingMode mode=MatchingMode::exact) | |
Construct empty group. | |
~DataConsistencyGroup () | |
DataConsistencyGroup (const DataConsistencyGroup &other)=delete | |
DataConsistencyGroup (DataConsistencyGroup &&other) noexcept | |
DataConsistencyGroup & | operator= (DataConsistencyGroup &&other) noexcept |
DataConsistencyGroup (std::initializer_list< TransferElementAbstractor > list) | |
Construct this group with elements from the list using the add() function. | |
DataConsistencyGroup (std::initializer_list< boost::shared_ptr< TransferElement > > list) | |
DataConsistencyGroup (std::initializer_list< std::reference_wrapper< TransferElementAbstractor > > list, MatchingMode mode, unsigned histLen=defaultHistLen) | |
template<typename ITERATOR > | |
DataConsistencyGroup (ITERATOR first, ITERATOR last, MatchingMode mode=MatchingMode::exact, unsigned int histLen=defaultHistLen) | |
void | add (const TransferElementAbstractor &element) |
Add register to group. | |
void | add (boost::shared_ptr< TransferElement > element) |
void | add (TransferElementAbstractor &acc, unsigned histLen=defaultHistLen) |
Add register to group. | |
bool | update (const TransferElementID &transferElementID) |
This function must be called after an update was received from the ReadAnyGroup. | |
void | setMatchingMode (MatchingMode newMode) |
Change the matching mode. | |
MatchingMode | getMatchingMode () const |
Return the current matching mode. | |
const std::map< TransferElementID, TransferElementAbstractor > & | getElements () const |
For inspection of contents. | |
const DataConsistencyGroupDetail::MatcherBase & | getMatcher () |
For diagnostics. | |
bool | isConsistent () const |
returns true if consistent state is reached | |
Static Public Attributes | |
static constexpr unsigned | defaultHistLen = 2 |
Group several registers (= TransferElement) which ensures data consistency across multiple variables through an algorithm which matches the VersionNumber.
This group does not read on its own. It should work together with a ReadAnyGroup. This is a proxy class, which delegates to two different implementations. MatchingMode=exact is handled by SimpleMatcher (the legacy DataConsistencyGroup implementation). For this, you should wait for changed variable and transfer it to this group by calling DataConsistencyGroup::update. If a consistent state is reached, this function returns true. MatchingMode=historized is handled by HistorizedMatcher. In this case, the provided accessors are decorated with DataConsistencyDecorators, with the effect that the readAny() returns only on consistent inputs. In this mode, it is unnecessary but still allowed to call DataConsistencyGroup::update and it simply returns true.
Definition at line 27 of file DataConsistencyGroup.h.
|
strong |
Enum describing the matching mode of a DataConsistencyGroup.
Enumerator | |
---|---|
none | No matching, effectively disable the DataConsitencyGroup. update() will always return true. |
exact | Require an exact match of the VersionNumber of all current values of the group's members. Require an exact match of the VersionNumber of all current or historized values of the group's members |
historized |
Definition at line 30 of file DataConsistencyGroup.h.
|
explicit |
Construct empty group.
Elements can later be added using the add() function.
Definition at line 24 of file DataConsistencyGroup.cc.
|
default |
|
delete |
|
defaultnoexcept |
ChimeraTK::DataConsistencyGroup::DataConsistencyGroup | ( | std::initializer_list< TransferElementAbstractor > | list | ) |
Construct this group with elements from the list using the add() function.
Definition at line 38 of file DataConsistencyGroup.cc.
ChimeraTK::DataConsistencyGroup::DataConsistencyGroup | ( | std::initializer_list< boost::shared_ptr< TransferElement > > | list | ) |
Definition at line 51 of file DataConsistencyGroup.cc.
ChimeraTK::DataConsistencyGroup::DataConsistencyGroup | ( | std::initializer_list< std::reference_wrapper< TransferElementAbstractor > > | list, |
MatchingMode | mode, | ||
unsigned | histLen = defaultHistLen |
||
) |
Definition at line 64 of file DataConsistencyGroup.cc.
ChimeraTK::DataConsistencyGroup::DataConsistencyGroup | ( | ITERATOR | first, |
ITERATOR | last, | ||
MatchingMode | mode = MatchingMode::exact , |
||
unsigned int | histLen = defaultHistLen |
||
) |
Definition at line 107 of file DataConsistencyGroup.h.
void ChimeraTK::DataConsistencyGroup::add | ( | boost::shared_ptr< TransferElement > | element | ) |
Definition at line 88 of file DataConsistencyGroup.cc.
void ChimeraTK::DataConsistencyGroup::add | ( | const TransferElementAbstractor & | element | ) |
Add register to group.
The same TransferElement can be part of multiple DataConsistencyGroups. The register must be must be readable, and it must have AccessMode::wait_for_new_data.
Definition at line 77 of file DataConsistencyGroup.cc.
void ChimeraTK::DataConsistencyGroup::add | ( | TransferElementAbstractor & | acc, |
unsigned | histLen = defaultHistLen |
||
) |
Add register to group.
The same TransferElement can be part of multiple DataConsistencyGroups. The register must be must be readable, and it must have AccessMode::wait_for_new_data. This function may modify the register accessor, placing a DataConsistencyDecorator around it.
Definition at line 110 of file DataConsistencyGroup.cc.
const std::map< TransferElementID, TransferElementAbstractor > & ChimeraTK::DataConsistencyGroup::getElements | ( | ) | const |
For inspection of contents.
Definition at line 156 of file DataConsistencyGroup.cc.
const DataConsistencyGroupDetail::MatcherBase & ChimeraTK::DataConsistencyGroup::getMatcher | ( | ) |
For diagnostics.
Definition at line 162 of file DataConsistencyGroup.cc.
|
inline |
Return the current matching mode.
Definition at line 84 of file DataConsistencyGroup.h.
bool ChimeraTK::DataConsistencyGroup::isConsistent | ( | ) | const |
returns true if consistent state is reached
Definition at line 168 of file DataConsistencyGroup.cc.
|
defaultnoexcept |
void ChimeraTK::DataConsistencyGroup::setMatchingMode | ( | MatchingMode | newMode | ) |
Change the matching mode.
The default mode is MatchingMode::exact, if not set differently in constructor. This method is deprecated since it's not possible to set MatchingMode::historized like this.
Definition at line 144 of file DataConsistencyGroup.cc.
bool ChimeraTK::DataConsistencyGroup::update | ( | const TransferElementID & | transferElementID | ) |
This function must be called after an update was received from the ReadAnyGroup.
It returns true, if a consistent state is reached. It returns false if an TransferElementID was updated, that was not added to this group. For MatchingMode::historized, readAny will only let through consistent updates, so then update always returns true.
Definition at line 122 of file DataConsistencyGroup.cc.
|
staticconstexpr |
Definition at line 36 of file DataConsistencyGroup.h.