ChimeraTK-DeviceAccess
03.18.00
|
The base class for backends providing IO functionality for the Device class. More...
#include <DeviceBackend.h>
Public Member Functions | |
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 bool | isOpen ()=0 |
Return whether a device has been opened or not. More... | |
virtual bool | isConnected ()=0 |
Deprecated since 2022-03-03. More... | |
virtual bool | isFunctional () const noexcept=0 |
Return whether a device is working as intended, usually this means it is opened and does not have any errors. More... | |
virtual RegisterCatalogue | getRegisterCatalogue () const =0 |
Return the register catalogue with detailed information on all registers. More... | |
virtual MetadataCatalogue | getMetadataCatalogue () const =0 |
Return the device metadata catalogue. 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 | setException (const std::string &message) noexcept=0 |
Set the backend into an exception state. More... | |
virtual void | activateAsyncRead () noexcept |
Activate asyncronous read for all transfer elements where AccessMode::wait_for_new_data is set. More... | |
virtual void | checkActiveException ()=0 |
Function to be called by backends when needing to check for an active exception. More... | |
The base class for backends providing IO functionality for the Device class.
Note that most backends should actually be based on the DeviceBackendImpl class (unless it is a decorator backend). The actual IO is always performed through register accessors, which is obtained through the getBufferingRegisterAccessor() member function.
Definition at line 28 of file DeviceBackend.h.
|
virtualdefault |
Every virtual class needs a virtual desctructor.
|
inlinevirtualnoexcept |
Activate asyncronous read for all transfer elements where AccessMode::wait_for_new_data is set.
If Device::activateAsyncRead() is called while the device is not opened or has an error, this call has no effect. If it is called when no deactivated transfer element exists, this call also has no effect. When Device::activateAsyncRead() returns, it is not guaranteed that all initial values have been received already.
For more details, see Technical specification: TransferElement B.8.5.
Reimplemented in ChimeraTK::SubdeviceBackend, ChimeraTK::NumericAddressedBackend, ChimeraTK::ExceptionDummy, and ChimeraTK::LogicalNameMappingBackend.
Definition at line 97 of file DeviceBackend.h.
|
pure virtual |
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.
Implemented in ChimeraTK::DeviceBackendImpl.
|
pure virtual |
ChimeraTK::DeviceBackend::DEFINE_VIRTUAL_FUNCTION_TEMPLATE_VTABLE | ( | getRegisterAccessor_impl | , |
boost::shared_ptr< NDRegisterAccessor< T >> | const RegisterPath &, size_t, size_t, AccessModeFlags | ||
) |
|
pure virtual |
Return the device metadata catalogue.
Implemented in ChimeraTK::NumericAddressedBackend, ChimeraTK::SubdeviceBackend, and ChimeraTK::DeviceBackendImpl.
boost::shared_ptr< NDRegisterAccessor< UserType > > ChimeraTK::DeviceBackend::getRegisterAccessor | ( | const RegisterPath & | registerPathName, |
size_t | numberOfWords, | ||
size_t | wordOffsetInRegister, | ||
AccessModeFlags | flags | ||
) |
Get a NDRegisterAccessor object from the register name.
Definition at line 109 of file DeviceBackend.h.
|
pure virtual |
Return the register catalogue with detailed information on all registers.
Implemented in ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::ExceptionReportingBackend, ChimeraTK::NumericAddressedBackend, ChimeraTK::SubdeviceBackend, AsyncTestDummy, and ChimeraTK::LogicalNameMappingBackend.
|
pure virtual |
|
pure virtualnoexcept |
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.
Implemented in ChimeraTK::DeviceBackendImpl.
|
pure virtual |
Return whether a device has been opened or not.
Implemented in ChimeraTK::XdmaBackend, and ChimeraTK::DeviceBackendImpl.
|
pure virtual |
Open the device.
Implemented in ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::ExceptionReportingBackend, AsyncTestDummy, ChimeraTK::PcieBackend, ChimeraTK::RebotBackend, ChimeraTK::SubdeviceBackend, ChimeraTK::SharedDummyBackend, ChimeraTK::DummyBackend, ChimeraTK::XdmaBackend, ChimeraTK::ExceptionDummy, ChimeraTK::UioBackend, and ChimeraTK::LogicalNameMappingBackend.
|
pure virtual |
Return a device information string containing hardware details like the firmware version number or the slot number used by the board.
The format and contained information of this string is completely backend implementation dependent, so the string may only be printed to the user as an informational output. Do not try to parse this string or extract information from it programmatically.
Implemented in ChimeraTK::UnifiedBackendTest< VECTOR_OF_REGISTERS_T >::ExceptionReportingBackend, ChimeraTK::PcieBackend, ChimeraTK::RebotBackend, ChimeraTK::DummyBackend, ChimeraTK::SubdeviceBackend, ChimeraTK::SharedDummyBackend, ChimeraTK::XdmaBackend, ChimeraTK::UioBackend, AsyncTestDummy, and ChimeraTK::LogicalNameMappingBackend.
|
pure virtualnoexcept |
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.
Implemented in ChimeraTK::DeviceBackendImpl.