ParserRecord.hpp
Go to the documentation of this file.
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 <vector>
24 #include <map>
25 #include <memory>
26 
31 
32 
33 namespace Opm {
34 
35  class ParserRecord {
36  public:
37  ParserRecord();
38  size_t size() const;
39  void addItem( ParserItemConstPtr item );
41  ParserItemConstPtr get(size_t index) const;
42  ParserItemConstPtr get(const std::string& itemName) const;
43  DeckRecordConstPtr parse(const ParseMode& parseMode , RawRecordPtr rawRecord) const;
44  bool isDataRecord() const;
45  bool equal(const ParserRecord& other) const;
46  bool hasDimension() const;
47  bool hasItem(const std::string& itemName) const;
48  void applyUnitsToDeck(std::shared_ptr<const Deck> deck , std::shared_ptr<const DeckRecord> deckRecord) const;
49  std::vector<ParserItemConstPtr>::const_iterator begin() const;
50  std::vector<ParserItemConstPtr>::const_iterator end() const;
51  private:
52  bool m_dataRecord;
53  std::vector<ParserItemConstPtr> m_items;
54  std::map<std::string , ParserItemConstPtr> m_itemMap;
55  };
56 
57  typedef std::shared_ptr<const ParserRecord> ParserRecordConstPtr;
58  typedef std::shared_ptr<ParserRecord> ParserRecordPtr;
59 }
60 
61 
62 #endif /* PARSERRECORD_HPP */
63 
bool equal(const ParserRecord &other) const
bool isDataRecord() const
Definition: Deck.hpp:29
bool hasItem(const std::string &itemName) const
std::vector< ParserItemConstPtr >::const_iterator end() const
size_t size() const
void applyUnitsToDeck(std::shared_ptr< const Deck > deck, std::shared_ptr< const DeckRecord > deckRecord) const
std::shared_ptr< const ParserItem > ParserItemConstPtr
Definition: ParserItem.hpp:102
Definition: ParseMode.hpp:78
std::vector< ParserItemConstPtr >::const_iterator begin() const
bool hasDimension() const
void addItem(ParserItemConstPtr item)
void addDataItem(ParserItemConstPtr item)
Definition: ParserRecord.hpp:35
std::shared_ptr< ParserRecord > ParserRecordPtr
Definition: ParserRecord.hpp:58
std::shared_ptr< const DeckRecord > DeckRecordConstPtr
Definition: DeckRecord.hpp:54
std::shared_ptr< RawRecord > RawRecordPtr
Definition: RawRecord.hpp:64
DeckRecordConstPtr parse(const ParseMode &parseMode, RawRecordPtr rawRecord) const
std::shared_ptr< const ParserRecord > ParserRecordConstPtr
Definition: ParserRecord.hpp:57