opm-common
CounterLog.hpp
1 /*
2  Copyright 2014 Andreas Lauser
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 OPM_COUNTERLOG_HPP
21 #define OPM_COUNTERLOG_HPP
22 
23 #include <opm/common/OpmLog/LogBackend.hpp>
24 
25 #include <cstddef>
26 #include <cstdint>
27 #include <map>
28 #include <memory>
29 #include <string>
30 
31 namespace Opm {
36  class CounterLog : public LogBackend
37  {
38  public:
39  explicit CounterLog(std::int64_t messageMask);
40  CounterLog();
41 
42  std::size_t numMessages(std::int64_t messageType) const;
43 
44  void clear();
45 
46  protected:
47  void addMessageUnconditionally(std::int64_t messageFlag,
48  const std::string& message) override;
49  private:
50  std::map<std::int64_t , std::size_t> m_count;
51  };
52 
53 } // namespace Opm
54 
55 #endif
void addMessageUnconditionally(std::int64_t messageFlag, const std::string &message) override
This is the method subclasses should override.
Definition: CounterLog.cpp:47
Provides a simple sytem for log message which are found by the Parser/Deck/EclipseState classes durin...
Definition: CounterLog.hpp:36
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Abstract interface class for log backends.
Definition: LogBackend.hpp:36