DeckStringItem.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 DECKSTRINGITEM_HPP
21 #define DECKSTRINGITEM_HPP
22 
23 #include <string>
24 #include <vector>
25 #include <deque>
26 #include <memory>
28 
29 namespace Opm {
30 
31  class DeckStringItem : public DeckItem {
32  public:
33 
34  DeckStringItem(std::string name_, bool scalar = true) : DeckItem(name_, scalar) {
35  }
36  const std::string& getString(size_t index) const;
37  const std::vector<std::string>& getStringData() const;
38 
39  std::string getTrimmedString(size_t index) const;
40 
41  void push_back(std::deque<std::string> data, size_t items);
42  void push_back(std::deque<std::string> data);
43  void push_back(const std::string& value);
44  void push_backDefault(std::string value);
45  // trying to access the data of a "dummy default item" will raise an exception
46  void push_backDummyDefault();
47  void push_backMultiple(std::string value, size_t numItems);
48 
49  size_t size() const;
50  private:
51  std::vector<std::string> m_data;
52  };
53 
54  typedef std::shared_ptr<DeckStringItem> DeckStringItemPtr;
55  typedef std::shared_ptr<const DeckStringItem> DeckStringItemConstPtr;
56 }
57 #endif
58 
std::shared_ptr< DeckStringItem > DeckStringItemPtr
Definition: DeckStringItem.hpp:54
void push_backDefault(std::string value)
std::shared_ptr< const DeckStringItem > DeckStringItemConstPtr
Definition: DeckStringItem.hpp:55
Definition: Deck.hpp:29
const std::vector< std::string > & getStringData() const
Definition: DeckStringItem.hpp:31
size_t size() const
void push_back(std::deque< std::string > data, size_t items)
Definition: DeckItem.hpp:31
void push_backDummyDefault()
DeckStringItem(std::string name_, bool scalar=true)
Definition: DeckStringItem.hpp:34
void push_backMultiple(std::string value, size_t numItems)
const std::string & getString(size_t index) const
std::string getTrimmedString(size_t index) const