summaryrefslogtreecommitdiffstats
path: root/searchsummary/src/tests/extractkeywords/simplequerystack.cpp
blob: 409486128589962283a40858b78a24a7580d5b08 (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
50
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "simplequerystack.h"
#include <vespa/vespalib/util/compress.h>
#include <vespa/vespalib/objects/nbo.h>
#include <vespa/vespalib/util/stringfmt.h>

#include <vespa/log/log.h>
LOG_SETUP(".search.simplequerystack");

using vespalib::make_string;

namespace search {

SimpleQueryStack::SimpleQueryStack()
    : _numItems(0),
      _stack(nullptr)
{
}

SimpleQueryStack::~SimpleQueryStack()
{
    delete _stack;
}

void
SimpleQueryStack::Push(SimpleQueryStackItem *item)
{
    item->_next = _stack;
    _stack = item;

    _numItems++;
}

void
SimpleQueryStack::AppendBuffer(RawBuf *buf) const
{
    for (SimpleQueryStackItem *item = _stack; item != nullptr; item = item->_next) {
        item->AppendBuffer(buf);
    }
}


uint32_t
SimpleQueryStack::GetSize()
{
    return _numItems;
}

} // namespace search