YAP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDL.h
Go to the documentation of this file.
1 /* YAP - Yet another PWA toolkit
2  Copyright 2015, Technische Universitaet Muenchen,
3  Authors: Daniel Greenwald, Johannes Rauch
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
20 
21 #ifndef yap_PDL_h
22 #define yap_PDL_h
23 
24 #include "ParticleFactory.h"
25 
26 #include <iterator>
27 #include <sstream>
28 #include <string>
29 
30 namespace yap {
31 
41 class PDLIterator : public std::iterator<std::input_iterator_tag, std::string>
42 {
43 
44 public:
45 
46  // defined for convenience
47  using char_type = typename std::string::value_type;
48  using traits_type = typename std::string::traits_type;
49  using istream_type = std::basic_istream<char_type, traits_type>;
50 
51 private:
52 
54  PDLIterator() : InputStream_(nullptr) {};
55 
56 public:
57 
60  PDLIterator(istream_type& is) : InputStream_(&is) { ++(*this); };
61 
64  const ParticleTableEntry operator*() const;
65 
69  { return (*this).operator*(); };
70 
77 
80 
82  static const PDLIterator& end()
83  { static PDLIterator PDL_END; return PDL_END; }
84 
86  friend const bool operator==(const PDLIterator& lhs, const PDLIterator& rhs)
87  { return lhs.InputStream_ == rhs.InputStream_; }
88 
89 private:
90 
92  istream_type* InputStream_;
93 
95  std::string Value_;
96 
97 };
98 
100 inline const bool operator!=(const PDLIterator& lhs, const PDLIterator& rhs)
101 { return !(lhs == rhs); }
102 
106 ParticleFactory read_pdl_file(const std::string& filename);
107 
108 }
109 
110 #endif
ParticleTableEntry operator->() const
Definition: PDL.h:68
friend const bool operator==(const PDLIterator &lhs, const PDLIterator &rhs)
equality operator; checks if pointers to streams are equal
Definition: PDL.h:86
PDLIterator & operator++()
Definition: PDL.cxx:49
PDLIterator(istream_type &is)
Definition: PDL.h:60
Data container for storing particle information in database.
Definition: ParticleFactory.h:43
bool operator!=(const CachedValue::Status &S, const CalculationStatus &s)
inequality operator for checking the CalculationStatus
Definition: CachedValue.h:157
static const PDLIterator & end()
Returns just an empty iterator.
Definition: PDL.h:82
istream_type * InputStream_
input stream pointer to file being read in by this
Definition: PDL.h:92
const ParticleTableEntry operator*() const
Definition: PDL.cxx:13
std::string Value_
currently loaded line
Definition: PDL.h:95
Definition: PDL.h:41
PDLIterator()
Default constructor (private).
Definition: PDL.h:54
ParticleFactory read_pdl_file(const std::string &filename)
Definition: PDL.cxx:81