aboutsummaryrefslogtreecommitdiffstats
path: root/config/src/vespa/config/common/configvalue.hpp
blob: 56ccb0d463bf39b3f2599421816079f4e215dbdb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright Vespa.ai. 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);
    }
}

}