40#ifndef _uhal_ClientFactory_hpp_
41#define _uhal_ClientFactory_hpp_
46#include <unordered_map>
58 UHAL_DEFINE_EXCEPTION_CLASS ( ProtocolDoesNotExist ,
"Exception class to handle the case where the protocol requested does not exists in the creator map." )
102 std::shared_ptr<ClientInterface> getClient (
const std::string& aId ,
const std::string& aUri );
111 std::shared_ptr<ClientInterface> getClient (
const std::string& aId ,
const std::string& aUri,
const std::vector<std::string>& aUserClientActivationList );
119 void registerClient (
const std::string& aProtocol ,
const std::string& aDescription =
"" );
127 static bool init(
const std::string& aUri,
const std::string& aDescription);
138 void add (
const std::string& aProtocol ,
const std::string& aDescription,
bool aUserDefined );
160 virtual std::shared_ptr<ClientInterface>
create (
const std::string& aId ,
const URI& aUri ) = 0;
185 std::shared_ptr<ClientInterface> create (
const std::string& aId ,
const URI& aUri );
205#define UHAL_REGISTER_EXTERNAL_CLIENT(clientclass, clienturi, clientdescription) \
206 template<> bool uhal::ClientFactory::RegistrationHelper<clientclass>::sInitialised = \
207 uhal::ClientFactory::RegistrationHelper<clientclass>::init(clienturi, clientdescription);
Wrapper to generate a new Python exception type.
\rst Holds a reference to a Python object (no reference counting)
Templated concrete implementation with a CreatorInterface interface.
virtual ~Creator()
Destructor.
Creator()
Default constructor.
An abstract base class for defining the interface to the creators.
virtual std::shared_ptr< ClientInterface > create(const std::string &aId, const URI &aUri)=0
Interface to a function which create a new IPbus client based on the protocol identifier specified.
CreatorInterface()
Default constructor.
virtual ~CreatorInterface()
Destructor.
static bool sInitialised
Dummy variable required as initialisation target.
A class to construct an IPbus client based on the protocol identifier specified NOTE!...
ClientFactory & operator=(const ClientFactory &)=delete
std::unordered_map< std::string, ClientInfo > mClientMap
Hash map associating a creator for a particular protocol with a file name.
ClientFactory(const ClientFactory &)=delete
static std::shared_ptr< ClientFactory > mInstance
The single instance of the class.
#define UHAL_DEFINE_EXCEPTION_CLASS(ClassName, ClassDescription)
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...
std::shared_ptr< CreatorInterface > creator
Struct to store a URI when parsed by boost spirit.