diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-01-02 23:49:22 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-01-02 23:49:22 +0000 |
commit | 68b74816c5b6cc614107d3baf004011f2f427b2d (patch) | |
tree | 48bcad3503b1817de77a9fbd75e780c50978de3f /vdstestlib | |
parent | 5c55b1b26d664a6143ec4b93e0d4a23f798cab42 (diff) |
Ensure that we use unique directories.
Diffstat (limited to 'vdstestlib')
-rw-r--r-- | vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp | 31 | ||||
-rw-r--r-- | vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.hpp | 30 |
2 files changed, 37 insertions, 24 deletions
diff --git a/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp b/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp index f6f81b7f2c4..d0bcb47ae0c 100644 --- a/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp +++ b/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.cpp @@ -1,15 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vdstestlib/cppunit/dirconfig.h> +#include <vespa/vdstestlib/cppunit/dirconfig.hpp> -#include <fstream> -#include <vespa/log/log.h> -#include <sstream> -#include <atomic> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/exceptions.h> -#include <boost/lexical_cast.hpp> +#include <fstream> +#include <atomic> +#include <vespa/log/log.h> LOG_SETUP(".dirconfig"); namespace vdstestlib { @@ -142,24 +140,6 @@ DirConfig::getConfig(const ConfigName& name, bool createIfNonExisting) return it->second; } -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); -} - void DirConfig::removeConfig(const ConfigName& name) { @@ -213,4 +193,7 @@ DirConfig::isCacheDirty() const return false; } +template void DirConfig::Config::setValue(const ConfigKey &, const int &); +template std::string DirConfig::Config::getValue(const ConfigKey &, const std::string &) const; + } // storage diff --git a/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.hpp b/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.hpp new file mode 100644 index 00000000000..13dd481bb4e --- /dev/null +++ b/vdstestlib/src/vespa/vdstestlib/cppunit/dirconfig.hpp @@ -0,0 +1,30 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include <vespa/vdstestlib/cppunit/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 |