opm-common
ParserRecord.hpp
1 /*
2  Copyright 2013 Statoil ASA.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef PARSERRECORD_HPP
21 #define PARSERRECORD_HPP
22 
23 #include <opm/input/eclipse/Parser/ParserItem.hpp>
24 
25 #include <cstddef>
26 #include <iosfwd>
27 #include <memory>
28 #include <vector>
29 
30 namespace Opm {
31 
32  class Deck;
33  class DeckRecord;
34  class ParseContext;
35  class RawRecord;
36  class ErrorGuard;
37  class UnitSystem;
38  class KeywordLocation;
39 
40  class ParserRecord {
41  public:
42  ParserRecord();
43  std::size_t size() const;
44  void addItem( ParserItem );
45  void addDataItem( ParserItem item );
46  const ParserItem& get(std::size_t index) const;
47  const ParserItem& get(const std::string& itemName) const;
48  DeckRecord parse( const ParseContext&, ErrorGuard&, RawRecord&, UnitSystem& active_unitsystem, UnitSystem& default_unitsystem, const KeywordLocation& location) const;
49  bool isDataRecord() const;
50  bool equal(const ParserRecord& other) const;
51  bool hasDimension() const;
52  bool hasItem(const std::string& itemName) const;
53  std::vector< ParserItem >::const_iterator begin() const;
54  std::vector< ParserItem >::const_iterator end() const;
55 
56  bool operator==( const ParserRecord& ) const;
57  bool operator!=( const ParserRecord& ) const;
58  bool rawStringRecord() const;
59  const std::string& end_string() const;
60 
61  private:
62  bool m_dataRecord;
63  std::vector< ParserItem > m_items;
64  bool raw_string_record = false;
65  std::string record_end = "/";
66  };
67 
68 std::ostream& operator<<( std::ostream&, const ParserRecord& );
69 }
70 
71 #endif /* PARSERRECORD_HPP */
Definition: KeywordLocation.hpp:27
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: ParserRecord.hpp:40
Definition: UnitSystem.hpp:34
Class representing the lowest level of the Raw datatypes, a record.
Definition: RawRecord.hpp:37
Control parser behaviour in failure conditions.
Definition: ParseContext.hpp:114
Definition: ParserItem.hpp:61
Definition: DeckRecord.hpp:33
Definition: ErrorGuard.hpp:30