From eb53811b4633ef26d6998783ea8488e51a86062a Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Thu, 29 Nov 2018 12:36:10 +0100 Subject: [PATCH] [PL/Out] Impl. begin() and end() used by for-range-loop. --- ProcessLib/Output/SecondaryVariable.cpp | 16 ++++++++++++++-- ProcessLib/Output/SecondaryVariable.h | 3 +++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ProcessLib/Output/SecondaryVariable.cpp b/ProcessLib/Output/SecondaryVariable.cpp index 3dc19956745..604b152d1d8 100644 --- a/ProcessLib/Output/SecondaryVariable.cpp +++ b/ProcessLib/Output/SecondaryVariable.cpp @@ -38,6 +38,18 @@ void SecondaryVariableCollection::addSecondaryVariable( } } +std::map<std::string, std::string>::const_iterator +SecondaryVariableCollection::begin() +{ + return _map_external_to_internal.cbegin(); +} + +std::map<std::string, std::string>::const_iterator +SecondaryVariableCollection::end() +{ + return _map_external_to_internal.cend(); +} + SecondaryVariable const& SecondaryVariableCollection::get( std::string const& external_name) { @@ -46,7 +58,7 @@ SecondaryVariable const& SecondaryVariableCollection::get( if (it == _map_external_to_internal.cend()) { OGS_FATAL( - "A secondary variable with external name `%s' has not been set up.", + "A secondary variable with external name '%s' has not been set up.", external_name.c_str()); } @@ -56,7 +68,7 @@ SecondaryVariable const& SecondaryVariableCollection::get( if (it2 == _configured_secondary_variables.end()) { OGS_FATAL( - "A secondary variable with internal name `%s' has not been set up.", + "A secondary variable with internal name '%s' has not been set up.", internal_name.c_str()); } diff --git a/ProcessLib/Output/SecondaryVariable.h b/ProcessLib/Output/SecondaryVariable.h index 0b268ff73fc..9ae67da8ae3 100644 --- a/ProcessLib/Output/SecondaryVariable.h +++ b/ProcessLib/Output/SecondaryVariable.h @@ -132,6 +132,9 @@ public: //! Returns the secondary variable with the given external name. SecondaryVariable const& get(std::string const& external_name); + std::map<std::string, std::string>::const_iterator begin(); + std::map<std::string, std::string>::const_iterator end(); + private: //! Maps external variable names to internal ones. //! The external variable names are used, e.g., for output. -- GitLab