Removed MessageContainer. OpmLog used instead.

...

...

...

GenerateKeywords.cmake changed.

ParserContext.handleerror takes only two args.

Schedule: removed all MessageContainer.

...

...

...

GridProperties: removed MessageContiner.

...

Eclipse3DProperties: removed MessageContainer.

...

TabelManager:removed MessageContainer.

...

.nnn.

...

...

...

...

...

...

...

...

...

...

...

...

...
This commit is contained in:
Steinar Foss
2018-03-22 11:07:14 +01:00
parent b4d69b929d
commit d9ffb579e1
36 changed files with 102 additions and 610 deletions

View File

@@ -1,108 +0,0 @@
/*
Copyright 2016 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 MESSAGECONTAINER_H
#define MESSAGECONTAINER_H
#include <string>
#include <vector>
#include <memory>
namespace Opm {
struct Location {
Location() = default;
Location( const std::string&, size_t );
std::string filename;
size_t lineno = 0;
explicit operator bool() const {
return lineno != 0;
}
};
struct Message {
enum type {
Debug = 1,
Note = 2,
Info = 3,
Warning = 4,
Error = 5,
Problem = 6,
Bug = 7
};
Message( type mt, const std::string& msg, Location&& loc ) :
mtype( mt ), message( msg ), location( std::move( loc ) ) {}
Message( type mt, const std::string& msg ) :
mtype( mt ), message( msg ) {}
type mtype;
std::string message;
Location location;
};
///Message container is used to replace OpmLog functionalities.
class MessageContainer {
public:
using const_iterator = std::vector< Message >::const_iterator;
void error(const std::string& msg, const std::string& filename, const size_t lineno);
void error(const std::string& msg);
void bug(const std::string& msg, const std::string& filename, const size_t lineno);
void bug(const std::string& msg);
void warning(const std::string& msg, const std::string& filename, const size_t lineno);
void warning(const std::string& msg);
void info(const std::string& msg, const std::string& filename, const size_t lineno);
void info(const std::string& msg);
void debug(const std::string& msg, const std::string& filename, const size_t lineno);
void debug(const std::string& msg);
void problem(const std::string& msg, const std::string& filename, const size_t lineno);
void problem(const std::string& msg);
void note(const std::string& msg, const std::string& filename, const size_t lineno);
void note(const std::string& msg);
void add( const Message& );
void add( Message&& );
void appendMessages(const MessageContainer& other);
const_iterator begin() const;
const_iterator end() const;
std::size_t size() const;
private:
std::vector<Message> m_messages;
};
} // namespace Opm
#endif // OPM_MESSAGECONTAINER_HEADER_INCLUDED

View File

@@ -25,8 +25,9 @@
#include <map>
#include <vector>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/parser/eclipse/Parser/InputErrorAction.hpp>
#include <opm/parser/eclipse/Parser/MessageContainer.hpp>
namespace Opm {
@@ -82,7 +83,7 @@ namespace Opm {
explicit ParseContext(InputError::Action default_action);
explicit ParseContext(const std::vector<std::pair<std::string , InputError::Action>>& initial);
Message::type handleError( const std::string& errorKey, MessageContainer& msgContainer, const std::string& msg ) const;
void handleError( const std::string& errorKey, const std::string& msg ) const;
bool hasKey(const std::string& key) const;
ParseContext withKey(const std::string& key, InputError::Action action = InputError::WARN) const;
ParseContext& withKey(const std::string& key, InputError::Action action = InputError::WARN);

View File

@@ -40,7 +40,6 @@ namespace Opm {
class ParserDoubleItem;
class RawKeyword;
class string_view;
class MessageContainer;
/*
Small helper struct to assemble the information needed to infer the size
@@ -123,7 +122,7 @@ namespace Opm {
SectionNameSet::const_iterator validSectionNamesBegin() const;
SectionNameSet::const_iterator validSectionNamesEnd() const;
DeckKeyword parse(const ParseContext& parseContext , MessageContainer& msgContainer, std::shared_ptr< RawKeyword > rawKeyword) const;
DeckKeyword parse(const ParseContext& parseContext , std::shared_ptr< RawKeyword > rawKeyword) const;
enum ParserKeywordSizeEnum getSizeType() const;
const KeywordSize& getKeywordSize() const;
bool isDataKeyword() const;

View File

@@ -33,7 +33,6 @@ namespace Opm {
class ParseContext;
class ParserItem;
class RawRecord;
class MessageContainer;
class ParserRecord {
public:
@@ -43,7 +42,7 @@ namespace Opm {
void addDataItem( ParserItem item );
const ParserItem& get(size_t index) const;
const ParserItem& get(const std::string& itemName) const;
DeckRecord parse( const ParseContext&, MessageContainer&, RawRecord& ) const;
DeckRecord parse( const ParseContext&, RawRecord& ) const;
bool isDataRecord() const;
bool equal(const ParserRecord& other) const;
bool hasDimension() const;