blob: fa42d3c4035c45753e0dce3af7ac8e0db41b0bce (
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 Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "string.h"
namespace vbench {
/**
* A Taint indicates whether something has gone wrong. It may also
* contain a textual reason.
**/
class Taint
{
private:
bool _taint;
string _reason;
public:
Taint() : _taint(false), _reason() {}
Taint(const string &r) : _taint(true), _reason(r) {}
void reset() { _taint = false; _reason.clear(); }
void reset(const string &r) { _taint = true; _reason = r; }
bool taint() const { return _taint; }
const string &reason() const { return _reason; }
operator bool() const { return taint(); }
};
} // namespace vbench
|