ChimeraTK-DeviceAccess  03.18.00
WrongVersionBackendCompat.cc
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 
4 #include "BackendFactory.h"
5 #include "DummyBackend.h"
6 
7 using namespace ChimeraTK;
8 #define WRONG_VERSION "00.18"
9 
10 // LCOV_EXCL_START these lines cannot be reached because the backend cannot be
11 // registered, thus it is never instantiated
12 struct WrongVersionBackend : public DummyBackend {
14  static boost::shared_ptr<DeviceBackend> createInstance(
15  std::string instance, std::map<std::string, std::string> parameters) {
16  return returnInstance<WrongVersionBackend>(instance, convertPathRelativeToDmapToAbs(parameters.at("map")));
17  }
18 
19  // LCOV_EXCL_STOP The registerern and the version functions have to be called
20 
21  struct BackendRegisterer {
24  "wrongVersionBackendCompat", &WrongVersionBackend::createInstance, {"map"}, WRONG_VERSION);
25  }
26  };
27 };
28 
29 static WrongVersionBackend::BackendRegisterer gWrongVersionBackendRegisterer;
30 
31 extern "C" {
33  return WRONG_VERSION;
34 }
35 }
WrongVersionBackend::BackendRegisterer::BackendRegisterer
BackendRegisterer()
Definition: WrongVersionBackendCompat.cc:22
ChimeraTK::DummyBackend::DummyBackend
DummyBackend(const std::string &mapFileName)
Definition: DummyBackend.cc:17
ChimeraTK::BackendFactory::getInstance
static BackendFactory & getInstance()
Static function to get an instance of factory.
Definition: BackendFactory.cc:191
DummyBackend.h
WrongVersionBackend::BackendRegisterer
Definition: WrongVersionBackend.cc:25
WrongVersionBackend::createInstance
static boost::shared_ptr< DeviceBackend > createInstance(std::string instance, std::map< std::string, std::string > parameters)
Definition: WrongVersionBackendCompat.cc:14
WrongVersionBackend
Definition: WrongVersionBackend.cc:16
BackendRegisterer
Definition: testGenericMuxedInterruptDistributor.cpp:70
BackendFactory.h
WrongVersionBackend::createInstance
static boost::shared_ptr< DeviceBackend > createInstance(std::string address, std::map< std::string, std::string > parameters)
Definition: WrongVersionBackend.cc:18
ChimeraTK::DummyBackend
The dummy device opens a mapping file instead of a device, and implements all registers defined in th...
Definition: DummyBackend.h:45
ChimeraTK::BackendFactory::registerBackendType
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.
Definition: BackendFactory.cc:45
ChimeraTK
Definition: DummyBackend.h:16
deviceAccessVersionUsedToCompile
const char * deviceAccessVersionUsedToCompile()
Definition: WrongVersionBackendCompat.cc:32
WRONG_VERSION
#define WRONG_VERSION
Definition: WrongVersionBackendCompat.cc:8