gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
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 (FILE* p_f = popen((std::string("ls ") + path).c_str(), "r"))
80  if (lib_list.is_open())
81  {
82  /*char path_buffer[1024];
83  int p_n;
84  std::stringstream p_ss;
85 
86  while ((p_n = fread(path_buffer, 1, sizeof path_buffer, p_f)) > 0)
87  {
88  p_ss << std::string(path_buffer, p_n);
89  }*/
90 
91  //while (p_ss >> p_str)
92  while (lib_list >> p_str)
93  {
94  //if (p_str.find(".so") != std::string::npos && p_str.find(".so.") == std::string::npos)
95  p_str = path + p_str;
96  if(access(p_str.c_str(), F_OK) != -1) //can use R_OK|W_OK|X_OK also
97  loadLibrary (p_str);
98  else
99  scan_warn << "Could not find plugin library \"" << p_str << "\"." << scan_end;
100  }
101 
102  //pclose(p_f);
103 
104  auto excluded_plugins = loadExcluded(Utils::buildtime_scratch+"scanbit_excluded_libs.yaml");
105  const str linked_libs(Utils::buildtime_scratch+"scanbit_linked_libs.yaml");
106  const str reqd_entries(Utils::buildtime_scratch+"scanbit_reqd_entries.yaml");
107  const str flags(Utils::buildtime_scratch+"scanbit_flags.yaml");
108  process(linked_libs, reqd_entries, flags, excluded_plugins);
109  }
110  else
111  {
112  scan_err << "Cannot open ./ScannerBit/lib/plugin_libraries.list" << scan_end;
113  }
114  }
115 
117  bool is_new_plugin(std::map<str, std::map<str, std::vector<Plugin_Details>>>& pmap, Plugin_Details& cand)
118  {
119  bool new_plugin_type = pmap.find(cand.type) == pmap.end();
120  bool new_plugin_name = new_plugin_type || pmap.at(cand.type).find(cand.plugin) == pmap.at(cand.type).end();
121  bool new_plugin_version = true;
122  if (not new_plugin_name)
123  {
124  for (auto x : pmap.at(cand.type).at(cand.plugin))
125  if (x.version == cand.version) new_plugin_version = false;
126  }
127  return new_plugin_version;
128  }
129 
130  void Plugin_Loader::process(const std::string& libFile, const std::string& plugFile, const std::string& flagFile, std::vector<Plugin_Details>& excluded_plugins)
131  {
132  YAML::Node libNode = YAML::LoadFile(libFile);
133  YAML::Node plugNode = YAML::LoadFile(plugFile);
134  YAML::Node flagNode = YAML::LoadFile(flagFile);
135 
136  for (auto it = excluded_plugins.begin(), end = excluded_plugins.end(); it != end; it++)
137  {
139  {
140  it->get_status(libNode, plugNode, flagNode);
141  excluded_plugin_map[it->type][it->plugin].push_back(*it);
142  total_plugin_map[it->type][it->plugin].push_back(*it);
143  //std::cout << it->printFull() << std::endl;
144  }
145  }
146 
147  for (auto it = plugins.begin(), end = plugins.end(); it != end; it++)
148  {
150  {
151  it->get_status(libNode, plugNode, flagNode);
152  plugin_map[it->type][it->plugin].push_back(*it);
153  total_plugin_map[it->type][it->plugin].push_back(*it);
154  //std::cout << it->printFull() << std::endl;
155  }
156  }
157  }
158 
159  std::vector<Plugin_Details> Plugin_Loader::loadExcluded (const std::string& file)
160  {
161  std::vector<Plugin_Details> excluded_plugins;
162  YAML::Node node = YAML::LoadFile(file);
163 
164  if (node.IsMap())
165  {
166  for (auto it = node.begin(), end = node.end(); it != end; it++)
167  {
168  std::string lib = it->first.as<std::string>();
169  std::vector<Plugin_Details> excluded_plugins_temp;
170  std::vector<std::string> reason;
171  if (it->second.IsMap())
172  {
173  if (it->second["plugins"])
174  {
175  for (auto it2 = it->second["plugins"].begin(), end2 = it->second["plugins"].end(); it2 != end2; ++it2)
176  {
177  Plugin_Details temp(it2->as<std::string>());
178 
179  temp.path = path + lib;
180  temp.status = "excluded";
181  //total_plugins.push_back(temp);
182  excluded_plugins_temp.push_back(temp);
183  }
184  }
185 
186  if (it->second["reason"])
187  {
188  if(it->second["reason"].IsScalar())
189  {
190  reason.push_back(it->second["reason"].as<std::string>());
191  }
192  if(it->second["reason"].IsMap())
193  {
194  for (auto it2 = it->second["reason"].begin(), end2 = it->second["reason"].end(); it2 != end2; ++it2)
195  {
196  reason.push_back(it2->first.as<std::string>() + ": " + it2->second.as<std::string>());
197  }
198  }
199  }
200 
201  for (auto it2 = excluded_plugins_temp.begin(), end2 = excluded_plugins_temp.end(); it2 != end2; ++it2)
202  {
203  it2->status = "excluded";
204  it2->reason.insert(it2->reason.end(), reason.begin(), reason.end());
205  }
206 
207  excluded_plugins.insert(excluded_plugins.end(), excluded_plugins_temp.begin(), excluded_plugins_temp.end());
208  total_plugins.insert(total_plugins.end(), excluded_plugins_temp.begin(), excluded_plugins_temp.end());
209 
210  }
211  }
212  }
213  return excluded_plugins;
214  }
215 
216  void Plugin_Loader::loadLibrary (const std::string &p_str, const std::string &plug)
217  {
218  std::string str;
219  if (FILE* f = popen((std::string("nm ") + p_str + std::string(" | grep \"__gambit_plugin_pluginInit_\"")).c_str(), "r"))
220  {
221  char buffer[1024];
222  int n;
223  std::stringstream ss;
224 
225  while ((n = fread(buffer, 1, sizeof buffer, f)) > 0)
226  {
227  ss << std::string(buffer, n);
228  }
229 
230  while(std::getline(ss, str))
231  {
232  std::string::size_type pos = str.find("__gambit_plugin_pluginInit_");
233 
234  if (pos != std::string::npos &&
235  (str.rfind(" T ", pos) != std::string::npos || str.rfind(" t ", pos) != std::string::npos))
236  {
237  Plugin_Details temp(str.substr(pos + 27, str.rfind("__") - pos - 27));
238 
239  if (plug == "" || temp.plugin == plug)
240  {
241  temp.path = p_str;
242  plugins.push_back(temp);
243  total_plugins.push_back(temp);
244  }
245  }
246  }
247 
248  pclose(f);
249  }
250  }
251 
252  std::vector<std::string> Plugin_Loader::print_plugin_names(const std::string &plug_type) const
253  {
254  std::vector<std::string> vec;
255 
256  if (plug_type != "")
257  {
258  auto plugins = total_plugin_map.find(plug_type);
259  if (plugins == total_plugin_map.end())
260  {
261  return vec;
262  }
263  else
264  {
265  for (auto it = plugins->second.begin(), end = plugins->second.end(); it != end; ++it)
266  {
267  vec.push_back(it->first);
268  }
269  }
270  }
271  else
272  {
273  for (auto it = total_plugin_map.begin(), end = total_plugin_map.end(); it != end; it++)
274  {
275  for (auto it2 = it->second.begin(), end2 = it->second.end(); it2 != end2; ++it2)
276  {
277  vec.push_back(it2->first);
278  }
279  }
280  }
281 
282  return vec;
283  }
284 
285  std::vector<std::string> Plugin_Loader::list_prior_groups() const
286  {
287  YAML::Node node = YAML::LoadFile(GAMBIT_DIR "/config/priors.dat");
288  std::vector<std::string> vec;
289 
290  for(auto &&n : node)
291  {
292  if (n.second.IsSequence())
293  vec.push_back(n.first.as<std::string>());
294  }
295 
296  vec.push_back("priors");
297 
298  return vec;
299  }
300 
301  std::string Plugin_Loader::print_priors(const std::string &prior_group) const
302  {
303  YAML::Node node = YAML::LoadFile(GAMBIT_DIR "/config/priors.dat");
304  std::stringstream out;
305 
306  if (prior_group == "priors")
307  {
308  table_formatter table("Prior Name", "Prior Group");
309  //table.top_line(true);
310  table.bottom_line(true);
311  std::unordered_set<std::string> prior_set;
312  for(auto &&n : node)
313  {
314  if (n.second.IsSequence())
315  {
316  for(auto &&v : n.second.as<std::vector<std::string>>())
317  {
318  prior_set.insert(v);
320  table.no_newline() << v << n.first.as<std::string>();
321  }
322  }
323  }
324 
325  for (auto &&v : Gambit::Priors::prior_creators)
326  {
327  if (prior_set.find(v.first) == prior_set.end())
328  {
329  table.no_newline() << v.first << "none";
330  }
331  }
332 
333  table.no_newline() << "" << "";
334  out << "\x1b[01m\x1b[04mPRIOR LIST\x1b[0m\n" << std::endl;
335  out << format_for_screen("For information on a specific prior, see its prior group's diagnostic via \"./gambit group_name\".");
336  out << table.str() << std::endl;
337  out << "\x1b[01m\x1b[04mDESCRIPTION\x1b[0m\n" << std::endl;
338  if (node["priors"])
339  out << format_for_screen(node["priors"].as<std::string>()) << std::endl;
340  }
341  else
342  {
343  std::vector<std::string> prior_names;
344  std::string description;
345  for(auto &&n : node)
346  {
347  if (n.first.as<std::string>() == prior_group)
348  {
349  if (n.second.IsSequence())
350  {
351  prior_names = n.second.as<decltype(prior_names)>();
352  }
353  else if (n.second.IsScalar())
354  {
355  description = n.second.as<std::string>();
356  }
357  }
358  }
359 
360  if (prior_names.size() >0 || description != "")
361  {
362  out << "\x1b[01m\x1b[04mPRIORS INFO\x1b[0m\n" << std::endl;
363  out << "\x1b[01mprior group name: \x1b[0m" << prior_group << std::endl;
364  out << "\x1b[01mpriors: \x1b[0m" << prior_names << "\n" << std::endl;
365  out << "\x1b[01m\x1b[04mDESCRIPTION\x1b[0m\n\n" << description << std::endl;
366  }
367  }
368 
369  return out.str();
370  }
371 
372  std::string Plugin_Loader::print_all(const std::string &plug_type) const
373  {
374  if (plug_type != "")
375  {
376  auto plugins = total_plugin_map.find(plug_type);
377  if (plugins == total_plugin_map.end())
378  {
379  return "";
380  }
381  else
382  {
383  return print_plugins(plugins);
384  }
385  }
386  else
387  {
388  for (auto it = total_plugin_map.begin(), end = total_plugin_map.end(); it != end; it++)
389  {
390  return print_plugins(it);
391  }
392  }
393 
394  return "";
395  }
396 
397  int Plugin_Loader::print_all_to_screen (const std::string &name) const
398  {
399  std::string output = print_all(name);
400  if (output == "")
401  return 1;
402 
403  print_to_screen(output, name);
404  return 0;
405  }
406 
407  std::string Plugin_Loader::print_plugin(const std::string &name) const
408  {
409  std::vector<Scanner::Plugins::Plugin_Details> vec;
410  std::stringstream output;
411  for (auto it_map = getPluginsMap().begin(), end = getPluginsMap().end(); it_map!= end; it_map++)
412  {
413  auto it = it_map->second.find(name);
414  if (it != it_map->second.end())
415  {
416  vec.insert(vec.begin(), it->second.begin(), it->second.end());
417  }
418  }
419 
420  if (vec.size() == 0)
421  {
422  return "";
423  }
424  else
425  {
426  for (auto it = vec.begin(), end = vec.end(); it != end; it++)
427  {
428  output << it->printFull() << std::endl;
429  }
430  }
431 
432  return output.str();
433  }
434 
435  std::string Plugin_Loader::print_plugin(const std::string &type, const std::string &plugin) const
436  {
437  std::stringstream output;
438  std::vector<Scanner::Plugins::Plugin_Details> vec;
439 
440  if((getPluginsMap().find(type) == getPluginsMap().end()) || (getPluginsMap().at(type).find(plugin) == getPluginsMap().at(type).end()))
441  {
442  return "";
443  }
444 
445  for (auto it = getPluginsMap().at(type).at(plugin).begin(), end = getPluginsMap().at(type).at(plugin).end(); it != end; it++)
446  {
447  vec.push_back(*it);
448  }
449 
450  if (vec.size() == 0)
451  {
452  return "";
453  }
454  else
455  {
456  for (auto it = vec.begin(), end = vec.end(); it != end; it++)
457  {
458  output << it->printFull() << std::endl;
459  }
460  }
461 
462  return output.str();
463  }
464 
465  int Plugin_Loader::print_plugin_to_screen (const std::string &name) const
466  {
467  std::string output = print_plugin(name);
468  if (output == "")
469  return 1;
470 
471  print_to_screen(output, name);
472  return 0;
473  }
474 
475  int Plugin_Loader::print_plugin_to_screen (const std::string &type, const std::string &name) const
476  {
477  std::string output = print_plugin(type, name);
478  if (output == "")
479  return 1;
480 
481  print_to_screen(output, name);
482  return 0;
483  }
484 
485  int Plugin_Loader::print_plugin_to_screen (const std::vector<std::string> &names) const
486  {
487  std::string output;
488  for (auto it = names.begin(), end = names.end(); it != end; ++it)
489  {
490  output += print_plugin(*it) + "\n";
491  }
492 
493  if (output == "")
494  return 1;
495 
496  print_to_screen(output, names[0]);
497  return 0;
498  }
499 
500  Plugin_Details &Plugin_Loader::find (const std::string &type, const std::string &plugin, const std::string &version, const std::string &lib) const
501  {
502  std::vector<Plugin_Details_Ref> plugins;
503 
504  if((plugin_map.find(type) == plugin_map.end()) || (plugin_map.at(type).find(plugin) == plugin_map.at(type).end()))
505  {
506  scan_err << "There is no plugin named \"" << plugin <<"\" of type \"" << type << "\"" << scan_end;
507  }
508 
509  for (auto it = plugin_map.at(type).at(plugin).begin(), end = plugin_map.at(type).at(plugin).end(); it != end; it++)
510  {
511  if (VersionCompare(version)(*it) && (lib == "" || lib == it->path) and it->status == "ok")
512  plugins.push_back(*it);
513  }
514 
515  if (plugins.size() > 1)
516  {
517  std::sort(plugins.begin(), plugins.end(), Plugin_Version_Supersedes);
518  auto it2 = plugins.begin();
519  std::vector<Plugin_Details_Ref> matches;
520  for (auto it = it2 + 1, end = plugins.end(); it != end; it++)
521  {
522  if (*it == *it2) matches.push_back(*it);
523  }
524  if (not matches.empty())
525  {
526  scan_err << "More than one plugin met the input criteria in the YAML file:\n\n" << static_cast<Plugin_Details &>(*it2).print() << "\n";
527  for (auto it = matches.begin(); it != matches.end(); it++)
528  {
529  scan_err << static_cast<Plugin_Details &>(*it).print() << "\n";
530  }
531  scan_err << "To indicate to ScannerBit which of these plugins should be used, please"
532  << "\nadd more specific information in the Scanners section of your YAML file." << scan_end;
533  }
534  }
535  else if (plugins.size() == 0)
536  {
537  scan_err << "Plugin \"" << plugin << "\" of type \"" << type << "\" and "
538  << " version \"" << version << "\" is not found." << scan_end;
539  plugins.resize(1);
540  }
541 
542  return plugins[0];
543  }
544 
545  void pluginInfo::iniFile(const Options &options_in)
546  {
547  options = options_in;
548 
549  if (options.getNode().IsMap())
550  {
551  if (options.hasKey("default_output_path"))
552  def_out_path = options.getValue<std::string>("default_output_path");
553  else
554  scan_err << "\"default output path\" must be specified in KeyValues section." << scan_end;
555 
556  for (auto it = options.getNode().begin(), end = options.getNode().end(); it != end; it++)
557  {
558  std::string plug_type = it->first.as<std::string>();
559 
560  if (it->second.IsMap() && plug_type[plug_type.length()-1] == 's' && plug_type != "priors" && plug_type != "parameters")
561  {
562  for (auto it_p = it->second.begin(), end = it->second.end(); it_p != end; it_p++)
563  {
564  std::string plug_tag = it_p->first.as<std::string>();
565 
567 
568  if (it_p->second["plugin"])
569  {
570  temp.plugin = it_p->second["plugin"].as<std::string>();
571  }
572  else
573  {
574  scan_warn << "Plugin name is not defined under the \"" << it->first << "\" tag. "
575  << "using the tag \"" << it_p->first.as<std::string>()
576  << "\" as the plugin name." << scan_end;
577  temp.plugin = it_p->first.as<std::string>();
578  }
579 
580  if (it_p->second["version"])
581  temp.version = it_p->second["version"].as<std::string>();
582 
583  if (it_p->second["plugin_path"])
584  {
585  temp.path = it_p->second["plugin_path"].as<std::string>();
586  plugins.loadLibrary(temp.path, temp.plugin);
587  }
588 
589  selectedPlugins[plug_type.substr(0, plug_type.length()-1)][plug_tag] = temp;
590  }
591  }
592  }
593  }
594  else
595  {
596  scan_err << "Plugins subsection is not of the \"Map\" YAML format." << scan_end;
597  }
598  }
599 
601  {
602  printer = &printerIn;
603  prior = &prior_in;
604  }
605 
606  Plugins::Plugin_Interface_Details pluginInfo::operator()(const std::string &type, const std::string &tag)
607  {
608  if (selectedPlugins.find(type) != selectedPlugins.end() && selectedPlugins[type].find(tag) != selectedPlugins[type].end())
609  {
610  Proto_Plugin_Details &detail = selectedPlugins[type][tag];
611  YAML::Node plugin_options = options.getNode(type + "s", tag);
612 
613  plugin_options["default_output_path"] = options.getValue<std::string>("default_output_path");
614  plugin_options["print_timing_data"] = options.getValue<std::string>("print_timing_data");
615 
616  if (!plugin_options["likelihood: model_invalid_for_lnlike_below"])
617  plugin_options["likelihood: model_invalid_for_lnlike_below"] = options.getValue<double>("model_invalid_for_lnlike_below");
618 
619  if (!plugin_options["likelihood: lnlike_offset"] and options.hasKey("lnlike_offset"))
620  plugin_options["likelihood: lnlike_offset"] = options.getValue<double>("lnlike_offset");
621 
622  return Plugin_Interface_Details(plugins.find(type, detail.plugin, detail.version, detail.path), printer, prior, plugin_options);
623  }
624  else
625  {
626  scan_err << "Plugin \"" << tag << "\" of type \"" << type << "\" is not defined under the \"Scanner\""
627  << " subsection in the inifile" << scan_end;
628 
629  return Plugin_Interface_Details(plugins.find(type, "", "", ""), printer, prior, options.getOptions(type + "s", tag).getNode());
630  }
631  }
632 
634  {
635  for (auto it = resume_data.begin(), end = resume_data.end(); it != end; ++it)
636  {
637  std::string path = Gambit::Utils::ensure_path_exists(def_out_path + "/temp_files/" + it->first);
638  std::ofstream out((path).c_str(), std::ofstream::binary);
639  for (auto v_it = it->second.begin(), v_end = it->second.end(); v_it != v_end; ++v_it)
640  {
641  (*v_it)->print(out);
642  }
643  }
644 
645  printer->finalise(true); //"true" flag for "abnormal" stop; i.e. run is not completely finished
646  // Debugging output
647  // #ifdef WITH_MPI
648  // std::cout << "rank " << getRank() <<": ";
649  // #endif
650  // std::cout << "Gambit has written resume data to disk, preparing to stop!" << std::endl;
651  }
652 
653  void pluginInfo::dump(const std::string &name)
654  {
655  auto it = resume_data.find(name);
656  if (it != resume_data.end())
657  {
658  std::string path = Gambit::Utils::ensure_path_exists(def_out_path + "/temp_files/" + name);
659  std::ofstream out((path).c_str(), std::ofstream::binary);
660  for (auto v_it = it->second.begin(), v_end = it->second.end(); v_it != v_end; ++v_it)
661  {
662  (*v_it)->print(out);
663  }
664  }
665  }
666 
669  {
670  std::string state_fname(def_out_path+"/ALT_MIN_LOGL_IN_USE");
671  std::ofstream outfile(state_fname);
672  outfile.close();
673  }
674 
677  {
678  if(check_alt_min_LogL_state())
679  {
680  std::string state_fname(def_out_path+"/ALT_MIN_LOGL_IN_USE");
681  // Persistence file exists: delete it
682  if (remove(state_fname.c_str())) scan_err << "Failed to delete alternative min_LogL persistence file '" << state_fname << "'! Error was: " << strerror(errno) << scan_end;
683  }
684  }
685 
688  {
689  return Utils::file_exists(def_out_path+"/ALT_MIN_LOGL_IN_USE");
690  }
691 
693  {
694  /*for (auto it = resume_data.begin(), end = resume_data.end(); it != end; ++it)
695  {
696  for (auto v_it = it->second.begin(), v_end = it->second.end(); v_it != v_end; ++v_it)
697  {
698  delete (*v_it);
699  }
700  }*/
701 
702  for (auto it = resume_streams.begin(), end = resume_streams.end(); it != end; ++it)
703  {
704  delete it->second;
705  }
706  }
707 
709  : keepRunning(true), funcCalculating(false), MPIrank(0)
710  #ifdef WITH_MPI
711  , scannerComm(NULL), MPIdata_is_init(false)
712  #endif
713  , earlyShutdownInProgress(false)
714  {}
715 
716  #ifdef WITH_MPI
717  void pluginInfo::initMPIdata(GMPI::Comm* newcomm)
719  {
720  scannerComm = newcomm;
721  MPIdata_is_init = true;
722  MPIrank = scanComm().Get_rank();
723  }
724 
725  GMPI::Comm& pluginInfo::scanComm()
726  {
727  if(not MPIdata_is_init)
728  {
729  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;
730  exit(1); //TODO not sure if this should be a standard GAMBIT error or not. Going with 'not' for now.
731  }
732  return *scannerComm;
733  }
734  #endif
735 
737  }
738  }
739 }
740 
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.
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)