forked from ufz/ogs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtils.cpp
34 lines (30 loc) · 895 Bytes
/
Utils.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* \file
* \copyright
* Copyright (c) 2012-2020, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include "Utils.h"
namespace ParameterLib
{
ParameterBase* findParameterByName(
std::string const& parameter_name,
std::vector<std::unique_ptr<ParameterBase>> const& parameters)
{
// Find corresponding parameter by name.
auto const it = std::find_if(
parameters.cbegin(), parameters.cend(),
[¶meter_name](std::unique_ptr<ParameterBase> const& p) {
return p->name == parameter_name;
});
if (it == parameters.end())
{
return nullptr;
}
DBUG("Found parameter `{:s}'.", (*it)->name);
return it->get();
}
} // namespace ParameterLib