blob: 1c68b87a0172465c1a02e1bd504a3ed2756e8a58 (
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
37
38
39
40
41
42
43
44
45
46
47
48
|
// 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 <map>
#include <vector>
#include <memory>
namespace search::fef {
/**
* Class representing a set of configured ranking constants, with name, type and file path (where constant is stored).
*/
class RankingConstants {
public:
struct Constant {
vespalib::string name;
vespalib::string type;
vespalib::string filePath;
Constant(const vespalib::string &name_in,
const vespalib::string &type_in,
const vespalib::string &filePath_in);
~Constant();
bool operator==(const Constant &rhs) const;
};
using Vector = std::vector<Constant>;
private:
using Map = std::map<vespalib::string, Constant>;
Map _constants;
public:
RankingConstants();
RankingConstants(RankingConstants &&) noexcept;
RankingConstants & operator =(RankingConstants &&) = delete;
RankingConstants(const RankingConstants &) = delete;
RankingConstants & operator =(const RankingConstants &) = delete;
explicit RankingConstants(const Vector &constants);
~RankingConstants();
bool operator==(const RankingConstants &rhs) const;
const Constant *getConstant(const vespalib::string &name) const;
size_t size() const { return _constants.size(); }
};
}
|