68 for (; en.
valid() && cnt < 10; ++en, ++cnt)
72 cout <<
"(size = "<< bv.
size() <<
")" << endl;
87 target_buf.resize(sbuf.size());
88 ::memcpy(target_buf.data(), sbuf.buf(), sbuf.size());
156 vector<size_type> vect_B { 1, 2, 4 };
167 vector<size_type> vect_B { 1, 2, 4 };
169 const size_type* arr = &vect_B[0];
178 vector<unsigned char> blob;
268 vector<unsigned> vect_B { 1, 2, 4 };
278 vector<size_type> vect_B { 1, 2, 4 };
280 const size_type* arr = &vect_B[0];
289 vector<unsigned char> blob;
376 vector<unsigned> vect_B { 1, 2, 4 };
386 vector<unsigned char> blob;
449 vector<size_type> vect_B { 1, 2, 4 };
459 vector<size_type> vect_B { 1, 2, 4 };
461 const size_type* arr = &vect_B[0];
470 vector<unsigned char> blob;
583 cout << endl <<
"Set Union (OR) demo" << endl << endl;
586 cout << endl <<
"Set Intersect (AND) demo" << endl << endl;
589 cout << endl <<
"XOR demo" << endl << endl;
592 cout << endl <<
"Set Minus (SUB/AND-NOT) demo" << endl << endl;
595 cout << endl <<
"Set Invert (NOT) demo" << endl << endl;
598 cout << endl <<
"Set AND-SUB demo" << endl << endl;
601 catch(std::exception& ex)
603 std::cerr << ex.what() << std::endl;
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
#define BM_DECLARE_TEMP_BLOCK(x)
Algorithms for fast aggregation of N bvectors.
Algorithms for bvector<> (main include)
Serialization / compression of bvector<>. Set theoretical operations on compressed BLOBs.
static void DemoAND_SUB()
static void make_BLOB(vector< unsigned char > &target_buf, bm::bvector<> &bv)
static void print_bvector(const bm::bvector<> &bv)
Algorithms for fast aggregation of a group of bit-vectors.
void set_optimization(typename bvector_type::optmode opt=bvector_type::opt_compress)
set on-the-fly bit-block compression By default aggregator does not try to optimize result,...
void reset() BMNOEXCEPT
Reset aggregate groups, forget all attached vectors.
unsigned add(const bvector_type *bv, unsigned agr_group=0) BMNOEXCEPT
Attach source bit-vector to a argument group (0 or 1).
bool combine_and_sub(bvector_type &bv_target)
Aggregate added group of vectors using fused logical AND-SUB Operation does NOT perform an explicit r...
void combine_or(bvector_type &bv_target)
Aggregate added group of vectors using logical OR Operation does NOT perform an explicit reset of arg...
void combine_and(bvector_type &bv_target)
Aggregate added group of vectors using logical AND Operation does NOT perform an explicit reset of ar...
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.
void merge(bm::bvector< Alloc > &bvect)
Merge/move content from another vector.
bvector< Alloc > & invert()
Invert/NEG all bits It should be noted, invert is affected by size() if size is set - it only inverts...
size_type size() const BMNOEXCEPT
Returns bvector's capacity (number of bits it can store)
bm::bvector< Alloc > & bit_and(const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode)
3-operand AND : this := bv1 AND bv2
bvector< Alloc > & set(size_type n, bool val=true)
Sets bit n if val is true, clears bit n if val is false.
void resize(size_type new_size)
Change size of the bvector.
void optimize(bm::word_t *temp_block=0, optmode opt_mode=opt_compress, statistics *stat=0)
Optimize memory bitvector's memory allocation.
bm::bvector< Alloc > & bit_or(const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode)
3-operand OR : this := bv1 OR bv2
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
bm::bvector< Alloc > & bit_sub(const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode)
3-operand SUB : this := bv1 MINUS bv2 SUBtraction is also known as AND NOT
void clear(const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN)
clear list of bits in this bitset
bm::bvector< Alloc > & bit_xor(const bm::bvector< Alloc > &bv1, const bm::bvector< Alloc > &bv2, typename bm::bvector< Alloc >::optmode opt_mode)
3-operand XOR : this := bv1 XOR bv2
void combine_operation(const bm::bvector< Alloc > &bvect, bm::operation opcode)
perform a set-algebra operation by operation code
void keep(const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN)
Keep list of bits in this bitset, others are cleared.
Deserializer, performs logical operations between bit-vector and serialized bit-vector.
size_type deserialize(bvector_type &bv, const unsigned char *buf, set_operation op, bool exit_on_one=false)
Deserialize bvector using buffer as set operation argument.
Bit-vector serialization class.
void set_compression_level(unsigned clevel) BMNOEXCEPT
Set compression level.
size_type serialize(const BV &bv, unsigned char *buf, size_t buf_size)
Bitvector serialization into memory block.
@ BM_SORTED
input set is sorted (ascending order)
void combine_and(BV &bv, It first, It last)
AND Combine bitvector and the iterable sequence.
void combine_sub(BV &bv, It first, It last)
SUB Combine bitvector and the iterable sequence.
void combine_xor(BV &bv, It first, It last)
XOR Combine bitvector and the iterable sequence.
void combine_or(BV &bv, It first, It last)
OR Combine bitvector and the iterable sequence.