aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/query/tree/querytreecreator.h
blob: 57275061b5feb7a0c7c2dd0edd36a25d9eda0ee8 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "queryreplicator.h"
#include "stackdumpquerycreator.h"

namespace search::query {

/**
 * Holds functions for creating query trees, either from a stack dump
 * or from another query tree. The traits specify the concrete
 * subclasses to be used when building the tree.
 */
template <class NodeTypes>
struct QueryTreeCreator {
    static Node::UP replicate(const Node &node) {
        return QueryReplicator<NodeTypes>().replicate(node);
    }

    static Node::UP create(search::SimpleQueryStackDumpIterator &iterator) {
        return StackDumpQueryCreator<NodeTypes>().create(iterator);
    }

private:
    QueryTreeCreator();
};

}