8using namespace std::string_literals;
27 if(reg.isReadable() && !reg.isWriteable()) {
30 else if(!reg.isReadable() && reg.isWriteable()) {
46 if(interruptID.size() == 1) {
73 std::map<uint64_t, size_t> barSizesInBytes;
75 if(info.elementPitchBits % 8 != 0) {
78 barSizesInBytes[info.bar] = std::max(
79 barSizesInBytes[info.bar],
static_cast<size_t>(info.address + info.nElements * info.elementPitchBits / 8));
81 return barSizesInBytes;
87 if(sizeInBytes %
sizeof(int32_t)) {
94 template<
typename UserType>
99 if(registerPathName.
startsWith(
"DUMMY_INTERRUPT_")) {
104 if(!interruptFound) {
111 shared_from_this(), [
this, interrupt]() {
return triggerInterrupt(interrupt); }, registerPathName,
112 numberOfWords, wordOffsetInRegister, flags);
114 return boost::shared_ptr<NDRegisterAccessor<UserType>>(d);
119 numberOfWords, wordOffsetInRegister, flags);
127 const std::string regPathNameStr{registerPathName};
128 const static std::regex dummyInterruptRegex{DUMMY_INTERRUPT_REGISTER_NAME};
130 std::regex_search(regPathNameStr, match, dummyInterruptRegex);
132 if(not match.empty()) {
136 auto primaryInterrupt =
static_cast<unsigned int>(std::stoul(match[1].str()));
138 if(interruptID.front() == primaryInterrupt) {
139 return {
true, primaryInterrupt};
#define OVERRIDE_VIRTUAL_FUNCTION_TEMPLATE(BaseClass, functionName)
Save the old vtable to be accessible by CALL_BASE_FUNCTION_TEMPLATE and overwrite it with the new imp...
#define CALL_BASE_FUNCTION_TEMPLATE(BaseClass, functionName, templateArgument,...)
Execute the virtual function template call to the base implementation of the function.
Set of AccessMode flags with additional functionality for an easier handling.
std::pair< bool, int > extractControllerInterrupt(const RegisterPath ®isterPathName) const
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.
std::map< uint64_t, size_t > getBarSizesInBytesFromRegisterMapping() const
Determines the size of each bar because the DummyBackends allocate memory per bar.
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.
DummyBackendBase(std::string const &mapFileName, const std::string &dataConsistencyKeyDescriptor="")
The DummyInterruptTriggerAccessor class.
Base class for address-based device backends (e.g.
NumericAddressedRegisterCatalogue & _registerMap
const std::set< std::vector< size_t > > & getListOfInterrupts() const
void addRegister(const NumericAddressedRegisterInfo ®isterInfo)
Access registerAccess
Data access direction: Read, write, read and write or interrupt.
Class to store a register path name.
bool startsWith(const RegisterPath &compare) const
check if the register path starts with the given path
Exception thrown when a logic error has occured.
constexpr auto DUMMY_INTERRUPT_REGISTER_PREFIX
constexpr auto DUMMY_WRITEABLE_SUFFIX
constexpr auto DUMMY_READABLE_SUFFIX
std::string to_string(const std::string &v)