62 for ( ;en_n.
valid(); ++en_n)
65 for (
auto i = prev; i < curr; ++i)
66 cout << i <<
": NULL" << endl;
67 bool v = bv_v.
test(curr);
68 cout << curr <<
": " << (v ?
"true" :
"false") << endl;
96 for (
unsigned i = 0; i < 10; ++i)
100 assert(v == v1); (void) v1;
127 for (
unsigned i = 0; i < 13; i+=3)
167 for (
unsigned i = 0; i < 10; ++i)
192 cout <<
"Input vector:" << endl;
197 cout <<
"Inverted vector:" << endl;
226 bm::and_kleene(bv_v_t, bv_null_t, bv_v2, bv_null2, bv_v1, bv_null1);
232 bool b = bv_v_t.
equal(bv_v2);
234 b = bv_null_t.
equal(bv_null2);
237 cout <<
"AND vector:" << endl;
265 bm::or_kleene(bv_v_t, bv_null_t, bv_v2, bv_null2, bv_v1, bv_null1);
271 bool b = bv_v_t.
equal(bv_v2);
273 b = bv_null_t.
equal(bv_null2);
277 cout <<
"OR vector:" << endl;
288 cout << endl <<
"3VL Set values:" << endl << endl;
292 cout << endl <<
"3VL Invert vector:" << endl << endl;
295 cout << endl <<
"3VL AND:" << endl << endl;
298 cout << endl <<
"3VL OR:" << endl << endl;
301 catch(std::exception& ex)
303 std::cerr << ex.what() << std::endl;
Three-valued logic (3VL) operations.
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
#define BM_DECLARE_TEMP_BLOCK(x)
pre-processor un-defines to avoid global space pollution (internal)
static void Set3VL_ValueDemo2()
Faster way to initialize Kleene bit-vectors via bulk_insert_iterator.
static void Set3VL_ORDemo()
Demo for 3-value logic (Kleene) OR.
static void Set3VL_AndDemo()
Demo for 3-value logic (Kleene) AND.
static void Set3VL_ValueDemo()
This demo shows how to use bm::set_value_kleene and bm::get_value_kleene functions to set values into...
static void PrintKleeneVector(const bm::bvector<> &bv_v, const bm::bvector<> &bv_null)
Print 3-value vector.
static void GenerateDemoVector(bm::bvector<> &bv_v, bm::bvector<> &bv_null)
Generate Kleene vector (as two bit-vectors)
static void Set3VL_InvertDemo()
Demo for 3-value logic (Kleene) NOT.
Output iterator iterator designed to set "ON" bits based on input sequence of integers.
Constant iterator designed to enumerate "ON" bits.
bool valid() const BMNOEXCEPT
Checks if iterator is still valid.
Bitvector Bit-vector container with runtime compression of bits.
bool test(size_type n) const BMNOEXCEPT
returns true if bit n is set and false is bit n is 0.
bool equal(const bvector< Alloc > &bvect) const BMNOEXCEPT
Equal comparison with an agr bit-vector.
void optimize(bm::word_t *temp_block=0, optmode opt_mode=opt_compress, statistics *stat=0)
Optimize memory bitvector's memory allocation.
insert_iterator inserter()
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
void invert_kleene(BV &bv_value, const BV &bv_null)
Kleene NEG operation.
void init_kleene(BV &bv_value, const BV &bv_null)
Initialized the value bit-vector so that it always returns 0 (false) for the unknown.
void and_kleene(BV &bv_value1, BV &bv_null1, const BV &bv_value2, const BV &bv_null2)
Kleene AND(vect1, vect2) (vect1 &= vect2) 0 AND Unk = 0 (known)
void set_value_kleene(BV &bv_value, BV &bv_null, typename BV::size_type idx, int val)
Set Kleene logic value based on value and known vectors.
int get_value_kleene(const BV &bv_value, const BV &bv_null, typename BV::size_type idx) BMNOEXCEPT
Return Kleene logic value based on value and known vectors.
void or_kleene(BV &bv_value1, BV &bv_null1, const BV &bv_value2, const BV &bv_null2)
Kleene OR(vect1, vect2) (vect1 |= vect2) 1 OR Unk = 1 (known)