aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/fef/ranking_expressions.h
blob: 6c4c5f5108e69503fe1a92416ec0eae257dbe3fe (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
33
34
35
36
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/vespalib/stllike/string.h>
#include <memory>
#include <map>

namespace search::fef {

/**
 * Class representing a collection of named ranking expressions
 * obtained through file-distribution.
 */
class RankingExpressions
{
private:
    // expression name -> full_path of expression file
    std::map<vespalib::string,vespalib::string> _expressions;

public:
    RankingExpressions();
    RankingExpressions(RankingExpressions &&rhs) noexcept;
    RankingExpressions & operator=(RankingExpressions &&rhs) = delete;
    RankingExpressions(const RankingExpressions &rhs) = delete;
    RankingExpressions & operator=(const RankingExpressions &rhs) = delete;
    ~RankingExpressions();
    bool operator==(const RankingExpressions &rhs) const {
        return _expressions == rhs._expressions;
    }
    size_t size() const { return _expressions.size(); }
    RankingExpressions &add(const vespalib::string &name, const vespalib::string &path);
    vespalib::string loadExpression(const vespalib::string &name) const;
};

}