33 static bool isAlreadySetup =
false;
38 isAlreadySetup =
true;
40 std::stringstream exportkeys;
41 exportkeys << RooFitHS3_wsexportkeys;
47 static bool isAlreadySetup =
false;
52 isAlreadySetup =
true;
54 std::stringstream factoryexpressions;
55 factoryexpressions << RooFitHS3_wsfactoryexpressions;
69 static std::map<const std::string, std::vector<std::unique_ptr<const Exporter>>> toAdd;
84 for (
auto &item : exportersToAdd()) {
87 auto &toAdd = item.second;
90 auto nullIt = std::find(toAdd.begin(), toAdd.end(),
nullptr);
92 if (nullIt == toAdd.end()) {
93 throw std::runtime_error(
"toAdd does not contain nullptr separator");
97 exporters.insert(
exporters.end(), std::make_move_iterator(nullIt + 1), std::make_move_iterator(toAdd.end()));
100 exporters.insert(
exporters.begin(), std::make_move_iterator(toAdd.begin()), std::make_move_iterator(nullIt));
104 exportersToAdd().clear();
105 return exportersImpl();
112 return _factoryExpressions;
122bool registerImporter(
const std::string &key, std::unique_ptr<const Importer>
f,
bool topPriority)
125 vec.insert(topPriority ? vec.begin() : vec.end(), std::move(
f));
132 vec.insert(topPriority ? vec.begin() : vec.end(), std::move(
f));
136bool registerExporter(
const std::string &key, std::unique_ptr<const Exporter>
f,
bool topPriority)
138 auto &vec = exportersToAdd()[key];
143 vec.emplace_back(
nullptr);
145 vec.insert(topPriority ? vec.begin() : vec.end(), std::move(
f));
152int removeByTypeName(Map &map,
const std::string &needle)
155 for (
auto &element : map) {
156 for (
size_t i = element.second.size(); i > 0; --i) {
157 auto *imp = element.second[i - 1].get();
158 std::string
name(
typeid(*imp).name());
159 if (
name.find(needle) != std::string::npos) {
160 element.second.erase(element.second.begin() + i - 1);
168template <
class Map,
class KeyPr
inter>
169void printByTypeName(Map &map, KeyPrinter printKey)
171 for (
const auto &
x : map) {
172 for (
const auto &ePtr :
x.second) {
174 auto const &
e = *ePtr;
175 std::cout << printKey(
x.first) <<
"\t" <<
typeid(
e).
name() << std::endl;
184 return removeByTypeName(
importers(), needle);
189 return removeByTypeName(
exporters(), needle);
194 printByTypeName(
importers(), [](
auto const &key) {
return key; });
198 printByTypeName(
exporters(), [](
auto const &key) {
return key->GetName(); });
204 std::ifstream infile(fname);
205 if (!infile.is_open()) {
206 std::cerr <<
"unable to read file '" << fname <<
"'" << std::endl;
218 for (
const auto &cl :
n.children()) {
219 std::string key = cl.key();
220 if (!cl.has_child(
"class")) {
221 std::cerr <<
"error for entry '" << key <<
"': 'class' key is required!" << std::endl;
224 std::string classname(cl[
"class"].val());
227 std::cerr <<
"unable to find class " << classname <<
", skipping." << std::endl;
232 if (!cl.has_child(
"arguments")) {
233 std::cerr <<
"class " << classname <<
" seems to have no arguments attached, skipping" << std::endl;
236 for (
const auto &arg : cl[
"arguments"].children()) {
237 ex.arguments.push_back(arg.val());
239 factoryExpressions[key] =
ex;
253 std::cout << it.first;
254 std::cout <<
" " << it.second.tclass->GetName();
255 for (
auto v : it.second.arguments) {
256 std::cout <<
" " <<
v;
258 std::cout << std::endl;
269 std::ifstream infile(fname);
270 if (!infile.is_open()) {
271 std::cerr <<
"unable to read file '" << fname <<
"'" << std::endl;
283 for (
const auto &cl :
n.children()) {
284 std::string classname = cl.key();
287 std::cerr <<
"unable to find class " << classname <<
", skipping." << std::endl;
291 auto *
type = cl.find(
"type");
292 auto *proxies = cl.find(
"proxies");
294 std::cerr <<
"class " << classname <<
"has not type key set, skipping" << std::endl;
298 std::cerr <<
"class " << classname <<
"has no proxies identified, skipping" << std::endl;
302 for (
const auto &k : proxies->children()) {
303 ex.proxies[k.key()] = k.val();
319 std::cout << it.first->GetName() <<
": " << it.second.type;
320 for (
const auto &kv : it.second.proxies) {
321 std::cout <<
" " << kv.first <<
"=" << kv.second;
323 std::cout << std::endl;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
static std::unique_ptr< JSONTree > create()
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)
void loadFactoryExpressions(std::istream &is)
void setupFactoryExpressions()
ImportExpressionMap & importExpressions()
static bool registerExporter(const TClass *key, bool topPriority=true)
void clearFactoryExpressions()
int removeImporters(const std::string &needle)
int removeExporters(const std::string &needle)
std::map< TClass const *, std::vector< std::unique_ptr< const Exporter > > > ExportMap
void loadExportKeys(std::istream &is)
std::map< const std::string, ImportExpression > ImportExpressionMap
void printFactoryExpressions()
ExportKeysMap & exportKeys()
std::map< TClass const *, ExportKeys > ExportKeysMap
std::map< const std::string, std::vector< std::unique_ptr< const Importer > > > ImportMap