5#include "../ScalarRegisterAccessor.h"
6#include "../TransferGroup.h"
27 template<
typename UserType>
36 boost::shared_ptr<SubDomain<std::nullptr_t>>
_parent;
47 template<
typename UserType>
70 template<
typename UserType>
73 auto synchronousFlags = descriptor.
flags;
76 auto syncAccessor =
_backend->getRegisterAccessor<UserType>(
89 return std::make_unique<PolledAsyncVariable<UserType>>(syncAccessor, *
this);
93 template<
typename UserType>
95 this->_sendBuffer.versionNumber = _owner.getVersion();
96 this->_sendBuffer.dataValidity = !_owner.getForceFaulty() ? _syncAccessor->dataValidity() :
DataValidity::faulty;
97 this->_sendBuffer.value.swap(_syncAccessor->accessChannels());
101 template<
typename UserType>
104 :
AsyncVariableImpl<UserType>(syncAccessor_->getNumberOfChannels(), syncAccessor_->getNumberOfSamples()),
105 _syncAccessor(syncAccessor_), _owner(owner) {}
void remove(AccessMode flag)
Remove the given flag from the set.
N-dimensional register accessor.
Accessor class to read and write scalar registers transparently by using the accessor object like a v...
Group multiple data accessors to efficiently trigger data transfers on the whole group.
void addAccessor(TransferElementAbstractor &accessor)
Add a register accessor to the group.
Class for generating and holding version numbers without exposing a numeric representation.
boost::shared_ptr< Domain > _asyncDomain
boost::shared_ptr< DeviceBackend > _backend
Send backend-specific asynchronous data to different distributors:
The TriggeredPollDistributor has std::nullptr_t source data type and is polling the data for the Asyn...
VersionNumber getVersion() const
std::shared_ptr< DataConsistencyRealm > _dataConsistencyRealm
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)
TransferGroup _transferGroup
bool getForceFaulty() const
VersionNumber _lastVersion
Exception thrown when a runtime error has occured.
@ faulty
The data is considered valid.
@ wait_for_new_data
Make any read blocking until new data has arrived since the last read.
Helper class to have a complete descriton to create an Accessor.
size_t wordOffsetInRegister
AsyncVariableImpl contains a weak pointer to an AsyncNDRegisterAccessor<UserType> and a send buffer N...
Implementation of the PolledAsyncVariable for the concrete UserType.
unsigned int getNumberOfChannels() override
Helper functions for the creation of an AsyncNDRegisterAccessor.
const std::string & getUnit() override
const std::string & getDescription() override
unsigned int getNumberOfSamples() override
TriggeredPollDistributor & _owner
PolledAsyncVariable(boost::shared_ptr< NDRegisterAccessor< UserType > > syncAccessor_, TriggeredPollDistributor &owner)
The constructor takes an already created synchronous accessor and a reference to the owing distributo...
void fillSendBuffer() final
Fill the send buffer with data and version number.
boost::shared_ptr< NDRegisterAccessor< UserType > > _syncAccessor