InputParser.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 HEPfit Collaboration
3  * All rights reserved.
4  *
5  * For the licensing terms see doc/COPYING.
6  */
7 
8 #ifndef INPUTPARSER_H
9 #define INPUTPARSER_H
10 
11 #include "ThObsFactory.h"
12 #include "ModelFactory.h"
13 #include "Observable.h"
14 #include "Observable2D.h"
15 #include "CorrelatedGaussianObservables.h"
17 #include "HiggsObservable.h"
18 #include "ThObservable.h"
19 #include "ModelParameter.h"
20 #include "StandardModel.h"
21 #include <iostream>
22 #include <fstream>
23 #include <istream>
24 #include <boost/tokenizer.hpp>
25 #include <boost/ptr_container/ptr_vector.hpp>
26 #include <boost/tuple/tuple.hpp>
27 #include <boost/function.hpp>
28 #include <string>
29 
49 class InputParser {
50 public:
51 
56 
61  InputParser(const InputParser& orig);
62 
66  virtual ~InputParser();
67 
74 // CorrelatedGaussianObservables ParseCGO(boost::ptr_vector<Observable>& Observables, std::ifstream& ifile, boost::tokenizer<boost::char_separator<char> >::iterator& beg);
75 
97  std::string ReadParameters(const std::string filename_i,
98  const int rank,
99  std::vector<ModelParameter>& ModelPars,
100  boost::ptr_vector<Observable>& Observables,
101  std::vector<Observable2D>& Observables2D,
102  std::vector<CorrelatedGaussianObservables>& CGO,
103  std::vector<CorrelatedGaussianParameters>& CGP);
104 
111  {
112  return myModel;
113  }
114 
116  {
117  return myObsFactory;
118  }
119 
121  return myModelFactory;
122  }
123 
124  void addCustomObservableType(const std::string name, boost::function<Observable*() > funct);
125 
126  Observable * CreateObservableType(const std::string& name) const;
127 
128  void setModel(StandardModel* myModel_i){
129  myModel = myModel_i;
130  }
131 
132 private:
136  std::string modname;
137  bool modelset;
138  std::map <std::string, boost::tuple<bool, std::string, int> > checkDuplicateParameter;
139  std::string modeldefinedinfile;
140  //std::map<std::string, boost::function<InputParser*(ModelFactory&, ThObsFactory&) > > customParserMap;
141  std::map<std::string, boost::function<Observable* ()> > customObservableTypeMap;
142  //std::map<std::string, std::string> ObservableToParsermap;
143  int lineNo;
144  std::string filename;
145  int rank;
146  std::string filepath;
147  boost::tokenizer<boost::char_separator<char> > *tok;
148  boost::char_separator<char> * sep;
149  std::string line;
150  bool IsEOF;
151 };
152 
157 #endif /* INPUTPARSER_H */
virtual ~InputParser()
The default destructor.
Definition: InputParser.cpp:25
boost::char_separator< char > * sep
Definition: InputParser.h:148
ThObsFactory & myObsFactory
Reference to an object of type ThObsFactory.
Definition: InputParser.h:135
std::string ReadParameters(const std::string filename_i, const int rank, std::vector< ModelParameter > &ModelPars, boost::ptr_vector< Observable > &Observables, std::vector< Observable2D > &Observables2D, std::vector< CorrelatedGaussianObservables > &CGO, std::vector< CorrelatedGaussianParameters > &CGP)
The member that parses the Observable2D directives from SomeModel.conf file.
Definition: InputParser.cpp:28
void setModel(StandardModel *myModel_i)
Definition: InputParser.h:128
const ThObsFactory & getObsFactory() const
Definition: InputParser.h:115
A class for.
Definition: ModelFactory.h:25
A class for.
Definition: ThObsFactory.h:26
ModelFactory & getModelFactory() const
Definition: InputParser.h:120
std::string line
Definition: InputParser.h:149
Observable * CreateObservableType(const std::string &name) const
A model class for the Standard Model.
StandardModel * myModel
Pointer to an object of type StandardModel.
Definition: InputParser.h:133
void addCustomObservableType(const std::string name, boost::function< Observable *() > funct)
std::string filepath
Definition: InputParser.h:146
std::string filename
Definition: InputParser.h:144
boost::tokenizer< boost::char_separator< char > > * tok
Definition: InputParser.h:147
A class for observables.
Definition: Observable.h:28
A class for reading input parameters and output directives.
Definition: InputParser.h:49
ModelFactory & myModelFactory
Pointer to an object of type ModelFactory.
Definition: InputParser.h:134
InputParser(ModelFactory &ModF, ThObsFactory &ObsF)
Constructor.
Definition: InputParser.cpp:15
std::string modname
A string to store the model name in.
Definition: InputParser.h:136
std::map< std::string, boost::tuple< bool, std::string, int > > checkDuplicateParameter
Definition: InputParser.h:138
StandardModel * getModel() const
A get method to access the pointer to the object of the StandardModel class.
Definition: InputParser.h:110
My own Model.
Definition: myModel.h:17
std::map< std::string, boost::function< Observable *()> > customObservableTypeMap
Definition: InputParser.h:141
std::string modeldefinedinfile
Definition: InputParser.h:139