NCBI C++ ToolKit
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CSeedRoots Class Reference

Search Toolkit Book for CSeedRoots

Seed roots container for all subjects. More...

+ Collaboration diagram for CSeedRoots:

Public Member Functions

 CSeedRoots (TSeqNum num_subjects=0)
 Object constructor. More...
 
 ~CSeedRoots ()
 Object destructor. More...
 
void Add (const SSeedRoot &root, TSeqNum subject)
 Append a normal (non boundary) root to the container. More...
 
void Add2 (const SSeedRoot &root1, const SSeedRoot &root2, TSeqNum subject)
 Append a boundary root (both parts) to the container. More...
 
const SSubjRootsInfoGetSubjInfo (TSeqNum subject) const
 Get the set of roots for a particular subject. More...
 
const SSeedRootGetSubjRoots (TSeqNum subject) const
 Return the preallocated array of roots for a particular subject. More...
 
bool Overflow () const
 Check if the max number of elements is reached. More...
 
void Reset ()
 Reinitialize the structure. More...
 

Private Types

typedef SSubjRootsInfo::TRoots TRoots
 Alias type for convenience. More...
 

Private Member Functions

void CleanUp ()
 Clean up all the dynamically allocated memory. More...
 
void Allocate ()
 Reallocate all the storage. More...
 

Private Attributes

TSeqNum num_subjects_
 Number of subjects in the index. More...
 
unsigned long subj_roots_len_bits_
 Log_2 of n_subj_roots_. More...
 
unsigned long n_subj_roots_
 Space is preallocated for this number of roots per subject. More...
 
SSeedRootroots_
 Roots array preallocated for all subjects. More...
 
SSubjRootsInforinfo_
 Array of root information structures for each subject. More...
 
unsigned long total_
 Currenr total number of elements. More...
 
unsigned long total_roots_
 Max number of roots in preallocated storage. More...
 

Static Private Attributes

static const unsigned long TOTAL_CACHE = 4*1024*1024
 Assumption on the amound of cache in the system. More...
 
static const unsigned long LIMIT_ROOTS = 16*1024*1024
 Max number of roots before triggering overflow. More...
 

Detailed Description

Seed roots container for all subjects.

Definition at line 216 of file dbindex_search.cpp.

Member Typedef Documentation

◆ TRoots

Alias type for convenience.

Definition at line 219 of file dbindex_search.cpp.

Constructor & Destructor Documentation

◆ CSeedRoots()

CSeedRoots::CSeedRoots ( TSeqNum  num_subjects = 0)

Object constructor.

Parameters
num_subjects[I] number of subjects sequences

Definition at line 332 of file dbindex_search.cpp.

References Allocate(), n_subj_roots_, num_subjects_, subj_roots_len_bits_, TOTAL_CACHE, and total_roots_.

◆ ~CSeedRoots()

CSeedRoots::~CSeedRoots ( )
inline

Object destructor.

Definition at line 229 of file dbindex_search.cpp.

References CleanUp().

Member Function Documentation

◆ Add()

INLINE void CSeedRoots::Add ( const SSeedRoot root,
TSeqNum  subject 
)

Append a normal (non boundary) root to the container.

Parameters
root[I] root to append
subject[I] subject sequence containing root.soff_ of the root

Definition at line 348 of file dbindex_search.cpp.

References SSubjRootsInfo::extra_roots_, SSubjRootsInfo::len_, n_subj_roots_, rinfo_, roots_, subj_roots_len_bits_, subject, and total_.

◆ Add2()

INLINE void CSeedRoots::Add2 ( const SSeedRoot root1,
const SSeedRoot root2,
TSeqNum  subject 
)

Append a boundary root (both parts) to the container.

Parameters
root1[I] boundary root structure
root2[I] real root data
subject[I] subject sequence containing root2.soff_.

Definition at line 368 of file dbindex_search.cpp.

References SSubjRootsInfo::extra_roots_, SSubjRootsInfo::len_, n_subj_roots_, rinfo_, roots_, subj_roots_len_bits_, subject, and total_.

◆ Allocate()

void CSeedRoots::Allocate ( )
private

Reallocate all the storage.

Used by constructor and Reset().

Definition at line 309 of file dbindex_search.cpp.

