35#ifndef plugin_factory_h
36#define plugin_factory_h
56class BESPluginFactory :
public BESObj {
57 std::map<std::string, std::unique_ptr<BESPlugin<C>> > d_children;
60 BESPluginFactory() =
default;
83 void add_mapping(
const std::string &name,
const std::string &library_name) {
84 d_children.emplace(name, std::make_unique<
BESPlugin<C>>(library_name));
99 C *
get(
const std::string &name) {
100 auto plugin_it = d_children.find(name);
101 if (plugin_it == d_children.end()) {
102 throw NoSuchObject(std::string(
"No class is bound to ") + name, __FILE__, __LINE__);
104 return plugin_it->second->instantiate();
107 void dump(std::ostream &strm)
const override {
108 strm <<
"BESPluginFactory::dump - (" << std::ios::hex <<
this <<
")" << std::endl;
top level BES object to house generic methods
BESPluginFactory(const std::string &name, const std::string &library_name)
void add_mapping(const std::string &name, const std::string &library_name)
C * get(const std::string &name)
void dump(std::ostream &strm) const override
dump the contents of this object to the specified ostream