KeywordLoader.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2015 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 
21 #ifndef KEYWORD_LOADER_HPP
22 #define KEYWORD_LOADER_HPP
23 #include <memory>
24 #include <string>
25 #include <map>
26 
27 #include <opm/json/JsonObject.hpp>
29 
30 namespace Opm {
31  class KeywordLoader {
32 
33  public:
34  KeywordLoader(bool verbose);
35  size_t size() const;
36  bool hasKeyword(const std::string& keyword) const;
37  std::shared_ptr<const ParserKeyword> getKeyword(const std::string& keyword) const;
38  std::string getJsonFile(const std::string& keyword) const;
39  size_t loadKeywordDirectory(const std::string& pathname);
40  size_t loadKeywordDirectory(boost::filesystem::path& path);
41  void loadKeyword(const std::string& filename);
42  void loadKeyword(boost::filesystem::path& path);
43 
44  static std::vector<std::string> sortSubdirectories( const std::string& directory );
45  size_t loadMultipleKeywordDirectories(const std::string& directory);
46 
47  std::map<std::string , std::shared_ptr<ParserKeyword> >::const_iterator keyword_begin( ) const;
48  std::map<std::string , std::shared_ptr<ParserKeyword> >::const_iterator keyword_end( ) const;
49  private:
50  void addKeyword(std::shared_ptr<ParserKeyword> keyword , const std::string& jsonFile);
51 
52  bool m_verbose;
53  std::map<std::string , std::shared_ptr<ParserKeyword> > m_keywords;
54  std::map<std::string , std::string > m_jsonFile;
55  };
56 }
57 
58 #endif
size_t loadKeywordDirectory(const std::string &pathname)
Definition: Deck.hpp:29
size_t loadMultipleKeywordDirectories(const std::string &directory)
std::map< std::string, std::shared_ptr< ParserKeyword > >::const_iterator keyword_begin() const
KeywordLoader(bool verbose)
bool hasKeyword(const std::string &keyword) const
Definition: KeywordLoader.hpp:31
size_t size() const
void loadKeyword(const std::string &filename)
std::shared_ptr< const ParserKeyword > getKeyword(const std::string &keyword) const
std::map< std::string, std::shared_ptr< ParserKeyword > >::const_iterator keyword_end() const
std::string getJsonFile(const std::string &keyword) const
static std::vector< std::string > sortSubdirectories(const std::string &directory)