ClickHouse/dbms/src/Storages/MergeTree/BoolMask.h

25 lines
679 B
C++
Raw Normal View History

2014-03-26 18:19:25 +00:00
#pragma once
2017-04-16 15:00:33 +00:00
/// Multiple Boolean values. That is, two Boolean values: can it be true, can it be false.
2014-03-26 18:19:25 +00:00
struct BoolMask
{
bool can_be_true;
bool can_be_false;
2014-03-26 18:19:25 +00:00
BoolMask() {}
BoolMask(bool can_be_true_, bool can_be_false_) : can_be_true(can_be_true_), can_be_false(can_be_false_) {}
2014-03-26 18:19:25 +00:00
BoolMask operator &(const BoolMask & m)
{
return BoolMask(can_be_true && m.can_be_true, can_be_false || m.can_be_false);
}
BoolMask operator |(const BoolMask & m)
{
return BoolMask(can_be_true || m.can_be_true, can_be_false && m.can_be_false);
}
BoolMask operator !()
{
return BoolMask(can_be_false, can_be_true);
}
2014-03-26 18:19:25 +00:00
};