YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/src/yb/util/trilean.h
Line
Count
Source (jump to first uncovered line)
1
// Copyright (c) YugaByte, Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
4
// in compliance with the License.  You may obtain a copy of the License at
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software distributed under the License
9
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10
// or implied.  See the License for the specific language governing permissions and limitations
11
// under the License.
12
//
13
14
#ifndef YB_UTIL_TRILEAN_H_
15
#define YB_UTIL_TRILEAN_H_
16
17
#include <ostream>
18
#include <string>
19
20
namespace yb {
21
22
// A "three-value boolean". We need this for some sanity checks.
23
// https://en.wikipedia.org/wiki/Three-valued_logic
24
enum class Trilean : uint8_t {
25
  kFalse = 0,
26
  kTrue = 1,
27
  kUnknown = 2
28
};
29
30
std::string TrileanToStr(Trilean value);
31
32
0
inline constexpr Trilean ToTrilean(bool b) noexcept {
33
0
  return b ? Trilean::kTrue : Trilean::kFalse;
34
0
}
35
36
0
inline std::ostream& operator << (std::ostream& out, Trilean trilean) {
37
0
  return out << TrileanToStr(trilean);
38
0
}
39
40
} // namespace yb
41
42
#endif // YB_UTIL_TRILEAN_H_