#include std::map & get_TransferFunction_plugin_map() { static std::map TransferFunction_plugin_map; return TransferFunction_plugin_map; } void print_TransferFunction_plugins() { std::map &m = get_TransferFunction_plugin_map(); std::map::iterator it; it = m.begin(); csoca::ilog << "Available transfer function plug-ins:" << std::endl; while (it != m.end()) { if ((*it).second) csoca::ilog << "\t\'" << (*it).first << "\'" << std::endl; ++it; } } std::unique_ptr select_TransferFunction_plugin(ConfigFile &cf) { std::string tfname = cf.GetValue("cosmology", "transfer"); TransferFunction_plugin_creator *the_TransferFunction_plugin_creator = get_TransferFunction_plugin_map()[tfname]; if (!the_TransferFunction_plugin_creator) { csoca::elog << "Invalid/Unregistered transfer function plug-in encountered : " << tfname << std::endl; print_TransferFunction_plugins(); throw std::runtime_error("Unknown transfer function plug-in"); } else { csoca::ilog << std::setw(40) << std::left << "Transfer function plugin" << " : " << tfname << std::endl; } return std::move(the_TransferFunction_plugin_creator->create(cf)); }