ChimeraTK-DeviceAccess 03.25.00
Loading...
Searching...
No Matches
WriteCountingBackend.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3#pragma once
4
5#include "DummyBackend.h"
6
7using namespace ChimeraTK;
8
9/**********************************************************************************************************************/
10
13
14 static boost::shared_ptr<DeviceBackend> createInstance(std::string, std::map<std::string, std::string> parameters) {
15 return returnInstance<WriteCountingBackend>(
16 parameters.at("map"), convertPathRelativeToDmapToAbs(parameters.at("map")));
17 }
18
19 size_t writeCount{0};
20
21 void write(uint64_t bar, uint64_t address, int32_t const* data, size_t sizeInBytes) override {
22 ++writeCount;
23 DummyBackend::write(bar, address, data, sizeInBytes);
24 }
25
32};
33
34static WriteCountingBackend::BackendRegisterer gWriteCountingBackendRegisterer;
35
36/**********************************************************************************************************************/
static BackendFactory & getInstance()
Static function to get an instance of factory.
void registerBackendType(const std::string &backendType, boost::shared_ptr< DeviceBackend >(*creatorFunction)(std::string address, std::map< std::string, std::string > parameters), const std::vector< std::string > &sdmParameterNames={}, const std::string &deviceAccessVersion=CHIMERATK_DEVICEACCESS_VERSION)
Register a backend by the name backendType with the given creatorFunction.
The dummy device opens a mapping file instead of a device, and implements all registers defined in th...
void write(uint64_t bar, uint64_t address, int32_t const *data, size_t sizeInBytes) override
Write function to be implemented by backends.
DummyBackend(const std::string &mapFileName, const std::string &dataConsistencyKeyDescriptor="")
static std::string convertPathRelativeToDmapToAbs(std::string const &mapfileName)
void write(uint64_t bar, uint64_t address, int32_t const *data, size_t sizeInBytes) override
Write function to be implemented by backends.
static boost::shared_ptr< DeviceBackend > createInstance(std::string, std::map< std::string, std::string > parameters)