5#include "../DeviceBackend.h"
6#include "../NDRegisterAccessor.h"
9#include <ChimeraTK/cppext/finally.hpp>
10#include <ChimeraTK/cppext/future_queue.hpp>
14 class AsyncAccessorManager;
22 template<
typename UserType>
24 static constexpr size_t _queueSize{3};
31 AsyncNDRegisterAccessor(boost::shared_ptr<DeviceBackend> backend, boost::shared_ptr<AsyncAccessorManager> manager,
32 boost::shared_ptr<Domain> asyncDomain, std::string
const& name,
size_t nChannels,
size_t nElements,
34 std::string
const& description = std::string());
83 [[nodiscard]]
bool isReadable()
const override {
return true; }
84 [[nodiscard]]
bool isWriteable()
const override {
return false; }
91 return {boost::enable_shared_from_this<TransferElement>::shared_from_this()};
#define DECLARE_TEMPLATE_FOR_CHIMERATK_USER_TYPES(TemplateClass)
Set of AccessMode flags with additional functionality for an easier handling.
N-dimensional register accessor.
std::vector< std::vector< UserType > > buffer_2D
Buffer of converted data elements.
void interrupt_impl(QUEUE_TYPE &dataTransportQueue)
Implementation of interrupt()
static constexpr char unitNotSet[]
Constant string to be used as a unit when the unit is not provided or known.
const std::string & getName() const
Returns the name that identifies the process variable.
boost::shared_ptr< DeviceBackend > _exceptionBackend
The backend to which the runtime_errors are reported via DeviceBackend::setException().
Class for generating and holding version numbers without exposing a numeric representation.
The AsyncNDRegisterAccessor implements a data transport queue with typed data as continuation of the ...
boost::shared_ptr< AsyncAccessorManager > _accessorManager
void doPreRead(TransferType type) override
Backend specific implementation of preRead().
boost::shared_ptr< DeviceBackend > _backend
void doPostRead(TransferType type, bool updateDataBuffer) override
Backend specific implementation of postRead().
bool doWriteTransfer(ChimeraTK::VersionNumber versionNumber) override
Implementation version of writeTransfer().
bool isReadOnly() const override
Check if transfer element is read only, i.e.
void setExceptionBackend(boost::shared_ptr< DeviceBackend > exceptionBackend) override
Set the backend to which the exception has to be reported.
void replaceTransferElement(boost::shared_ptr< TransferElement >) override
Search for all underlying TransferElements which are considered identical (see sameRegister()) with t...
void sendException(std::exception_ptr &e)
Pushes the exception to the queue.
bool doWriteTransferDestructively(ChimeraTK::VersionNumber versionNumber) override
Implementation version of writeTransferDestructively().
void doReadTransferSynchronously() override
Implementation version of readTransfer() for synchronous reads.
std::vector< boost::shared_ptr< TransferElement > > getHardwareAccessingElements() override
Obtain the underlying TransferElements with actual hardware access.
~AsyncNDRegisterAccessor() override
bool isReadable() const override
Check if transfer element is readable.
void doPreWrite(TransferType type, VersionNumber versionNumber) override
Backend specific implementation of preWrite().
void sendDestructively(typename NDRegisterAccessor< UserType >::Buffer &data)
You can only send destructively.
std::list< boost::shared_ptr< TransferElement > > getInternalElements() override
Obtain the full list of TransferElements internally used by this TransferElement.
bool isWriteable() const override
Check if transfer element is writeable.
boost::shared_ptr< Domain > _asyncDomain
void interrupt() override
Return from a blocking read immediately and throw boost::thread_interrupted.
cppext::future_queue< Buffer, cppext::SWAP_DATA > _dataTransportQueue
Exception thrown when a logic error has occured.
TransferType
Used to indicate the applicable operation on a Transferelement.
Data type to create individual buffers.