summaryrefslogtreecommitdiffstats
path: root/searchsummary/src/tests/extractkeywords/simplequerystack.h
blob: 0b61a41944b4512e0ce9e5897e50d5b9c57fb3dc (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
49
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "simplequerystackitem.h"
#include <vespa/searchlib/util/rawbuf.h>
#include <vespa/vespalib/stllike/string.h>

namespace search {

/**
 * A stack of SimpleQueryStackItems.
 *
 * A simple stack consisting of a list of SimpleQueryStackItems.
 * It is able to generate a binary encoding of itself
 * to a RawBuf.
 */
class SimpleQueryStack
{
private:
    /** The top of the stack. */
    SimpleQueryStackItem *_stack;

public:
    SimpleQueryStack(const SimpleQueryStack &) = delete;
    SimpleQueryStack& operator=(const SimpleQueryStack &) = delete;
    /**
     * Constructor for SimpleQueryStack.
     */
    SimpleQueryStack();
    /**
     * Destructor for SimpleQueryStack.
     */
    ~SimpleQueryStack();
    /**
     * Push an item on the stack.
     * @param item The SimpleQueryStackItem to push.
     */
    void Push(SimpleQueryStackItem *item);

    /**
     * Encode the contents of the stack in a binary buffer.
     * @param buf Pointer to a buffer containing the encoded contents.
     */
    void AppendBuffer(RawBuf *buf) const;
};

} // namespace search