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 | |
class | Creator |
Templated concrete implementation with a CreatorInterface interface. More... | |
class | CreatorInterface |
An abstract base class for defining the interface to the creators. More... | |
Public Member Functions | |
template<class T > | |
void | add (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... | |
boost::shared_ptr< ClientInterface > | getClient (const std::string &aId, const std::string &aUri) |
Construct an IPbus client based on the protocol identifier specified. 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... | |
virtual | ~ClientFactory () |
Destructor. More... | |
Private Attributes | |
boost::unordered_map< std::string, boost::shared_ptr< CreatorInterface > > | mCreators |
Hash map associating a creator for a particular protocol with a file name. More... | |
std::map< std::string, std::string > | mProductDescriptions |
Store the description of the factory product. More... | |
Static Private Attributes | |
static ClientFactory * | mInstance = NULL |
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 72 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 79 of file ClientFactory.cpp.
Referenced by getInstance().
|
privatevirtual |
Destructor.
Definition at line 84 of file ClientFactory.cpp.
void uhal::ClientFactory::add | ( | 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 38 of file ClientFactory.hxx.
References mCreators, mProductDescriptions, and uhal::Warning.
Referenced by getInstance().
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 89 of file ClientFactory.cpp.
References uhal::Info, mCreators, mProductDescriptions, uhal::URI::mProtocol, and uhal::Quote().
|
static |
Static method to retrieve the single instance of the class.
Definition at line 51 of file ClientFactory.cpp.
References add(), ClientFactory(), and mInstance.
Referenced by uhal::tests::PerfTester::buildClients(), and uhal::ConnectionManager::getDevice().
|
private |
Hash map associating a creator for a particular protocol with a file name.
Definition at line 168 of file ClientFactory.hpp.
Referenced by add(), and getClient().
|
staticprivate |
The single instance of the class.
Definition at line 166 of file ClientFactory.hpp.
Referenced by getInstance().
|
private |
Store the description of the factory product.
Definition at line 170 of file ClientFactory.hpp.
Referenced by add(), and getClient().