gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
yaml_parser.hpp
Go to the documentation of this file.
1 // GAMBIT: Global and Modular BSM Inference Tool
2 // *********************************************
26 
27 #ifndef __yaml_parser_hpp__
28 #define __yaml_parser_hpp__
29 
33 
34 #include "yaml-cpp/yaml.h"
35 
36 
37 namespace Gambit
38 {
39 
40  namespace IniParser
41  {
42 
43  namespace Types
44  {
45 
46  // Dependency and Observable have the same type (and purpose entry is
47  // irrelevant for dependencies)
48  struct Observable
49  {
50  std::string purpose;
51  std::string capability;
52  std::string type;
53  std::string function;
54  std::string module;
55  std::string backend;
56  std::string version;
57  bool printme; // Instruction to printer as to whether to write result to disk
58  bool weakrule; // Indicates that rule can be broken
60  YAML::Node subcaps;
61  std::vector<Observable> dependencies;
62  std::vector<Observable> backends;
63  std::vector<std::string> functionChain;
64 
67  purpose(),
68  capability(),
69  type(),
70  function(),
71  module(),
72  backend(),
73  version(),
74  printme(true),
75  options(),
76  subcaps(),
77  dependencies(),
78  backends(),
79  functionChain()
80  {}
81  };
82 
83  }
84 
86  typedef std::vector<ObservableType> ObservablesType;
87 
89  class IniFile : public Parser
90  {
91 
92  public:
93 
95  virtual void readFile(str filename);
96 
99  const ObservablesType & getObservables() const;
100  const ObservablesType & getRules() const;
102 
103  private:
104  ObservablesType observables;
105  ObservablesType rules;
106 
107  };
108 
109 
110  }
111 
112 }
113 
114 
115 // Rules for inifile --> Observable mapping
116 namespace YAML
117 {
118  template<>
119  struct convert<Gambit::IniParser::Types::Observable>
120  {
121  static bool decode(const Node&, Gambit::IniParser::Types::Observable&);
122  };
123 }
124 
125 
126 #endif /* defined(__yaml_parser_hpp__) */
std::vector< std::string > functionChain
Definition: yaml_parser.hpp:63
Observable()
Default constructor, to ensure the default values are not gibberish.
Definition: yaml_parser.hpp:66
std::vector< Observable > backends
Definition: yaml_parser.hpp:62
Base class for ini-file parsers using yaml-cpp.
ObservablesType observables
General small utility functions.
YAML overloads for mass cut and mass cut ratio constituents.
std::vector< ObservableType > ObservablesType
Definition: yaml_parser.hpp:86
std::vector< Observable > dependencies
Definition: yaml_parser.hpp:61
Types::Observable ObservableType
Definition: yaml_parser.hpp:85
Inifile parser base class.
std::string str
Shorthand for a standard string.
Definition: Analysis.hpp:35
Main inifile class.
Definition: yaml_parser.hpp:89
Simple container used for storing info about which types have been defined as equivalent for depencen...
TODO: see if we can use this one:
Definition: Analysis.hpp:33
A small wrapper object for &#39;options&#39; nodes.