2012-05-18 09:45:23 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2024-06-18 13:03:48 +02:00
|
|
|
// Copyright (C) 2024 Equinor ASA
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2012-05-18 09:45:23 +02:00
|
|
|
// ResInsight 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2012-05-18 09:45:23 +02:00
|
|
|
// ResInsight 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2012-05-18 09:45:23 +02:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2024-06-18 13:03:48 +02:00
|
|
|
#include "RifEclipseReportKeywords.h"
|
2016-07-14 13:35:32 +02:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2016-07-14 13:35:32 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2024-06-18 13:03:48 +02:00
|
|
|
void RifEclipseReportKeywords::appendKeywordCount( const std::string& keyword,
|
|
|
|
|
size_t valueCount,
|
|
|
|
|
RifEclipseKeywordValueCount::KeywordDataType dataType )
|
2020-02-12 11:13:38 +01:00
|
|
|
{
|
2023-05-09 11:41:56 +02:00
|
|
|
auto it = m_keywordValueCounts.find( keyword );
|
2016-07-14 13:35:32 +02:00
|
|
|
|
2023-05-09 11:41:56 +02:00
|
|
|
if ( it == m_keywordValueCounts.end() )
|
2016-07-14 13:35:32 +02:00
|
|
|
{
|
2024-06-18 13:03:48 +02:00
|
|
|
m_keywordValueCounts[keyword] = RifEclipseKeywordValueCount( keyword, valueCount, dataType );
|
2023-05-09 11:41:56 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
it->second.addValueCount( valueCount );
|
2016-07-14 13:35:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2016-07-14 13:35:32 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2024-06-18 13:03:48 +02:00
|
|
|
void RifEclipseReportKeywords::appendKeywordCount( const RifEclipseReportKeywords& other )
|
2016-07-14 13:35:32 +02:00
|
|
|
{
|
2023-05-09 11:41:56 +02:00
|
|
|
for ( const auto& [keyword, keywordInfo] : other.m_keywordValueCounts )
|
2016-07-14 13:35:32 +02:00
|
|
|
{
|
2023-05-09 11:41:56 +02:00
|
|
|
appendKeywordCount( keyword, keywordInfo.valueCount(), keywordInfo.dataType() );
|
2016-07-14 13:35:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2016-07-14 13:35:32 +02:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2024-06-18 13:03:48 +02:00
|
|
|
std::vector<RifEclipseKeywordValueCount> RifEclipseReportKeywords::keywordValueCounts() const
|
2016-07-14 13:35:32 +02:00
|
|
|
{
|
2024-06-18 13:03:48 +02:00
|
|
|
std::vector<RifEclipseKeywordValueCount> tmp;
|
2023-05-09 11:41:56 +02:00
|
|
|
for ( const auto& [keyword, info] : m_keywordValueCounts )
|
2016-07-14 13:35:32 +02:00
|
|
|
{
|
2023-05-09 11:41:56 +02:00
|
|
|
tmp.push_back( info );
|
2016-07-14 13:35:32 +02:00
|
|
|
}
|
2023-05-09 11:41:56 +02:00
|
|
|
return tmp;
|
2016-07-14 13:35:32 +02:00
|
|
|
}
|