References CleanUp(), i, num_subjects_, rinfo_, roots_, t, and total_roots_.

Referenced by CSeedRoots(), and Reset().

◆ CleanUp()

void CSeedRoots::CleanUp ( )
inlineprivate

Clean up all the dynamically allocated memory.

Definition at line 284 of file dbindex_search.cpp.

References SSubjRootsInfo::CleanUp(), i, num_subjects_, rinfo_, and roots_.

Referenced by Allocate(), Reset(), and ~CSeedRoots().

◆ GetSubjInfo()

const SSubjRootsInfo& CSeedRoots::GetSubjInfo ( TSeqNum  subject) const
inline

Get the set of roots for a particular subject.

Parameters
subject[I] local subject id
Returns
reference to SSubjRootsInfo describing the given subject

Definition at line 253 of file dbindex_search.cpp.

References rinfo_, and subject.

◆ GetSubjRoots()

const SSeedRoot* CSeedRoots::GetSubjRoots ( TSeqNum  subject) const
inline

Return the preallocated array of roots for a particular subject.

Parameters
subject[I] local subject id
Returns
preallocated array for storing roots for the given subject

Definition at line 262 of file dbindex_search.cpp.

References roots_, subj_roots_len_bits_, and subject.

◆ Overflow()

bool CSeedRoots::Overflow ( ) const
inline

Check if the max number of elements is reached.

Returns
true if LIM_ROOTS is exceeded, false otherwise

Definition at line 268 of file dbindex_search.cpp.

References LIMIT_ROOTS, and total_.

◆ Reset()

void CSeedRoots::Reset ( void  )

Reinitialize the structure.

Definition at line 325 of file dbindex_search.cpp.

References Allocate(), CleanUp(), rinfo_, roots_, and total_.

Member Data Documentation

◆ LIMIT_ROOTS

const unsigned long CSeedRoots::LIMIT_ROOTS = 16*1024*1024
staticprivate

Max number of roots before triggering overflow.

Definition at line 281 of file dbindex_search.cpp.

Referenced by Overflow().

◆ n_subj_roots_

unsigned long CSeedRoots::n_subj_roots_
private

Space is preallocated for this number of roots per subject.

Definition at line 301 of file dbindex_search.cpp.

Referenced by Add(), Add2(), and CSeedRoots().

◆ num_subjects_

TSeqNum CSeedRoots::num_subjects_
private

Number of subjects in the index.

Definition at line 299 of file dbindex_search.cpp.

Referenced by Allocate(), CleanUp(), and CSeedRoots().

◆ rinfo_

SSubjRootsInfo* CSeedRoots::rinfo_
private

Array of root information structures for each subject.

Dynamically allocated.

Definition at line 303 of file dbindex_search.cpp.

Referenced by Add(), Add2(), Allocate(), CleanUp(), GetSubjInfo(), and Reset().

◆ roots_

SSeedRoot* CSeedRoots::roots_
private

Roots array preallocated for all subjects.

Definition at line 302 of file dbindex_search.cpp.

Referenced by Add(), Add2(), Allocate(), CleanUp(), GetSubjRoots(), and Reset().

◆ subj_roots_len_bits_

unsigned long CSeedRoots::subj_roots_len_bits_
private

Log_2 of n_subj_roots_.

Definition at line 300 of file dbindex_search.cpp.

Referenced by Add(), Add2(), CSeedRoots(), and GetSubjRoots().

◆ total_

unsigned long CSeedRoots::total_
private

Currenr total number of elements.

Definition at line 305 of file dbindex_search.cpp.

Referenced by Add(), Add2(), Overflow(), and Reset().

◆ TOTAL_CACHE

const unsigned long CSeedRoots::TOTAL_CACHE = 4*1024*1024
staticprivate

Assumption on the amound of cache in the system.

(overly optimistic)

Definition at line 278 of file dbindex_search.cpp.

Referenced by CSeedRoots().

◆ total_roots_

unsigned long CSeedRoots::total_roots_
private

Max number of roots in preallocated storage.

Definition at line 306 of file dbindex_search.cpp.

Referenced by Allocate(), and CSeedRoots().


The documentation for this class was generated from the following file:
Modified on Sun Apr 21 03:44:57 2024 by modify_doxy.py rev. 669887