An example of the plugin mechanism.
An example of the plugin mechanism. The CustomBackend automatically registers itself to the BackendFactory of the DeviceAccess library.
#include <ChimeraTK/BackendFactory.h>
#include <ChimeraTK/DeviceAccessVersion.h>
#include <ChimeraTK/DummyBackend.h>
#include <boost/make_shared.hpp>
public:
std::string , std::map<std::string, std::string> parameters) {
return boost::make_shared<CustomBackend>(absolutePath);
}
}
};
};
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...
DummyBackend(const std::string &mapFileName, const std::string &dataConsistencyKeyDescriptor="")
static std::string convertPathRelativeToDmapToAbs(std::string const &mapfileName)
static boost::shared_ptr< ChimeraTK::DeviceBackend > createInstance(std::string, std::map< std::string, std::string > parameters)