blob: 5d7dadc2579837dd98506c464dd64a6d98e73764 (
plain) (
blame)
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vdstestlib/config/dirconfig.h>
#include <sstream>
#include <boost/lexical_cast.hpp>
namespace vdstestlib {
template<typename T>
void
DirConfig::Config::setValue(const ConfigKey& key, const T& value)
{
std::ostringstream ost;
ost << value;
set(key, ost.str());
}
template<typename T>
T
DirConfig::Config::getValue(const ConfigKey& key, const T& defVal) const
{
const ConfigValue* val(get(key));
if (val == 0) return defVal;
return boost::lexical_cast<T>(*val);
}
} // storage
|