aboutsummaryrefslogtreecommitdiffstats
path: root/documentapi/src/vespa/documentapi/messagebus/messages/feedreply.h
blob: 8e806b151831a8532ac5057b248ab5a9ef3a7de3 (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
51
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "documentreply.h"
#include "feedanswer.h"

namespace documentapi {

class FeedReply : public DocumentReply {
private:
    std::vector<FeedAnswer> _feedAnswers;

public:
    /**
     * Convenience typedef.
     */
    using UP = std::unique_ptr<FeedReply>;
    using SP = std::shared_ptr<FeedReply>;

    /**
     * Constructs a new reply for deserialization.
     *
     * @param type The type to assign to this.
     */
    FeedReply(uint32_t type);

    /**
     * Constructs a new feed reply.
     *
     * @param type        The type to assign to this.
     * @param feedAnswers The list of answers given by the search nodes.
     */
    FeedReply(uint32_t type, const std::vector<FeedAnswer> &feedAnswers);

    /**
     * Returns the list of answers given by the search nodes.
     *
     * @return The list of answers.
     */
    std::vector<FeedAnswer> &getFeedAnswers() { return _feedAnswers; }

    /**
     * Returns the list of answers given by the search nodes.
     *
     * @return The list of answers.
     */
    const std::vector<FeedAnswer> &getFeedAnswers() const { return _feedAnswers; }
};

}