(
unsignedinitial_serialization_buf_size = 16384);
94 unsigned*
count= 0);
149 template<
classTBV>
158:
TParent(initial_serialization_buf_size)
160this->
BindKey(
"id", &
id);
187 unsignedbitcount_from,
188 unsignedbitcount_to,
229 template<
classTBV,
classTM>
307 template<
classTBV>
309: m_Buffer(initial_serialization_buf_size),
314 template<
classTBV>
322 template<
classTBV>
326 returnReadRealloc(bv,
true);
329 template<
classTBV>
341 if(m_STmpBlock == 0) {
357 template<
classTBV>
360 if(m_STmpBlock == 0) {
367 template<
classTBV>
372 if(m_STmpBlock == 0) {
377 typenameTBitVector::statistics st1;
378 if(compact == eCompact) {
379m_TmpBVec.clear(
true);
381m_TmpBVec.optimize(0, TBitVector::opt_compress, &st1);
382bv_to_store = &m_TmpBVec;
385bv_to_store->calc_stat(&st1);
388 if(st1.max_serialize_mem > m_Buffer.size()) {
389m_Buffer.resize_mem(st1.max_serialize_mem);
395 returnUpdateInsert(&m_Buffer[0],
size);
398 template<
classTBV>
400 boolclear_target_vec)
404err =
Read(bv, clear_target_vec);
409 unsignedbuf_size = LobSize();
410m_Buffer.resize_mem(buf_size);
411err =
Read(bv, clear_target_vec);
419 template<
classTBV>
426 template<
classTBV>
428 boolclear_target_vec)
430 if(m_Buffer.size() < m_Buffer.capacity()) {
431m_Buffer.resize_mem(m_Buffer.capacity());
434 if(m_Buffer.size() == 0) {
435m_Buffer.resize_mem(16384);
438 void* p = &m_Buffer[0];
439 EBDB_ErrCodeerr = Fetch(&p, m_Buffer.size(), eReallocForbidden);
443 if(clear_target_vec) {
451 template<
classTBV>
454 if(m_STmpBlock == 0) {
460 template<
classTBV>
465 void* p = &m_Buffer[0];
472 size_tbuf_size = LobSize();
473m_Buffer.resize(buf_size);
474 void* p = &m_Buffer[0];
488 template<
classTBV>
491 for(
size_t i= 0;
i< bv_lst.size(); ++
i)
495WriteVector(*bv, TParent::eCompact);
499 template<
classTBV>
526cur.
From<< ++bv_id;
539 template<
classTBV>
542 unsignedbitcount_from,
543 unsignedbitcount_to,
548 if(this->m_STmpBlock == 0) {
561 void* p = &this->m_Buffer[0];
564&p, this->m_Buffer.size(),
572 unsignedbuf_size = this->LobSize();
574 if(out_of_interval_ids) {
575out_of_interval_ids->set(bv_id);
582this->m_Buffer.resize(buf_size);
583p = &this->m_Buffer[0];
585&p, this->m_Buffer.size(),
596 unsignedbitcount = bv.count();
597 if(bitcount >= bitcount_from && bitcount <= bitcount_to) {
598 TBitVector& map_vector = (*bc_map)[bitcount];
599map_vector.set(bv_id);
601 if(out_of_interval_ids) {
602out_of_interval_ids->set(bv_id);
617 template<
classTBV,
classTM>
626 template<
classTBV,
classTM>
630 template<
classTBV,
classTM>
640matr_cols = matr.cols();
641matr_rows = matr.rows();
642store_type = (unsigned) eDescriptor;
643err = TParent::WriteVector(descr_bv, compact);
651matr_cols = matr.cols();
652matr_rows = matr.rows();
653store_type = (unsigned) eMatrix;
658err = UpdateInsert(matr.data(), msize);
662 template<
classTBV,
classTM>
667descr_list->resize(0);
670 if(this->m_Buffer.size() == 0) {
671this->m_Buffer.resize(16384);
676cur.
From<< 0 << 0 << 0;
679 void* p = &this->m_Buffer[0];
682&p, this->m_Buffer.size(),
687 unsignedbuf_size = this->LobSize();
688this->m_Buffer.resize(buf_size);
689p = &this->m_Buffer[0];
691&p, this->m_Buffer.size(),
698 unsignedcols = matr_cols;
699 unsignedrows = matr_rows;
BDB library BLOB support.
Berkeley BDB file cursor.
Serialization / compression of bvector<>. Set theoretical operations on compressed BLOBs.
Berkeley DB BLOB File class.
Basic template class for bitvector storage.
BDB errno exception class.
Berkeley DB file cursor class.
Reallocable memory buffer (no memory copy overhead) Mimics vector<>, without the overhead of explicit...
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.
void ReadIds(TBitVector *id_bv)
Read id storage keys (id field) into bit-vector.
CBDB_FieldUint4 store_type
EStoreType.
SMatrixDescr & operator=(const SMatrixDescr &mdesc)
EBDB_ErrCode ReadRealloc(TBuffer &buffer)
Read BLOB into vector.
EBDB_ErrCode WriteVector(const TBitVector &bv, ECompact compact)
Save a bitvector to the store.
TBitVector m_TmpBVec
temporary bitset
void LoadMatrixDescriptions(TMatrixDescrList *descr_list)
Load all matrix descriptions from the store WHERE store_type = eDescriptor.
SMatrixDescr(const SMatrixDescr &mdesc)
CBDB_FieldUint4 matr_rows
Number of rows (number of bvectors)
SBDB_BvStore_Id(unsigned initial_serialization_buf_size=16384)
CBDB_BvStore< TBV > TParent
CBDB_MatrixBvStore(unsigned initial_serialization_buf_size=16384)
vector< SMatrixDescr > TMatrixDescrList
void ComputeBitCountMap(TBitCountMap *bc_map, unsigned bitcount_from, unsigned bitcount_to, TBitVector *out_of_interval_ids=0)
Utility to compute bit-count storage statistics this statistics is a map bit_count -> list of ids in ...
CBDB_BvStore< TBV > TParent
bm::word_t * m_STmpBlock
temp block for bitvector serialization
CBDB_MatrixBvStore(const CBDB_MatrixBvStore &)
SMatrixDescr(unsigned c=0, unsigned r=0, TBitVector *bv=0)
TBV TBitVector
Serializable bitvector.
bm::word_t * GetSerializationTempBlock()
map< unsigned, TBitVector > TBitCountMap
Bitcount to bvector map (bvector represents the list of ids with the same bitcount.
CBDB_FieldUint4 matr_cols
Number of columns (bit count)
TBV TBitVector
Serializable bitvector.
TParent::TBitVector TBitVector
CBDB_MatrixBvStore & operator=(const CBDB_MatrixBvStore &)
TBuffer::value_type TBufferValue
EBDB_ErrCode Read(TBitVector *bv, bool clear_target_vec)
Fetch, deserialize bvector.
TBuffer & GetBuffer()
Get access to the internal buffer.
TParent::ECompact ECompact
CBDB_FieldUint4 id
ID key.
void StoreVectorList(const vector< TBitVector * > &bv_lst)
Store vector of bitvector ponters, index in the vector becoms an id of the element.
TBuffer m_Buffer
temporary serialization buffer
void Deserialize(TBitVector *bv, const TBufferValue *buf)
EBDB_ErrCode ReadRealloc(TBitVector *bv, bool clear_target_vec)
Read bvector, reallocate the internal buffer if necessary.
EBDB_ErrCode ReadVector(TBitVector *bv)
Fetch and deserialize the *current* bitvector.
ECompact
Compression options for vector storage.
EBDB_ErrCode FetchToBuffer(CBDB_FileCursor &cur)
Fetch the next BLOB record to the resiable buffer.
CBDB_BvStore(unsigned initial_serialization_buf_size=16384)
Construction.
EBDB_ErrCode InsertSparseMatrix(const TMatrix &matr, const TBitVector &descr_bv, ECompact compact)
Save sparse matrix.
@ eDescriptor
Sparse matrix descriptor.
@ eBitVector
Simple bit vector.
void SetCondition(ECondition cond_from, ECondition cond_to=eNotSet)
Set search condition(type of interval)
CSimpleBuffer TBuffer
typedef for raw buffer operations
void BindKey(const char *field_name, CBDB_Field *key_field, size_t buf_size=0)
EBDB_ErrCode
BDB Return codes.
EBDB_ErrCode Fetch(EFetchDirection fdir=eDefault)
Fetch record.
CBDB_ConditionHandle From
bool IsBufferSmall() const
Returns TRUE if error is BerekleyDB DB_BUFFER_SMALL (insufficient buffer size)
bool IsNoMem() const
Returns TRUE if error is BerekleyDB ENOMEM (insufficient buffer size)
void Read(CObjectIStream &in, TObjectPtr object, const CTypeRef &type)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
set_operation
Codes of set operations.
@ BM_GAP
GAP compression is ON.
size_t serialize(const BV &bv, unsigned char *buf, bm::word_t *temp_block=0, unsigned serialization_flags=0)
Saves bitvector into memory.
size_t deserialize(BV &bv, const unsigned char *buf, bm::word_t *temp_block=0, const bm::bv_ref_vector< BV > *ref_vect=0)
Bitvector deserialization from a memory BLOB.
@ BM_NO_GAP_LENGTH
save no GAP info (save some space)
@ BM_NO_BYTE_ORDER
save no byte-order info (save some space)
void aligned_free(void *ptr) BMNOEXCEPT
Aligned free.
void * aligned_new_malloc(size_t size)
Aligned malloc (unlike classic malloc it throws bad_alloc exception)
const unsigned set_block_alloc_size
double value_type
The numeric datatype used by the parser.
const struct ncbi::grid::netcache::search::fields::SIZE size
Compressed bitset (entry point to bm.h)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
Sparse matrix descriptor.
void Deserialize(CNcbiIstream &istr, CRawScoreVector< Key, Score > &)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4