gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
plugin_loader.cpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
10 //
26 
27 #include <cstdlib>
28 #include <iomanip>
29 #include <unistd.h>
30 #include <iostream>
31 #include <fstream>
32 #include <stdio.h>
33 
37 #include "gambit/cmake/cmake_variables.hpp"
42 #include "gambit/ScannerBit/priors_rollcall.hpp"
43 
44 namespace Gambit
45 {
46 
47  namespace Scanner
48  {
49 
50  namespace Plugins
51  {
52  inline std::string print_plugins(std::map< std::string, std::map<std::string, std::vector<Plugin_Details> > >::const_iterator plugins)
53  {
54  table_formatter table(plugins->first + " PLUGINS", "VERSION", "STATUS");
55  table.capitalize_title();
56  table.padding(1);
57 
58  for (auto it = plugins->second.begin(); it != plugins->second.end(); ++it)
59  {
60  for (auto jt = it->second.begin(); jt != it->second.end(); ++jt)
61  {
62  const str firstentry = (jt == it->second.begin() ? it->first : "");
63  table << firstentry;
64  table << jt->version;
65  if (jt->status == "ok")
66  table.green() << jt->status;
67  else
68  table.red() << jt->status;
69  }
70  }
71 
72  return table.str();
73  }
74 
75  Plugin_Loader::Plugin_Loader() : path(GAMBIT_DIR "/ScannerBit/lib/")
76  {
77  std::string p_str;
78  std::ifstream lib_list(path + "plugin_libraries.list");
79  if (lib_list.is_open())
80  {
81  while (lib_list >> p_str)
82  {
83  //if (p_str.find(".so") != std::string::npos && p_str.find(".so.") == std::string::npos)
84  p_str = path + p_str;
85  if(access(p_str.c_str(), F_OK) != -1) //can use R_OK|W_OK|X_OK also
86  loadLibrary (p_str);
87  else
88  scan_warn << "Could not find plugin library \"" << p_str << "\"." << scan_end;
89  }
90 
91  auto excluded_plugins = loadExcluded(Utils::buildtime_scratch+"scanbit_excluded_libs.yaml");
92  const str linked_libs(Utils::buildtime_scratch+"scanbit_linked_libs.yaml");
93  const str reqd_entries(Utils::buildtime_scratch+"scanbit_reqd_entries.yaml");
94  const str flags(Utils::buildtime_scratch+"scanbit_flags.yaml");
95  process(linked_libs, reqd_entries, flags, excluded_plugins);
96  }
97  else
98  {
99  scan_err << "Cannot open ./ScannerBit/lib/plugin_libraries.list" << scan_end;
100  }
101  }
102 
104  bool is_new_plugin(std::map<str, std::map<str, std::vector<Plugin_Details>>>& pmap, Plugin_Details& cand)
105  {
106  bool new_plugin_type = pmap.find(cand.type) == pmap.end();
107  bool new_plugin_name = new_plugin_type || pmap.at(cand.type).find(cand.plugin) == pmap.at(cand.type).end();
108  bool new_plugin_version = true;
109  if (not new_plugin_name)
110  {
111  for (auto x : pmap.at(cand.type).at(cand.plugin))
112  if (x.version == cand.version) new_plugin_version = false;
113  }
114  return new_plugin_version;
115  }
116 
117  void Plugin_Loader::process(const std::string& libFile, const std::string& plugFile, const std::string& flagFile, std::vector<Plugin_Details>& excluded_plugins)
118  {
119  YAML::Node libNode = YAML::LoadFile(libFile);
120  YAML::Node plugNode = YAML::LoadFile(plugFile);
121  YAML::Node flagNode = YAML::LoadFile(flagFile);
122 
123  for (auto it = excluded_plugins.begin(), end = excluded_plugins.end(); it != end; it++)
124  {
126  {
127  it->get_status(libNode, plugNode, flagNode);
128  excluded_plugin_map[it->type][it->plugin].push_back(*it);
129  total_plugin_map[it->type][it->plugin].push_back(*it);
130  }
131  }
132 
133  for (auto it = plugins.begin(), end = plugins.end(); it != end; it++)
134  {
136  {
137  it->get_status(libNode, plugNode, flagNode);
138  plugin_map[it->type][it->plugin].push_back(*it);
139  total_plugin_map[it->type][it->plugin].push_back(*it);
140  }
141  }
142  }
143 
144  std::vector<Plugin_Details> Plugin_Loader::loadExcluded (const std::string& file)
145  {
146  std::vector<Plugin_Details> excluded_plugins;
147  YAML::Node node = YAML::LoadFile(file);
148 
149  if (node.IsMap())
150  {
151  for (auto it = node.begin(), end = node.end(); it != end; it++)
152  {
153  std::string lib = it->first.as<std::string>();
154  std::vector<Plugin_Details> excluded_plugins_temp;
155  std::vector<std::string> reason;
156  if (it->second.IsMap())
157  {
158  if (it->second["plugins"])
159  {
160  for (auto it2 = it->second["plugins"].begin(), end2 = it->second["plugins"].end(); it2 != end2; ++it2)
161  {
162  Plugin_Details temp(it2->as<std::string>());
163 
164  temp.path = path + lib;
165  temp.status = "excluded";
166  excluded_plugins_temp.push_back(temp);
167  }
168  }
169 
170  if (it->second["reason"])
171  {
172  for (auto rea : it->second["reason"])
173  {
174  if(rea.IsScalar())
175  {
176  reason.push_back(rea.as<std::string>());
177  }
178  if(rea.IsMap())
179  {
180  for (auto it2 = rea.begin(), end2 = rea.end(); it2 != end2; ++it2)
181  {
182  reason.push_back(it2->first.as<std::string>() + ": " + it2->second.as<std::string>());
183  }
184  }
185  }
186  }
187 
188  for (auto it2 = excluded_plugins_temp.begin(), end2 = excluded_plugins_temp.end(); it2 != end2; ++it2)
189  {
190  it2->status = "excluded";
191  it2->reason.insert(it2->reason.end(), reason.begin(), reason.end());
192  }
193 
194  excluded_plugins.insert(excluded_plugins.end(), excluded_plugins_temp.begin(), excluded_plugins_temp.end());
195  total_plugins.insert(total_plugins.end(), excluded_plugins_temp.begin(), excluded_plugins_temp.end());
196 
197  }
198  }
199  }
200  return excluded_plugins;
201  }
202 
203  void Plugin_Loader::loadLibrary (const std::string &p_str, const std::string &plug)
204  {
205  std::string str;
206  if (FILE* f = popen((std::string("nm ") + p_str + std::string(" | grep \"__gambit_plugin_pluginInit_\"")).c_str(), "r"))
207  {
208  char buffer[1024];
209  int n;
210  std::stringstream ss;
211 
212  while ((n = fread(buffer, 1, sizeof buffer, f)) > 0)
213  {
214  ss << std::string(buffer, n);
215  }
216 
217  while(std::getline(ss, str))
218  {
219  std::string::size_type pos = str.find("__gambit_plugin_pluginInit_");
220 
221  if (pos != std::string::npos &&
222  (str.rfind(" T ", pos) != std::string::npos || str.rfind(" t ", pos) != std::string::npos))
223  {
224  Plugin_Details temp(str.substr(pos + 27, str.rfind("__") - pos - 27));
225 
226  if (plug == "" || temp.plugin == plug)
227  {
228  temp.path = p_str;
229  plugins.push_back(temp);
230  total_plugins.push_back(temp);
231  }
232  }
233  }
234 
235  pclose(f);
236  }
237  }
238 
239  std::vector<std::string> Plugin_Loader::print_plugin_names(const std::string &plug_type) const
240  {
241  std::vector<std::string> vec;
242 
243  if (plug_type != "")
244  {
245  auto plugins = total_plugin_map.find(plug_type);
246  if (plugins == total_plugin_map.end())
247  {
248  return vec;
249  }
250  else
251  {
252  for (auto it = plugins->second.begin(), end = plugins->second.end(); it != end; ++it)
253  {
254  vec.push_back(it->first);
255  }
256  }
257  }
258  else
259  {
260  for (auto it = total_plugin_map.begin(), end = total_plugin_map.end(); it != end; it++)
261  {
262  for (auto it2 = it->second.begin(), end2 = it->second.end(); it2 != end2; ++it2)
263  {
264  vec.push_back(it2->first);
265  }
266  }
267  }
268 
269  return vec;
270  }
271 
272  std::vector<std::string> Plugin_Loader::list_prior_groups() const
273  {
274  YAML::Node node = YAML::LoadFile(GAMBIT_DIR "/config/priors.dat");
275  std::vector<std::string> vec;
276 
277  for(auto &&n : node)
278  {
279  if (n.second.IsSequence())
280  vec.push_back(n.first.as<std::string>());
281  }
282 
283  vec.push_back("priors");
284 
285  return vec;
286  }
287 
288  std::string Plugin_Loader::print_priors(const std::string &prior_group) const
289  {
290  YAML::Node node = YAML::LoadFile(GAMBIT_DIR "/config/priors.dat");
291  std::stringstream out;
292 
293  if (prior_group == "priors")
294  {
295  table_formatter table("Prior Name", "Prior Group");
296  //table.top_line(true);
297  table.bottom_line(true);
298  std::unordered_set<std::string> prior_set;
299  for(auto &&n : node)
300  {
301  if (n.second.IsSequence())
302  {
303  for(auto &&v : n.second.as<std::vector<std::string>>())
304  {
305  prior_set.insert(v);
307  table.no_newline() << v << n.first.as<std::string>();
308  }
309  }
310  }
311 
312  for (auto &&v : Gambit::Priors::prior_creators)
313  {
314  if (prior_set.find(v.first) == prior_set.end())
315  {
316  table.no_newline() << v.first << "none";
317  }
318  }
319 
320  table.no_newline() << "" << "";
321  out << "\x1b[01m\x1b[04mPRIOR LIST\x1b[0m\n" << std::endl;
322  out << format_for_screen("For information on a specific prior, see its prior group's diagnostic via \"./gambit group_name\".");
323  out << table.str() << std::endl;
324  out << "\x1b[01m\x1b[04mDESCRIPTION\x1b[0m\n" << std::endl;
325  if (node["priors"])
326  out << format_for_screen(node["priors"].as<std::string>()) << std::endl;
327  }
328  else
329  {
330  std::vector<std::string> prior_names;
331  std::string description;
332  for(auto &&n : node)
333  {
334  if (n.first.as<std::string>() == prior_group)
335  {
336  if (n.second.IsSequence())
337  {
338  prior_names = n.second.as<decltype(prior_names)>();
339  }
340  else if (n.second.IsScalar())
341  {
342  description = n.second.as<std::string>();
343  }
344  }
345  }
346 
347  if (prior_names.size() >0 || description != "")
348  {
349  out << "\x1b[01m\x1b[04mPRIORS INFO\x1b[0m\n" << std::endl;
350  out << "\x1b[01mprior group name: \x1b[0m" << prior_group << std::endl;
351  out << "\x1b[01mpriors: \x1b[0m" << prior_names << "\n" << std::endl;
352  out << "\x1b[01m\x1b[04mDESCRIPTION\x1b[0m\n\n" << description << std::endl;
353  }
354  }
355 
356  return out.str();
357  }
358 
359  std::string Plugin_Loader::print_all(const std::string &plug_type) const
360  {
361  if (plug_type != "")
362  {
363  auto plugins = total_plugin_map.find(plug_type);
364  if (plugins == total_plugin_map.end())
365  {
366  return "";
367  }
368  else
369  {
370  return print_plugins(plugins);
371  }
372  }
373  else
374  {
375  for (auto it = total_plugin_map.begin(), end = total_plugin_map.end(); it != end; it++)
376  {
377  return print_plugins(it);
378  }
379  }
380 
381  return "";
382  }
383 
384  int Plugin_Loader::print_all_to_screen (const std::string &name) const
385  {
386  std::string output = print_all(name);
387  if (output == "")
388  return 1;
389 
390  print_to_screen(output, name);
391  return 0;
392  }
393 
394  std::string Plugin_Loader::print_plugin(const std::string &name) const
395  {
396  std::unordered_map<std::string, std::vector<const Scanner::Plugins::Plugin_Details*>> vec;
397  std::stringstream output;
398 
399  for (auto it_map = getPluginsMap().begin(), end = getPluginsMap().end(); it_map!= end; it_map++)
400  {
401  auto it = it_map->second.find(name);
402  if (it != it_map->second.end())
403  {
404  for (auto &&plug : it->second)
405  {
406  vec[it_map->first].push_back(&plug);
407  }
408  }
409  }
410 
411  if (vec.size() == 0)
412  {
413  return "";
414  }
415  else
416  {
417  for (auto it = vec.begin(), end = vec.end(); it != end; it++)
418  {
419  output << Plugin_Details::printMultiPlugins(it->second) << std::endl;
420  }
421  }
422 
423  return output.str();
424  }
425 
426  std::string Plugin_Loader::print_plugin(const std::string &type, const std::string &plugin) const
427  {
428  std::vector<const Scanner::Plugins::Plugin_Details *> vec;
429 
430  if((getPluginsMap().find(type) == getPluginsMap().end()) || (getPluginsMap().at(type).find(plugin) == getPluginsMap().at(type).end()))
431  {
432  return "";
433  }
434 
435  for (auto it = getPluginsMap().at(type).at(plugin).begin(), end = getPluginsMap().at(type).at(plugin).end(); it != end; it++)
436  {
437  vec.push_back(&(*it));
438  }
439 
440  return Plugin_Details::printMultiPlugins(vec) + "\n";
441  }
442 
443  int Plugin_Loader::print_plugin_to_screen (const std::string &name) const
444  {
445  std::string output = print_plugin(name);
446  if (output == "")
447  return 1;
448 
449  print_to_screen(output, name);
450  return 0;
451  }
452 
453  int Plugin_Loader::print_plugin_to_screen (const std::string &type, const std::string &name) const
454  {
455  std::string output = print_plugin(type, name);
456  if (output == "")
457  return 1;
458 
459  print_to_screen(output, name);
460  return 0;
461  }
462 
463  int Plugin_Loader::print_plugin_to_screen (const std::vector<std::string> &names) const
464  {
465  std::string output;
466  for (auto it = names.begin(), end = names.end(); it != end; ++it)
467  {
468  output += print_plugin(*it) + "\n";
469  }
470 
471  if (output == "")
472  return 1;
473 
474  print_to_screen(output, names[0]);
475  return 0;
476  }
477 
478  Plugin_Details &Plugin_Loader::find (const std::string &type, const std::string &plugin, const std::string &version, const std::string &lib) const
479  {
480  std::vector<Plugin_Details_Ref> plugins;
481 
482  if((plugin_map.find(type) == plugin_map.end()) || (plugin_map.at(type).find(plugin) == plugin_map.at(type).end()))
483  {
484  scan_err << "There is no plugin named \"" << plugin <<"\" of type \"" << type << "\"" << scan_end;
485  }
486 
487  for (auto it = plugin_map.at(type).at(plugin).begin(), end = plugin_map.at(type).at(plugin).end(); it != end; it++)
488  {
489  if (VersionCompare(version)(*it) && (lib == "" || lib == it->path) and it->status == "ok")
490  plugins.push_back(*it);
491  }
492 
493  if (plugins.size() > 1)
494  {
495  std::sort(plugins.begin(), plugins.end(), Plugin_Version_Supersedes);
496  auto it2 = plugins.begin();
497  std::vector<Plugin_Details_Ref> matches;
498  for (auto it = it2 + 1, end = plugins.end(); it != end; it++)
499  {
500  if (*it == *it2) matches.push_back(*it);
501  }
502  if (not matches.empty())
503  {
504  scan_err << "More than one plugin met the input criteria in the YAML file:\n\n" << static_cast<Plugin_Details &>(*it2).print() << "\n";
505  for (auto it = matches.begin(); it != matches.end(); it++)
506  {
507  scan_err << static_cast<Plugin_Details &>(*it).print() << "\n";
508  }
509  scan_err << "To indicate to ScannerBit which of these plugins should be used, please"
510  << "\nadd more specific information in the Scanners section of your YAML file." << scan_end;
511  }
512  }
513  else if (plugins.size() == 0)
514  {
515  scan_err << "Plugin \"" << plugin << "\" of type \"" << type << "\" and "
516  << " version \"" << version << "\" is not found." << scan_end;
517  plugins.resize(1);
518  }
519 
520  return plugins[0];
521  }
522 
523  void pluginInfo::iniFile(const Options &options_in)
524  {
525  options = options_in;
526 
527  if (options.getNode().IsMap())
528  {
529  if (options.hasKey("default_output_path"))
530  def_out_path = options.getValue<std::string>("default_output_path");
531  else
532  scan_err << "\"default output path\" must be specified in KeyValues section." << scan_end;
533 
534  for (auto it = options.getNode().begin(), end = options.getNode().end(); it != end; it++)
535  {
536  std::string plug_type = it->first.as<std::string>();
537 
538  if (it->second.IsMap() && plug_type[plug_type.length()-1] == 's' && plug_type != "priors" && plug_type != "parameters")
539  {
540  for (auto it_p = it->second.begin(), end = it->second.end(); it_p != end; it_p++)
541  {
542  std::string plug_tag = it_p->first.as<std::string>();
543 
545 
546  if (it_p->second["plugin"])
547  {
548  temp.plugin = it_p->second["plugin"].as<std::string>();
549  }
550  else
551  {
552  scan_warn << "Plugin name is not defined under the \"" << it->first << "\" tag. "
553  << "using the tag \"" << it_p->first.as<std::string>()
554  << "\" as the plugin name." << scan_end;
555  temp.plugin = it_p->first.as<std::string>();
556  }
557 
558  if (it_p->second["version"])
559  temp.version = it_p->second["version"].as<std::string>();
560 
561  if (it_p->second["plugin_path"])
562  {
563  temp.path = it_p->second["plugin_path"].as<std::string>();
564  plugins.loadLibrary(temp.path, temp.plugin);
565  }
566 
567  selectedPlugins[plug_type.substr(0, plug_type.length()-1)][plug_tag] = temp;
568  }
569  }
570  }
571  }
572  else
573  {
574  scan_err << "Plugins subsection is not of the \"Map\" YAML format." << scan_end;
575  }
576  }
577 
579  {
580  printer = &printerIn;
581  prior = &prior_in;
582  }
583 
584  Plugins::Plugin_Interface_Details pluginInfo::operator()(const std::string &type, const std::string &tag)
585  {
586  if (selectedPlugins.find(type) != selectedPlugins.end() && selectedPlugins[type].find(tag) != selectedPlugins[type].end())
587  {
588  Proto_Plugin_Details &detail = selectedPlugins[type][tag];
589  YAML::Node plugin_options = options.getNode(type + "s", tag);
590 
591  plugin_options["default_output_path"] = options.getValue<std::string>("default_output_path");
592  plugin_options["print_timing_data"] = options.getValue<std::string>("print_timing_data");
593 
594  if (!plugin_options["likelihood: model_invalid_for_lnlike_below"])
595  plugin_options["likelihood: model_invalid_for_lnlike_below"] = options.getValue<double>("model_invalid_for_lnlike_below");
596 
597  if (!plugin_options["likelihood: lnlike_offset"] and options.hasKey("lnlike_offset"))
598  plugin_options["likelihood: lnlike_offset"] = options.getValue<double>("lnlike_offset");
599 
600  return Plugin_Interface_Details(plugins.find(type, detail.plugin, detail.version, detail.path), printer, prior, plugin_options);
601  }
602  else
603  {
604  scan_err << "Plugin \"" << tag << "\" of type \"" << type << "\" is not defined under the \"Scanner\""
605  << " subsection in the inifile" << scan_end;
606 
607  return Plugin_Interface_Details(plugins.find(type, "", "", ""), printer, prior, options.getOptions(type + "s", tag).getNode());
608  }
609  }
610 
612  {
613  for (auto it = resume_data.begin(), end = resume_data.end(); it != end; ++it)
614  {
615  std::string path = Gambit::Utils::ensure_path_exists(def_out_path + "/temp_files/" + it->first);
616  std::ofstream out((path).c_str(), std::ofstream::binary);
617  for (auto v_it = it->second.begin(), v_end = it->second.end(); v_it != v_end; ++v_it)
618  {
619  (*v_it)->print(out);
620  }
621  }
622 
623  printer->finalise(true); //"true" flag for "abnormal" stop; i.e. run is not completely finished
624  // Debugging output
625  // #ifdef WITH_MPI
626  // std::cout << "rank " << getRank() <<": ";
627  // #endif
628  // std::cout << "Gambit has written resume data to disk, preparing to stop!" << std::endl;
629  }
630 
631  void pluginInfo::dump(const std::string &name)
632  {
633  auto it = resume_data.find(name);
634  if (it != resume_data.end())
635  {
636  std::string path = Gambit::Utils::ensure_path_exists(def_out_path + "/temp_files/" + name);
637  std::ofstream out((path).c_str(), std::ofstream::binary);
638  for (auto v_it = it->second.begin(), v_end = it->second.end(); v_it != v_end; ++v_it)
639  {
640  (*v_it)->print(out);
641  }
642  }
643  }
644 
647  {
648  std::string state_fname(def_out_path+"/ALT_MIN_LOGL_IN_USE");
649  std::ofstream outfile(state_fname);
650  outfile.close();
651  }
652 
655  {
656  if(check_alt_min_LogL_state())
657  {
658  std::string state_fname(def_out_path+"/ALT_MIN_LOGL_IN_USE");
659  // Persistence file exists: delete it
660  if (remove(state_fname.c_str())) scan_err << "Failed to delete alternative min_LogL persistence file '" << state_fname << "'! Error was: " << strerror(errno) << scan_end;
661  }
662  }
663 
666  {
667  return Utils::file_exists(def_out_path+"/ALT_MIN_LOGL_IN_USE");
668  }
669 
671  {
672  for (auto it = resume_streams.begin(), end = resume_streams.end(); it != end; ++it)
673  {
674  delete it->second;
675  }
676  }
677 
679  : keepRunning(true), funcCalculating(false), MPIrank(0)
680  #ifdef WITH_MPI
681  , scannerComm(NULL), MPIdata_is_init(false)
682  #endif
683  , earlyShutdownInProgress(false)
684  {}
685 
686  #ifdef WITH_MPI
687  void pluginInfo::initMPIdata(GMPI::Comm* newcomm)
689  {
690  scannerComm = newcomm;
691  MPIdata_is_init = true;
692  MPIrank = scanComm().Get_rank();
693  }
694 
695  GMPI::Comm& pluginInfo::scanComm()
696  {
697  if(not MPIdata_is_init)
698  {
699  std::cerr << "Tried to retrieve scanComm MPI communicator (in ScannerBit), but it has not been initialised! Please be sure to call 'initMPIdata' and provide a communicator before allowing any scans to commence." << std::endl;
700  exit(1); //TODO not sure if this should be a standard GAMBIT error or not. Going with 'not' for now.
701  }
702  return *scannerComm;
703  }
704  #endif
705 
707  }
708  }
709 }
710 
table_formatter & green(int i=-1, int j=-1)
table_formatter & red(int i=-1, int j=-1)
const str buildtime_scratch
Return the path to the build-time scratch directory.
Abstract base class for priors.
Definition: base_prior.hpp:40
void process(const std::string &, const std::string &, const std::string &, std::vector< Plugin_Details > &)
void save_alt_min_LogL_state() const
Save persistence file to record that the alternative min_LogL value is in use for this scan...
std::map< std::string, std::map< std::string, std::vector< Plugin_Details > > > excluded_plugin_map
std::vector< std::string > print_plugin_names(const std::string &="") const
container info for a specific plugin
std::map< std::string, std::map< std::string, std::vector< Plugin_Details > > > plugin_map
int print_plugin_to_screen(const std::string &) const
std::string print_plugin(const std::string &) const
const std::map< std::string, std::map< std::string, std::vector< Plugin_Details > > > & getPluginsMap() const
void loadLibrary(const std::string &, const std::string &="")
#define scan_warn
reg_elem< create_prior_function > prior_creators
Definition: priors.hpp:43
Plugin_Details & find(const std::string &, const std::string &, const std::string &, const std::string &) const
bool Plugin_Version_Supersedes(const Plugin_Details &plug1, const Plugin_Details &plug2)
compares the user defined plugin version to the actual plugin version.
std::string path
full path to library containing plugin
Utility Functions for the Gambit Scanner.
std::vector< Plugin_Details > total_plugins
Plugin info to be given to the interface class.
General small utility functions.
void printer_prior(printer_interface &, Priors::BasePrior &)
table_formatter & no_newline(int j=-1)
TYPE getValue(const args &... keys) const
std::string print_priors(const std::string &prior_group="priors") const
bool is_new_plugin(std::map< str, std::map< str, std::vector< Plugin_Details >>> &pmap, Plugin_Details &cand)
Check a plugin map and return a flag indicating if a candidate plugin is already in the map or not...
#define scan_err
Defined to macros to output errors in the form: scan_err << "error" << scan_end; scan_warn << "warnin...
EXPORT_SYMBOLS bool file_exists(const std::string &filename)
Check if a file exists.
std::vector< Plugin_Details > loadExcluded(const std::string &)
std::vector< Plugin_Details > plugins
Container for all the plugin info from the inifile and Scannerbit.
static std::string printMultiPlugins(const std::vector< const Plugin_Details *> &)
std::map< std::string, std::map< std::string, std::vector< Plugin_Details > > > total_plugin_map
Utility Functions for the Gambit Scanner.
Printers::BaseBasePrinter printer
Type of the printer objects.
const std::set< LogTag > & flags()
Definition: logging.cpp:65
std::vector< Plugin_Details > excluded_plugins
std::string print_all(const std::string &plug_type="") const
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
EXPORT_SYMBOLS const str & ensure_path_exists(const str &)
Ensure that a path exists (and then return the path, for chaining purposes)
Utility Functions for the Gambit Scanner.
void iniFile(const Options &)
Enter plugin inifile.
std::vector< std::string > list_prior_groups() const
A simple C++ wrapper for the MPI C bindings.
std::string version
version string: maj.min.patch-release
#define scan_end
std::string print_plugins(std::map< std::string, std::map< std::string, std::vector< Plugin_Details > > >::const_iterator plugins)
const Plugin_Loader & operator()()
Retrieve plugin data.
void clear_alt_min_LogL_state() const
Delete the persistence file if it exists (e.g. when starting a new run)
Manager class for creating printer objects.
void dump()
Dump contents for resume.
Loader singleton class for scanner plugins.
std::vector< T > vec(std::vector< T > vector)
Definition: daFunk.hpp:142
std::string status
status, not set right now
bool check_alt_min_LogL_state() const
Check persistence file to see if we should be using the alternative min_LogL value.
EXPORT_SYMBOLS pluginInfo plugin_info
Access Functor for plugin info.
TODO: see if we can use this one:
Definition: Analysis.hpp:33
A small wrapper object for &#39;options&#39; nodes.
Advanced comparison utilities for scanner plugins.
std::string format_for_screen(const std::string &input_string)
virtual void finalise(bool abnormal=false)=0
Signal printer that scan is finished, and final output needs to be performed.
int print_all_to_screen(const std::string &plug_type="") const
void print_to_screen(const std::string &file_in, const std::string &name)