blob: 6057ae754ed49b81838da55afb85ba055d88b5d3 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/util/issue.h>
#include <memory>
#include <set>
namespace search {
/**
* Keep track of all unique issues encountered.
**/
class UniqueIssues : public vespalib::Issue::Handler
{
private:
std::set<vespalib::string> _messages;
public:
using UP = std::unique_ptr<UniqueIssues>;
void handle(const vespalib::Issue &issue) override;
template <class Function>
void for_each_message(Function fun) const {
for (const auto &msg: _messages) {
fun(msg);
}
}
size_t size() const { return _messages.size(); }
};
}
|