36 #include <boost/spirit/include/qi.hpp> 66 mInstance->
add<
PCIe > (
"ipbuspcie-2.0" ,
"Direct access to hardware via PCIe, using IPbus version 2.0" );
67 mInstance->
add<
Mmap > (
"ipbusmmap-2.0" ,
"Direct access to hardware via mmap, using IPbus version 2.0" );
95 grammars::URIGrammar lGrammar;
96 std::string::const_iterator lBegin ( aUri.begin() );
97 std::string::const_iterator lEnd ( aUri.end() );
98 boost::spirit::qi::phrase_parse ( lBegin , lEnd , lGrammar , boost::spirit::ascii::space , lUri );
100 catch (
const std::exception& aExc )
102 exception::FailedToParseURI lExc;
103 log ( lExc ,
"Failed to parse device URI " ,
Quote ( aUri ) );
107 log (
Info() ,
"URI " ,
Quote ( aUri ) ,
" parsed as:\n" , lUri );
108 boost::unordered_map< std::string , boost::shared_ptr<CreatorInterface> >::const_iterator lIt =
mCreators.find ( lUri.
mProtocol );
112 std::stringstream lStr;
116 lStr <<
"\n > " << lIt->first <<
"\t: " << lIt->second;
119 exception::ProtocolDoesNotExist lExc;
120 log ( lExc ,
"Protocol " ,
Quote ( lUri.
mProtocol ) ,
" does not exists in map of creators. Options are:" , lStr.str() );
124 return lIt->second->create ( aId , lUri );
Transport protocol to transfer an IPbus buffer via UDP.
static ClientFactory & getInstance()
Static method to retrieve the single instance of the class.
Transport protocol to transfer an IPbus buffer via device file, using mmap.
std::map< std::string, std::string > mProductDescriptions
Store the description of the factory product.
boost::shared_ptr< ClientInterface > getClient(const std::string &aId, const std::string &aUri)
Construct an IPbus client based on the protocol identifier specified.
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...
_Quote< T > Quote(const T &aT)
virtual ~ClientFactory()
Destructor.
A class to construct an IPbus client based on the protocol identifier specified NOTE! This is a facto...
ClientFactory()
Default constructor This is private since only a single instance is to be created, using the getInstance method.
std::string mProtocol
The "protocol" part of a URI of the form "protocol://host:port/patha/pathb/blah.ext?key1=val1&key2=val2&key3=val3".
Transport protocol to transfer an IPbus buffer via TCP.
Transport protocol to transfer an IPbus buffer via PCIe.
boost::unordered_map< std::string, boost::shared_ptr< CreatorInterface > > mCreators
Hash map associating a creator for a particular protocol with a file name.
Struct to store a URI when parsed by boost spirit.
static ClientFactory * mInstance
The single instance of the class.