14#define TRY_REGISTER_ACCESS(COMMAND) \
18 catch(std::out_of_range & outOfRangeException) { \
19 std::stringstream errorMessage; \
20 errorMessage << "Invalid address offset " << address << " in bar " << bar << "." \
21 << "Caught out_of_range exception: " << outOfRangeException.what(); \
22 std::cout << errorMessage.str() << std::endl; \
23 throw ChimeraTK::logic_error(errorMessage.str()); \
32 explicit DummyBackendBase(std::string
const& mapFileName,
const std::string& dataConsistencyKeyDescriptor =
"");
54 void read([[maybe_unused]] uint8_t bar, [[maybe_unused]] uint32_t address, [[maybe_unused]] int32_t* data,
55 [[maybe_unused]]
size_t sizeInBytes)
final {
62 void write([[maybe_unused]] uint8_t bar, [[maybe_unused]] uint32_t address, [[maybe_unused]] int32_t
const* data,
63 [[maybe_unused]]
size_t sizeInBytes)
final {
81 template<
typename UserType>
100 template<
typename T,
typename... Args>
102 [[maybe_unused]]
const std::string& instanceId, Args&&... arguments) {
103 return boost::make_shared<T>(std::forward<Args>(arguments)...);
Set of AccessMode flags with additional functionality for an easier handling.
Base class for DummyBackends, provides common functionality.
std::pair< bool, int > extractControllerInterrupt(const RegisterPath ®isterPathName) const
std::atomic< bool > throwExceptionWrite
boost::shared_ptr< NDRegisterAccessor< UserType > > getRegisterAccessor_impl(const RegisterPath ®isterPathName, size_t numberOfWords, size_t wordOffsetInRegister, AccessModeFlags flags)
Specific override which allows to create "DUMMY_INTEERRUPT_X" accessors.
static void checkSizeIsMultipleOfWordSize(size_t sizeInBytes)
size_t minimumTransferAlignment(uint64_t bar) const override
Determines the supported minimum alignment for any read/write requests.
void write(uint8_t bar, uint32_t address, int32_t const *data, size_t sizeInBytes) final
You cannot override the write version with 32 bit address any more.
static boost::shared_ptr< DeviceBackend > returnInstance(const std::string &instanceId, Args &&... arguments)
Backward compatibility: Leftover from the time when the dummy managed it's own map to return the same...
std::map< uint64_t, size_t > getBarSizesInBytesFromRegisterMapping() const
Determines the size of each bar because the DummyBackends allocate memory per bar.
void read(uint8_t bar, uint32_t address, int32_t *data, size_t sizeInBytes) final
You cannot override the read version with 32 bit address any more.
std::atomic< bool > throwExceptionRead
virtual VersionNumber triggerInterrupt(uint32_t interruptNumber)=0
Simulate the arrival of an interrupt.
bool barIndexValid(uint64_t bar) override
All bars are valid in dummies.
std::atomic< size_t > throwExceptionCounter
DEFINE_VIRTUAL_FUNCTION_OVERRIDE_VTABLE(NumericAddressedBackend, getRegisterAccessor_impl, boost::shared_ptr< NDRegisterAccessor< T > >(const RegisterPath &, size_t, size_t, AccessModeFlags))
std::atomic< bool > throwExceptionOpen
~DummyBackendBase() override=default
N-dimensional register accessor.
Base class for address-based device backends (e.g.
Class to store a register path name.
Class for generating and holding version numbers without exposing a numeric representation.