aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/matching/match_context.h
blob: c12c1c5731dc80ca96826920b0032c4fb694ae08 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "isearchcontext.h"
#include <vespa/searchcommon/attribute/iattributecontext.h>

namespace proton::matching {

class MatchContext {
    using IAttributeContext = search::attribute::IAttributeContext;
    std::unique_ptr<IAttributeContext> _attrCtx;
    std::unique_ptr<ISearchContext>    _searchCtx;
public:
    using UP = std::unique_ptr<MatchContext>;

    MatchContext() noexcept;
    MatchContext(IAttributeContext::UP attrCtx, std::unique_ptr<ISearchContext> searchCtx) noexcept;
    MatchContext(MatchContext &&) noexcept = default;
    ~MatchContext();

    IAttributeContext &getAttributeContext() const { return *_attrCtx; }
    ISearchContext &getSearchContext() const { return *_searchCtx; }
    void releaseEnumGuards() { _attrCtx->releaseEnumGuards(); }
};

}