///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2016- Statoil ASA // // 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. // // 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. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "cvfBase.h" #include "cvfObject.h" #include #include #include #include //================================================================================================== // // //================================================================================================== class RigCaseRealizationParameters { public: // Internal class class Value { enum ValueType { TYPE_NONE, TYPE_NUMERIC, TYPE_TEXT }; public: Value(); Value(double value); Value(const QString& value); void setValue(double value); void setValue(const QString& value); bool isValid() const { return m_valueType != TYPE_NONE; } bool isNumeric() const { return m_valueType == TYPE_NUMERIC; } bool isText() const { return m_valueType == TYPE_TEXT; } double numericValue() const; const QString& textValue() const; private: ValueType m_valueType; double m_numericValue; QString m_textValue; }; RigCaseRealizationParameters() : m_parametersHash(0) { } void addParameter(const QString& name, double value); void addParameter(const QString& name, const QString& value); Value parameterValue(const QString& name); std::map parameters() const; std::set parameterNames() const; size_t parameterHash(const QString& name) const; size_t parametersHash(); void clearParametersHash(); void calculateParametersHash(const std::set& paramNames = std::set()); private: std::map m_parameters; size_t m_parametersHash; };