CMS 3D CMS Logo

Classes | Functions
AllInOneConfig Namespace Reference

Classes

class  ConfigError
 
class  Options
 

Functions

void check_file (string file)
 
std::string colorify (std::string s)
 
void dump (const boost::property_tree::ptree &tree)
 
template<int FUNC>
int exceptions (int argc, char *argv[])
 
void set_silent (bool flag)
 
void set_verbose (bool flag)
 

Function Documentation

◆ check_file()

void AllInOneConfig::check_file ( string  file)

Definition at line 17 of file Options.cc.

References DMR_cfg::cerr, beamvalidation::exit(), and geometryDiff::file.

17  {
18  // check that the config file exists
19  if (!fs::exists(file)) {
20  cerr << "Didn't find configuration file " << file << '\n';
21  exit(EXIT_FAILURE);
22  }
23  }
def exit(msg="")

◆ colorify()

std::string AllInOneConfig::colorify ( std::string  s)
inline

Definition at line 28 of file exceptions.h.

References DivergingColor::red, and alignCSCRings::s.

Referenced by exceptions().

28  {
29  const char *red = "\x1B[31m" /*, * green = "\x1B[32m"*/ /*, * black = "\x1B[30m"*/;
30  return red + s /*+ black*/; // TODO: clarify colours...
31  }

◆ dump()

void AllInOneConfig::dump ( const boost::property_tree::ptree &  tree)
inline

Definition at line 13 of file toolbox.h.

References gather_cfg::cout, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, submitPVResolutionJobs::key, and AlCaHLTBitMon_QueryRunRegistry::string.

13  {
14  for (const auto& it : tree) {
15  auto key = it.first, value = tree.get<std::string>(key);
16  std::cout << key << '\t' << value << '\n';
17  }
18  std::cout << std::flush;
19  }
key
prepare the HTCondor submission files and eventually submit them
Definition: value.py:1
Definition: tree.py:1

◆ exceptions()

template<int FUNC>
int AllInOneConfig::exceptions ( int  argc,
char *  argv[] 
)

Definition at line 34 of file exceptions.h.

References dir2webdir::argc, GCPpyPlots::argv, DMR_cfg::cerr, colorify(), MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ext::basic_imemstream< Item_t, Traits_t, Allocator_t >::basic_imemstream(), and ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::basic_omemstream().

34  {
35  try {
36  return FUNC(argc, argv);
37  } catch (const boost::exception &e) {
38  std::cerr << colorify("Boost exception: ") << boost::diagnostic_information(e);
39  throw;
40  } catch (const boost::property_tree::ptree_bad_data &e) {
41  std::cerr << colorify("Property Tree Bad Data Error: ") << e.data<std::string>() << '\n';
42  } catch (const boost::property_tree::ptree_bad_path &e) {
43  std::cerr << colorify("Property Tree Bad Path Error: ") << e.path<std::string>() << '\n';
44  } catch (const boost::property_tree::ptree_error &e) {
45  std::cerr << colorify("Property Tree Error: ") << e.what() << '\n';
46  } catch (const boost::filesystem::filesystem_error &e) {
47  std::cerr << colorify("Filesystem Error:") << e.what() << '\n';
48  } catch (const std::logic_error &e) {
49  std::cerr << colorify("Logic Error: ") << e.what() << '\n';
50  } catch (const std::exception &e) {
51  std::cerr << colorify("Standard Error: ") << e.what() << '\n';
52  }
53  return EXIT_FAILURE;
54  }
std::string colorify(std::string s)
Definition: exceptions.h:28

◆ set_silent()

void AllInOneConfig::set_silent ( bool  flag)

Definition at line 30 of file Options.cc.

References DMR_cfg::cerr, and RemoveAddSevLevel::flag.

30  {
31  if (flag)
32  cerr.setstate(ios_base::failbit);
33  }

◆ set_verbose()

void AllInOneConfig::set_verbose ( bool  flag)

Definition at line 25 of file Options.cc.

References gather_cfg::cout, and RemoveAddSevLevel::flag.

25  {
26  if (!flag)
27  cout.setstate(ios_base::failbit);
28  }