5#include "DeviceAccessVersion.h"
9#include <boost/function.hpp>
49 boost::shared_ptr<DeviceBackend> (*creatorFunction)(
50 std::string address, std::map<std::string, std::string> parameters),
51 const std::vector<std::string>& sdmParameterNames = {},
52 const std::string& deviceAccessVersion = CHIMERATK_DEVICEACCESS_VERSION);
58 [[deprecated]]
void registerBackendType(
const std::string& interface,
const std::string& protocol,
59 boost::shared_ptr<DeviceBackend> (*creatorFunction)(
60 std::string host, std::string instance, std::list<std::string> parameters, std::string mapFileName),
61 const std::string& version);
67 boost::shared_ptr<DeviceBackend>
createBackend(
const std::string& aliasOrUri);
82 boost::function<boost::shared_ptr<DeviceBackend>(
83 std::string address, std::map<std::string, std::string> parameters)>>
88 std::map<std::pair<std::string, std::string>,
89 boost::function<boost::shared_ptr<DeviceBackend>(
90 std::string host, std::string instance, std::list<std::string> parameters, std::string mapFileName)>>
94 std::string
aliasLookUp(std::string aliasName, std::string dmapFilePath);
112 std::list<std::string> parameters, std::string mapFileName, std::string exception_what);
BackendFactory is a the factory class to create devices.
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.
std::mutex _mutex
A mutex to protect backend creation and returning to keep the maps consistent.
std::map< std::string, boost::weak_ptr< DeviceBackend > > _existingBackends
A map of all created backends.
boost::shared_ptr< DeviceBackend > createBackendInternal(const DeviceInfoMap::DeviceInfo &deviceInfo)
Internal function to return a DeviceBackend.
void setDMapFilePath(std::string dMapFilePath)
This function sets the _DMapFilePath.
bool called_registerBackendType
Flag whether the function registerBackendType() was called.
std::map< std::pair< std::string, std::string >, boost::function< boost::shared_ptr< DeviceBackend >(std::string host, std::string instance, std::list< std::string > parameters, std::string mapFileName)> > creatorMap_compat
Compatibility creatorMap for old-style backends which just take a plain list of parameters.
boost::shared_ptr< DeviceBackend > createBackend(const std::string &aliasOrUri)
Create a new backend and return the instance as a shared pointer.
std::string getDMapFilePath()
Returns the _DMapFilePath.
void loadPluginLibrary(const std::string &soFile)
Load a shared library (.so file) with a Backend at run time.
std::string aliasLookUp(std::string aliasName, std::string dmapFilePath)
Look for the alias and if found return a uri.
static boost::shared_ptr< DeviceBackend > failedRegistrationThrowerFunction(std::string host, std::string instance, std::list< std::string > parameters, std::string mapFileName, std::string exception_what)
std::string _dMapFile
The dmap file set at run time.
std::map< std::string, boost::function< boost::shared_ptr< DeviceBackend >(std::string address, std::map< std::string, std::string > parameters)> > creatorMap
Holds device type and function pointer to the createInstance function of plugin.
void loadAllPluginsFromDMapFile()
Load all shared libraries specified in the dmap file.
Stores information about one device.