aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/vespa/config/common/configvalue.hpp
blob: 89177454dc347eeacf6e86c712c6389a4fbde4af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "configvalue.h"
#include <vespa/config/configgen/configpayload.h>
#include <vespa/config/frt/protocol.h>

namespace config {

template <typename ConfigType>
std::unique_ptr<ConfigType>
ConfigValue::newInstance() const
{
    if (_payload) {
        const vespalib::slime::Inspector & payload(_payload->getSlimePayload());
        return std::make_unique<ConfigType>(::config::ConfigPayload(payload));
    } else {
        return std::make_unique<ConfigType>(*this);
    }
}

}