CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LHERunInfoProduct.h
Go to the documentation of this file.
1 #ifndef SimDataFormats_GeneratorProducts_LHERunInfoProduct_h
2 #define SimDataFormats_GeneratorProducts_LHERunInfoProduct_h
3 
4 #include <iterator>
5 #include <memory>
6 #include <vector>
7 #include <string>
8 
9 //#include <hepml.hpp>
10 
12 
14  public:
15  typedef std::vector<std::pair<std::string,std::string> > weights_defs;
16  class Header {
17  public:
18  typedef std::vector<std::string>::const_iterator const_iterator;
20 
21  Header() {}
22  Header(const std::string &tag) : tag_(tag) {}
23  ~Header() {}
24 
25  void addLine(const std::string &line) { lines_.push_back(line); }
26 
27  const std::string &tag() const { return tag_; }
28 
29  size_type size() const { return lines_.size(); }
30  const_iterator begin() const { return lines_.begin(); }
31  const_iterator end() const { return lines_.end(); }
32 
33  bool operator == (const Header &other) const
34  { return tag_ == other.tag_ && lines_ == other.lines_; }
35  inline bool operator != (const Header &other) const
36  { return !(*this == other); }
37 
38  private:
39  std::string tag_;
40  std::vector<std::string> lines_;
41  };
42 
44  typedef std::vector<Header>::const_iterator headers_const_iterator;
45  typedef std::vector<std::string>::const_iterator
47 
51 
52  void addHeader(const Header &header) { headers_.push_back(header); }
53  void addComment(const std::string &line) { comments_.push_back(line); }
54 
55  const lhef::HEPRUP &heprup() const { return heprup_; }
56 
57  size_type headers_size() const { return headers_.size(); }
58  headers_const_iterator headers_begin() const { return headers_.begin(); }
59  headers_const_iterator headers_end() const { return headers_.end(); }
60 
61  size_type comments_size() const { return comments_.size(); }
62  comments_const_iterator comments_begin() const { return comments_.begin(); }
64 
66  public:
67  typedef std::forward_iterator_tag iterator_category;
68  typedef std::string value_type;
69  typedef std::ptrdiff_t difference_type;
70  typedef std::string *pointer;
71  typedef std::string &reference;
72 
75 
76  bool operator == (const const_iterator &other) const;
77  inline bool operator != (const const_iterator &other) const
78  { return !operator == (other); }
79 
81  { next(); return *this; }
82  inline const_iterator operator ++ (int dummy)
83  { const_iterator orig = *this; next(); return orig; }
84 
85  const std::string &operator * () const { return tmp; }
86  const std::string *operator -> () const { return &tmp; }
87 
88  private:
89  friend class LHERunInfoProduct;
90 
91  void next();
92 
93  enum Mode {
99  };
100 
105  unsigned int line;
106  std::string tmp;
107  };
108 
109  const_iterator begin() const;
110  const_iterator init() const;
111  inline const_iterator end() const { return const_iterator(); }
112 
113  static const std::string &endOfFile();
114 
115  bool operator == (const LHERunInfoProduct &other) const
116  { return heprup_ == other.heprup_ && headers_ == other.headers_ && comments_ == other.comments_; }
117  inline bool operator != (const LHERunInfoProduct &other) const
118  { return !(*this == other); }
119 
120  bool mergeProduct(const LHERunInfoProduct &other);
121  bool isProductEqual(const LHERunInfoProduct &other) const
122  { return *this == other; }
123 
124  private:
126  std::vector<Header> headers_;
127  std::vector<std::string> comments_;
128 };
129 
130 #endif // GeneratorRunInfo_LHEInterface_LHERunInfoProduct_h
std::vector< Header >::const_iterator headers_const_iterator
void addHeader(const Header &header)
std::forward_iterator_tag iterator_category
bool operator!=(const LHERunInfoProduct &other) const
comments_const_iterator comments_end() const
std::vector< std::pair< std::string, std::string > > weights_defs
LHERunInfoProduct(const lhef::HEPRUP &heprup)
const LHERunInfoProduct * runInfo
headers_const_iterator headers_end() const
bool operator!=(const const_iterator &other) const
std::vector< std::string >::const_iterator const_iterator
const_iterator end() const
bool isProductEqual(const LHERunInfoProduct &other) const
uint16_t size_type
const lhef::HEPRUP & heprup() const
const std::string & operator*() const
bool operator==(const const_iterator &other) const
headers_const_iterator headers_begin() const
bool operator!=(const Header &other) const
void addLine(const std::string &line)
const std::string & tag() const
bool operator==(const LHERunInfoProduct &other) const
std::vector< std::string >::size_type size_type
size_type comments_size() const
void addComment(const std::string &line)
bool operator==(const Header &other) const
std::vector< Header >::size_type size_type
comments_const_iterator comments_begin() const
std::vector< std::string >::const_iterator comments_const_iterator
bool mergeProduct(const LHERunInfoProduct &other)
Header(const std::string &tag)
size_type headers_size() const
std::vector< Header > headers_
static const std::string & endOfFile()
std::vector< std::string > lines_
const_iterator end() const
const_iterator init() const
std::vector< std::string > comments_
const_iterator begin() const
const std::string * operator->() const
const_iterator begin() const