aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/attributefactory.h
blob: 67c4ac36bffa8eabd2cb5b45bc0db49d6c1de8f4 (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
// 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>

namespace search::attribute { class Config; }
namespace search {

class AttributeVector;

/**
 * Factory for creating attribute vector instances.
 **/
class AttributeFactory {
private:
    using stringref = vespalib::stringref;
    using Config = attribute::Config;
    using AttributeSP = std::shared_ptr<AttributeVector>;
    static AttributeSP createArrayStd(stringref name, const Config & cfg);
    static AttributeSP createArrayFastSearch(stringref name, const Config & cfg);
    static AttributeSP createSetStd(stringref name, const Config & cfg);
    static AttributeSP createSetFastSearch(stringref name, const Config & cfg);
    static AttributeSP createSingleStd(stringref name, const Config & cfg);
    static AttributeSP createSingleFastSearch(stringref name, const Config & cfg);
public:
    /**
     * Create an attribute vector with the given name based on the given config.
     **/
    static AttributeSP createAttribute(stringref name, const Config & cfg);
};

}