本文整理汇总了C++中BitString::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ BitString::getData方法的具体用法?C++ BitString::getData怎么用?C++ BitString::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitString
的用法示例。
在下文中一共展示了BitString::getData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildRank
BitSequenceRG::BitSequenceRG(const BitString & bs, uint _factor) {
/*cout << "*****" << endl;
cout << bitarray << endl;
cout << _n << endl;
cout << _factor << endl; */
const uint * bitarray = bs.getData();
size_t _n = bs.getLength();
if(_factor==0) exit(-1);
data=new uint[_n/W+1];
for(size_t i=0;i<uint_len(_n,1);i++)
data[i] = bitarray[i];
for(size_t i=uint_len(_n,1);i<_n/W+1;i++)
data[i] = 0;
//this->owner = true;
this->n=_n;
uint lgn=bits(n-1);
this->factor=_factor;
if (_factor==0) this->factor=lgn;
else this->factor=_factor;
b=32;
s=b*this->factor;
integers = n/W+1;
BuildRank();
this->length = n;
this->ones = rank1(n-1);
}
示例2: make_pair
pair<BitString *,uint> generateBitmap(size_t length,vector<pair<uint,uint> > &nodes ) {
uint bitmap_pos = 0;
BitString *bitmap = new BitString(length);
size_t a,b;
cst->Root(&a,&b);
bitmap_pos++;
// cout << "(" ;
generateBitmapAux(make_pair(a,b),bitmap,bitmap_pos,nodes);
bitmap->setBit(bitmap_pos);
bitmap_pos++;
// cout << ")";
// cout << "nodes.size() = " << nodes.size() << endl;
BitString *new_bitmap = new BitString(bitmap->getData(),bitmap_pos);
// for (int i = 0 ; i < nodes.size();i++) {
// cout << nodes[i].first << endl;
// }
// cout << "=========== tree ==========" << endl;
// for (int i = 0 ;i < bitmap_pos;i++) {
// if (bitmap->getBit(i))
// cout << ")";
// else
// cout << "(";
// }
// cout << endl;
return make_pair(new_bitmap,bitmap_pos);
}
示例3: bits
BitSequenceRGK::BitSequenceRGK(const BitString &bs, uint _factor, uint selectsampling) {
const uint *bitarray = bs.getData();
size_t _n = bs.getLength();
// cout << _factor << endl;
if (_factor == 0) exit(-1);
// cout << "_n/W+1=" << _n/W+1 << endl;
data = new uint[_n / W + 1];
// cout << "_n/W+1=" << _n/W+1 << endl;
for (size_t i = 0; i < uint_len(_n, 1); i++)
data[i] = bitarray[i];
for (size_t i = uint_len(_n, 1); i < _n / W + 1; i++)
data[i] = 0;
//this->owner = true;
this->n = _n;
uint lgn = bits(n - 1);
this->factor = _factor;
if (_factor == 0) this->factor = lgn;
else this->factor = _factor;
b = 32;
s = b * this->factor;
integers = n / W + 1;
BuildRank();
this->length = n;
this->ones = rank1(n - 1);
fastselect0 = true;
fastselect1 = true;
select1sampling = selectsampling;
select0sampling = selectsampling;
if (fastselect1) {
// cout << "entered here" << endl;
this->Stones = new uint[ones / select1sampling + 1];
Stones[0] = 0;
for (size_t i = 0; i <= ones; i += select1sampling) {
if (i == 0) continue;
Stones[i / select1sampling] = this->select1_s(i);
}
}
if (fastselect0) {
this->Stzero = new uint[(n - ones) / select0sampling + 1];
Stzero[0] = 0;
for (size_t i = 0; i <= (n - ones); i += select0sampling) {
if (i == 0) continue;
Stzero[i / select0sampling] = this->select0_s((i));
}
}
}
示例4: build
BitSequenceRRR::BitSequenceRRR(const BitString & bs, uint sample_rate) {
build(bs.getData(),bs.getLength(),sample_rate);
}