NCBI C++ ToolKit
BVector_data.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: BVector_data.cpp 85434 2019-02-11 15:08:11Z ucko $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: .......
27  *
28  * File Description:
29  * .......
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using the following specifications:
34  * 'seqtable.asn'.
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 
40 // generated includes
42 
43 #include <corelib/ncbimtx.hpp>
44 
45 // generated classes
46 
48 
49 BEGIN_objects_SCOPE // namespace ncbi::objects::
50 
51 // destructor
53 {
54 }
55 
56 
58 {
61 }
62 
63 
65 {
67 }
68 
69 
70 DEFINE_STATIC_MUTEX(sx_PrepareMutex_bvector);
71 
72 
74 {
75  CMutexGuard guard(sx_PrepareMutex_bvector);
76  if ( !m_BitVector ) {
77  // make bvector
79  bm::deserialize(*bv, (const unsigned char*)&GetData()[0]);
81  }
82 }
83 
84 
86 {
87  Reset();
88  m_BitVector.reset(bv);
89  Tparent::SetSize(bv->size());
91  bv->calc_stat(&stat);
92  TData& arr = SetData();
93  arr.resize(stat.max_serialize_mem);
95  size_t size = bm::serialize(*bv, (unsigned char*)&arr[0], temp_block);
96  bm::aligned_free(temp_block);
97  arr.resize(size);
98 }
99 
100 
101 END_objects_SCOPE // namespace ncbi::objects::
102 
104 
105 /* Original file checksum: lines: 57, chars: 1735, CRC32: d26bbd21 */
DEFINE_STATIC_MUTEX(sx_PrepareMutex_bvector)
User-defined methods of the data storage class.
AutoPtr –.
Definition: ncbimisc.hpp:401
~CBVector_data(void)
void SetBitVector(const bm::bvector<> *bv)
void Reset(void)
Reset the whole object.
AutoPtr< const bm::bvector<> > m_BitVector
void ResetBitVector(void)
void x_CreateBitVector(void) const
size_type size() const noexcept
Returns bvector's capacity (number of bits it can store)
Definition: bm.h:1300
void calc_stat(struct bm::bvector< Alloc >::statistics *st) const noexcept
Calculates bitvector statistics.
Definition: bm.h:3978
void reset(element_type *p=0, EOwnership ownership=eTakeOwnership)
Reset will delete the old pointer (if owned), set content to the new value, and assume the ownership ...
Definition: ncbimisc.hpp:480
element_type * release(void)
Release will release ownership of pointer to caller.
Definition: ncbimisc.hpp:472
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
size_t serialize(const BV &bv, unsigned char *buf, bm::word_t *temp_block=0, unsigned serialization_flags=0)
Saves bitvector into memory.
Definition: bmserial.h:3071
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.
Definition: bmserial.h:3137
TSize & SetSize(void)
Assign a value to Size data member.
virtual void Reset(void)
Reset the whole object.
const TData & GetData(void) const
Get the Data member data.
vector< char > TData
TData & SetData(void)
Assign a value to Data data member.
TSize GetSize(void) const
Get the Size member data.
unsigned int word_t
Definition: bmconst.h:39
void aligned_free(void *ptr) BMNOEXCEPT
Aligned free.
Definition: bmalloc.h:464
void * aligned_new_malloc(size_t size)
Aligned malloc (unlike classic malloc it throws bad_alloc exception)
Definition: bmalloc.h:436
const unsigned set_block_alloc_size
Definition: bmconst.h:61
const struct ncbi::grid::netcache::search::fields::SIZE size
Multi-threading – mutexes; rw-locks; semaphore.
size_t max_serialize_mem
estimated maximum memory for serialization
Definition: bmfunc.h:61
Statistical information about bitset's memory allocation details.
Definition: bm.h:125
Modified on Tue Apr 23 07:40:40 2024 by modify_doxy.py rev. 669887