aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/data/slime/resolved_symbol.h
blob: c6b09ea11b7f15d833b2403095ee71cbdcaa4d0f (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
31
32
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "symbol_lookup.h"
#include "symbol_inserter.h"

namespace vespalib::slime {

/**
 * Class containing the pre-resolved symbol for a field. Since the
 * symbol is already known, it is also known to be present in the
 * appropriate symbol table. Thus, this class can satisfy both the
 * symbol lookup and inserter interfaces.
 **/
class ResolvedSymbol final : public SymbolLookup,
                             public SymbolInserter
{
private:
    Symbol _symbol;

public:
    ResolvedSymbol(const Symbol &symbol) noexcept : _symbol(symbol) {}
    Symbol lookup() const override {
        return _symbol;
    }
    Symbol insert() override {
        return _symbol;
    }
};

} // namespace vespalib::slime