30#ifndef LSST_SPHGEOM_TRISTATE_H_
31#define LSST_SPHGEOM_TRISTATE_H_
52 explicit TriState(
bool value) : _known(true), _value(value) {}
62 return not other._known;
64 return other._known && _value == other._value;
68 bool operator!=(
TriState const & other)
const {
76 return _known && _value == value;
79 bool operator!=(
bool value)
const {
88 if (*
this ==
true || other ==
true) {
90 }
else if (*
this ==
false && other ==
false) {
102 if (*
this ==
false || other ==
false) {
104 }
else if (*
this ==
true && other ==
true) {
123 bool known()
const {
return _known; }
131std::ostream & operator<<(std::ostream & stream, TriState
const & value) {
132 const char* str =
"unknown";
135 }
else if (value ==
false) {
138 return stream << str;
bool operator==(bool value) const
Compare this tri-state value with a boolean.
Definition TriState.h:75
TriState operator~() const
Compute the logical NOT of a TriState value.
Definition TriState.h:114
bool known() const
Check whether the state is known.
Definition TriState.h:123
TriState(bool value)
Construct value in a known state.
Definition TriState.h:52
TriState operator&(TriState const &other) const
Compute the logical AND of two TriState values.
Definition TriState.h:101
TriState()
Construct value in unknown state.
Definition TriState.h:49
bool operator==(TriState const &other) const
Compare this tri-state value with other tri-state value.
Definition TriState.h:60
TriState operator|(TriState const &other) const
Compute the logical OR of two TriState values.
Definition TriState.h:87