diff --git a/opm/models/utils/parametersystem.cpp b/opm/models/utils/parametersystem.cpp index 501bd1631..ab32421b0 100644 --- a/opm/models/utils/parametersystem.cpp +++ b/opm/models/utils/parametersystem.cpp @@ -137,11 +137,31 @@ std::string transformKey(const std::string& s, return result; } - } // anonymous namespace namespace Opm::Parameters { +namespace detail { + +void Hide_(const std::string& paramName) +{ + if (!MetaData::registrationOpen()) { + throw std::logic_error("Parameter '" + paramName + "' declared as hidden" + " when parameter registration was already closed."); + } + + auto paramInfoIt = MetaData::mutableRegistry().find(paramName); + if (paramInfoIt == MetaData::mutableRegistry().end()) { + throw std::logic_error("Tried to declare unknown parameter '" + + paramName + "' hidden."); + } + + auto& paramInfo = paramInfoIt->second; + paramInfo.isHidden = true; +} + +} + bool ParamInfo::operator==(const ParamInfo& other) const { return other.paramName == paramName diff --git a/opm/models/utils/parametersystem.hpp b/opm/models/utils/parametersystem.hpp index 3c9d00e79..3e1a3d2a5 100644 --- a/opm/models/utils/parametersystem.hpp +++ b/opm/models/utils/parametersystem.hpp @@ -84,6 +84,9 @@ auto getParamName() } } +//! \brief Private implementation. +void Hide_(const std::string& paramName); + } struct ParamInfo @@ -489,7 +492,6 @@ void Register(const char* usageString) MetaData::mutableRegistry()[paramName] = paramInfo; } - /*! * \brief Indicate that a given parameter should not be mentioned in the help message * @@ -498,20 +500,7 @@ void Register(const char* usageString) template void Hide() { - const std::string paramName = detail::getParamName(); - if (!MetaData::registrationOpen()) { - throw std::logic_error("Parameter '" +paramName + "' declared as hidden" - " when parameter registration was already closed."); - } - - auto paramInfoIt = MetaData::mutableRegistry().find(paramName); - if (paramInfoIt == MetaData::mutableRegistry().end()) { - throw std::logic_error("Tried to declare unknown parameter '" - + paramName + "' hidden."); - } - - auto& paramInfo = paramInfoIt->second; - paramInfo.isHidden = true; + detail::Hide_(detail::getParamName()); } /*!