30struct ExporterByName {
36std::vector<ExporterByName> &exportersByName()
38 static std::vector<ExporterByName> _exportersByName;
39 return _exportersByName;
48 std::vector<ExporterByName> byName;
49 byName.swap(exportersByName());
50 for (
auto &item : byName) {
59 vec.insert(
topPriority ? vec.begin() : vec.end(), std::move(
f));
66 vec.insert(
topPriority ? vec.begin() : vec.end(), std::move(
f));
72 exportersByName().push_back({key, std::move(
f),
topPriority});
79int removeByTypeName(Map &map,
const std::string &needle)
82 for (
auto &element : map) {
83 for (
size_t i = element.second.size(); i > 0; --i) {
84 auto *imp = element.second[i - 1].get();
85 std::string
name(
typeid(*imp).name());
86 if (
name.find(needle) != std::string::npos) {
87 element.second.erase(element.second.begin() + i - 1);
95template <
class Map,
class KeyPr
inter>
96void printByTypeName(Map &map, KeyPrinter printKey)
98 for (
const auto &
x : map) {
99 for (
const auto &ePtr :
x.second) {
101 auto const &
e = *ePtr;
102 std::cout << printKey(
x.first) <<
"\t" <<
typeid(
e).
name() << std::endl;
111 return removeByTypeName(
importers(), needle);
116 return removeByTypeName(
exporters(), needle);
121 printByTypeName(
importers(), [](
auto const &key) {
return key; });
125 printByTypeName(
exporters(), [](
auto const &key) {
return key->GetName(); });
std::unique_ptr< const Exporter > exporter
TClass instances represent classes, structs and namespaces in the ROOT type system.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
static bool registerImporter(const std::string &key, bool topPriority=true)
static bool registerExporter(const TClass *key, bool topPriority=true)
int removeImporters(const std::string &needle)
int removeExporters(const std::string &needle)
std::map< TClass const *, std::vector< std::unique_ptr< const Exporter > > > ExportMap
std::map< const std::string, std::vector< std::unique_ptr< const Importer > > > ImportMap