ChimeraTK-DeviceAccess
03.18.00
|
DeviceBackendImpl implements some basic functionality which should be available for all backends. More...
#include <DeviceBackendImpl.h>
Public Member Functions | |
bool | isOpen () override |
Return whether a device has been opened or not. More... | |
bool | isConnected () final |
Deprecated since 2022-03-03. More... | |
MetadataCatalogue | getMetadataCatalogue () const override |
Return the device metadata catalogue. More... | |
virtual void | setExceptionImpl () noexcept |
Function to be (optionally) implemented by backends if additional actions are needed when switching to the exception state. More... | |
void | checkActiveException () final |
Function to be called by backends when needing to check for an active exception. More... | |
void | setException (const std::string &message) noexcept final |
Set the backend into an exception state. More... | |
bool | isFunctional () const noexcept final |
Return whether a device is working as intended, usually this means it is opened and does not have any errors. More... | |
std::string | getActiveExceptionMessage () noexcept |
Public Member Functions inherited from ChimeraTK::DeviceBackend | |
virtual | ~DeviceBackend ()=default |
Every virtual class needs a virtual desctructor. More... | |
virtual void | open ()=0 |
Open the device. More... | |
virtual void | close ()=0 |
Close the device. More... | |
virtual RegisterCatalogue | getRegisterCatalogue () const =0 |
Return the register catalogue with detailed information on all registers. More... | |
template<typename UserType > | |
boost::shared_ptr< NDRegisterAccessor< UserType > > | getRegisterAccessor (const RegisterPath ®isterPathName, size_t numberOfWords, size_t wordOffsetInRegister, AccessModeFlags flags) |
Get a NDRegisterAccessor object from the register name. More... | |
DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE (getRegisterAccessor_impl, boost::shared_ptr< NDRegisterAccessor< T >>(const RegisterPath &, size_t, size_t, AccessModeFlags)) | |
virtual std::string | readDeviceInfo ()=0 |
Return a device information string containing hardware details like the firmware version number or the slot number used by the board. More... | |
virtual void | activateAsyncRead () noexcept |
Activate asyncronous read for all transfer elements where AccessMode::wait_for_new_data is set. More... | |
Protected Member Functions | |
void | setOpenedAndClearException () noexcept |
Backends should call this function at the end of a (successful) open() call. More... | |
Protected Attributes | |
std::atomic< bool > | _opened {false} |
flag if backend is opened More... | |
async::DomainsContainer | _asyncDomainsContainer |
Container for async::Domains to support wait_for_new_data. More... | |
DeviceBackendImpl implements some basic functionality which should be available for all backends.
This is required to allow proper decorator patterns which should not have this functionality in the decorator itself.
Definition at line 25 of file DeviceBackendImpl.h.
|
inlinefinalvirtual |
Function to be called by backends when needing to check for an active exception.
If an active exception is found, the appropriate ChimeraTK::runtime_error is thrown by this function.
Implements ChimeraTK::DeviceBackend.
Definition at line 94 of file DeviceBackendImpl.h.
|
noexcept |
|
inlineoverridevirtual |
Return the device metadata catalogue.
Implements ChimeraTK::DeviceBackend.
Reimplemented in ChimeraTK::NumericAddressedBackend.
Definition at line 35 of file DeviceBackendImpl.h.
|
inlinefinalvirtual |
Deprecated since 2022-03-03.
Do not use.
Implements ChimeraTK::DeviceBackend.
Definition at line 29 of file DeviceBackendImpl.h.
|
inlinefinalvirtualnoexcept |
Return whether a device is working as intended, usually this means it is opened and does not have any errors.
The default implementation in DeviceBackendImpl reports (_opened && !_hasErrors). Backends can overload it to implement a more sophisticated error reporting. The implementation might involve a communication attempt with the device.
Notice: isFunctional() shall only return false if there are known errors (or the device is closed). If the working state is unknown, the response should be true
. Client code will then try to read/write and might get an exception, while isFunctional()==false means you surely will get an exception.
Implements ChimeraTK::DeviceBackend.
Definition at line 85 of file DeviceBackendImpl.h.
|
inlineoverridevirtual |
Return whether a device has been opened or not.
Implements ChimeraTK::DeviceBackend.
Definition at line 27 of file DeviceBackendImpl.h.
|
finalvirtualnoexcept |
Set the backend into an exception state.
All backends must remember this, turn off asyncronous reads and all accessors will throw a ChimeraTK::runtime_error on read and write operations with the provided message string, until open() has been called successfully.
Implements ChimeraTK::DeviceBackend.
Definition at line 26 of file DeviceBackendImpl.cc.
|
inlinevirtualnoexcept |
Function to be (optionally) implemented by backends if additional actions are needed when switching to the exception state.
Reimplemented in ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::ExceptionReportingBackend, ChimeraTK::SubdeviceBackend, ChimeraTK::NumericAddressedBackend, AsyncTestDummy, ChimeraTK::ExceptionDummy, and ChimeraTK::LogicalNameMappingBackend.
Definition at line 41 of file DeviceBackendImpl.h.
|
protectednoexcept |
Backends should call this function at the end of a (successful) open() call.
Definition at line 12 of file DeviceBackendImpl.cc.
|
protected |
Container for async::Domains to support wait_for_new_data.
Used here to handle exception distribution.
Definition at line 66 of file DeviceBackendImpl.h.
|
protected |
flag if backend is opened
Definition at line 60 of file DeviceBackendImpl.h.