2013-05-06 12:13:49 +02:00
|
|
|
/*
|
|
|
|
|
Copyright 2013 Statoil ASA.
|
|
|
|
|
|
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
#ifndef PARSER_ITEM_H
|
|
|
|
|
#define PARSER_ITEM_H
|
|
|
|
|
|
|
|
|
|
#include <string>
|
2013-05-07 21:55:49 +02:00
|
|
|
#include <sstream>
|
2013-05-06 12:13:49 +02:00
|
|
|
#include <iostream>
|
2013-08-23 15:39:08 +02:00
|
|
|
#include <deque>
|
2013-05-13 16:41:09 +02:00
|
|
|
|
2013-12-02 13:07:01 +01:00
|
|
|
#include <memory>
|
2013-05-13 16:41:09 +02:00
|
|
|
#include <boost/lexical_cast.hpp>
|
2013-05-06 12:13:49 +02:00
|
|
|
|
2013-07-31 16:15:22 +02:00
|
|
|
#include <opm/json/JsonObject.hpp>
|
|
|
|
|
|
2013-05-09 12:17:00 +02:00
|
|
|
#include <opm/parser/eclipse/Parser/ParserEnums.hpp>
|
2013-05-13 16:41:09 +02:00
|
|
|
#include <opm/parser/eclipse/RawDeck/RawRecord.hpp>
|
2013-05-24 10:09:59 +02:00
|
|
|
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
|
|
|
|
|
2013-05-06 12:13:49 +02:00
|
|
|
|
|
|
|
|
namespace Opm {
|
2013-08-23 14:35:47 +02:00
|
|
|
|
2013-12-09 20:19:29 +01:00
|
|
|
class ParserItem {
|
|
|
|
|
public:
|
|
|
|
|
ParserItem(const std::string& itemName);
|
|
|
|
|
ParserItem(const std::string& itemName, ParserItemSizeEnum sizeType);
|
2013-12-17 15:56:12 +01:00
|
|
|
explicit ParserItem(const Json::JsonObject& jsonConfig);
|
2013-12-11 13:24:27 +01:00
|
|
|
|
|
|
|
|
virtual void push_backDimension(const std::string& dimension);
|
2013-12-10 17:34:52 +01:00
|
|
|
virtual const std::string& getDimension(size_t index) const;
|
2013-12-14 10:11:59 +01:00
|
|
|
virtual DeckItemPtr scan(RawRecordPtr rawRecord) const = 0;
|
2013-12-09 21:12:27 +01:00
|
|
|
virtual bool hasDimension() const;
|
2013-12-10 17:34:52 +01:00
|
|
|
virtual size_t numDimensions() const;
|
2013-12-09 20:19:29 +01:00
|
|
|
const std::string& name() const;
|
|
|
|
|
ParserItemSizeEnum sizeType() const;
|
2014-01-09 13:33:32 +01:00
|
|
|
std::string getHelpText() const;
|
|
|
|
|
void setHelpText(std::string helpText);
|
|
|
|
|
|
2013-12-09 20:19:29 +01:00
|
|
|
static int defaultInt();
|
|
|
|
|
static std::string defaultString();
|
|
|
|
|
static double defaultDouble();
|
|
|
|
|
|
|
|
|
|
virtual bool equal(const ParserItem& other) const;
|
|
|
|
|
virtual void inlineNew(std::ostream& os) const {}
|
|
|
|
|
|
|
|
|
|
virtual ~ParserItem() {
|
|
|
|
|
}
|
2013-05-24 10:09:59 +02:00
|
|
|
|
2013-12-09 20:19:29 +01:00
|
|
|
protected:
|
|
|
|
|
bool m_defaultSet;
|
2013-05-13 16:41:09 +02:00
|
|
|
|
2013-10-16 14:57:01 +02:00
|
|
|
|
2013-05-24 10:09:59 +02:00
|
|
|
|
2013-12-09 20:19:29 +01:00
|
|
|
private:
|
|
|
|
|
std::string m_name;
|
|
|
|
|
ParserItemSizeEnum m_sizeType;
|
2014-01-09 13:33:32 +01:00
|
|
|
std::string m_helpText;
|
2013-12-09 20:19:29 +01:00
|
|
|
};
|
2013-05-24 10:09:59 +02:00
|
|
|
|
2013-12-09 20:19:29 +01:00
|
|
|
typedef std::shared_ptr<const ParserItem> ParserItemConstPtr;
|
|
|
|
|
typedef std::shared_ptr<ParserItem> ParserItemPtr;
|
2013-10-16 09:59:32 +02:00
|
|
|
|
|
|
|
|
|
2013-05-08 14:31:20 +02:00
|
|
|
}
|
2013-05-06 12:13:49 +02:00
|
|
|
|
2013-05-08 14:31:20 +02:00
|
|
|
#endif
|
2013-05-07 21:55:49 +02:00
|
|
|
|