A class to construct an IPbus client based on the protocol identifier specified NOTE! This is a factory method and must be Mutex protected if it is used in multithreaded environments! More...
#include <uhal/ClientFactory.hpp>
Classes | |
struct | ClientInfo |
class | Creator |
Templated concrete implementation with a CreatorInterface interface. More... | |
class | CreatorInterface |
An abstract base class for defining the interface to the creators. More... | |
class | RegistrationHelper |
Public Member Functions | |
virtual | ~ClientFactory () |
Destructor. More... | |
boost::shared_ptr< ClientInterface > | getClient (const std::string &aId, const std::string &aUri) |
Construct an IPbus client based on the protocol identifier specified. More... | |
boost::shared_ptr< ClientInterface > | getClient (const std::string &aId, const std::string &aUri, const std::vector< std::string > &aUserClientActivationList) |
Construct an IPbus client based on the protocol identifier specified. More... | |
template<class T > | |
void | registerClient (const std::string &aProtocol, const std::string &aDescription="") |
Method to create an associate between a protocol identifier and a Creator of a particular type. More... | |
Static Public Member Functions | |
static ClientFactory & | getInstance () |
Static method to retrieve the single instance of the class. More... | |
Private Member Functions | |
ClientFactory () | |
Default constructor This is private since only a single instance is to be created, using the getInstance method. More... | |
template<class T > | |
void | add (const std::string &aProtocol, const std::string &aDescription, bool aUserDefined) |
Method to create an associate between a protocol identifier and a Creator of a particular type. More... | |
Private Attributes | |
boost::unordered_map< std::string, ClientInfo > | mClientMap |
Hash map associating a creator for a particular protocol with a file name. More... | |
Static Private Attributes | |
static boost::shared_ptr< ClientFactory > | mInstance |
The single instance of the class. More... | |
A class to construct an IPbus client based on the protocol identifier specified NOTE! This is a factory method and must be Mutex protected if it is used in multithreaded environments!
Definition at line 74 of file ClientFactory.hpp.
|
private |
Default constructor This is private since only a single instance is to be created, using the getInstance method.
Definition at line 55 of file ClientFactory.cpp.
Referenced by getInstance().
|
virtual |
Destructor.
Definition at line 60 of file ClientFactory.cpp.
|
private |
Method to create an associate between a protocol identifier and a Creator of a particular type.
aProtocol | the protocol identifier |
aDescription | an optional description of the protocol |
Definition at line 46 of file ClientFactory.hxx.
References uhal::ClientFactory::ClientInfo::creator, uhal::ClientFactory::ClientInfo::description, uhal::log(), mClientMap, uhal::ClientFactory::ClientInfo::userDefined, and uhal::Warning.
boost::shared_ptr< ClientInterface > uhal::ClientFactory::getClient | ( | const std::string & | aId, |
const std::string & | aUri | ||
) |
Construct an IPbus client based on the protocol identifier specified.
aId | the uinique identifier that the client will be given. |
aUri | a string containing the full URI of the target. This string is parsed to extract the protocol, and it is this which is used to identify the relevent creator which is then used to create the client. |
Definition at line 90 of file ClientFactory.cpp.
boost::shared_ptr< ClientInterface > uhal::ClientFactory::getClient | ( | const std::string & | aId, |
const std::string & | aUri, | ||
const std::vector< std::string > & | aUserClientActivationList | ||
) |
Construct an IPbus client based on the protocol identifier specified.
aId | the uinique identifier that the client will be given. |
aUri | a string containing the full URI of the target. This string is parsed to extract the protocol, and it is this which is used to identify the relevent creator which is then used to create the client. |
aUserClientMaps | a vector of names of protocols for user clients that should be enabled |
Definition at line 96 of file ClientFactory.cpp.
References uhal::Info, uhal::log(), mClientMap, uhal::URI::mProtocol, and uhal::Quote().
|
static |
Static method to retrieve the single instance of the class.
Definition at line 65 of file ClientFactory.cpp.
References ClientFactory(), and mInstance.
Referenced by uhal::tests::BOOST_AUTO_TEST_CASE(), uhal::tests::PerfTester::buildClients(), uhal::tests::checkClientFactory(), uhal::ConnectionManager::getDevice(), and uhal::ClientFactory::RegistrationHelper< T >::init().
void uhal::ClientFactory::registerClient | ( | const std::string & | aProtocol, |
const std::string & | aDescription = "" |
||
) |
Method to create an associate between a protocol identifier and a Creator of a particular type.
aProtocol | the protocol identifier |
aDescription | an optional description of the protocol |
Definition at line 65 of file ClientFactory.hxx.
Referenced by uhal::ClientFactory::RegistrationHelper< T >::init().
|
private |
Hash map associating a creator for a particular protocol with a file name.
Definition at line 198 of file ClientFactory.hpp.
Referenced by add(), and getClient().
|
staticprivate |
The single instance of the class.
Definition at line 196 of file ClientFactory.hpp.
Referenced by getInstance().