NCBI C++ ToolKit
|
Search Toolkit Book for CCachedSequence
Manages a TSE and its subordinate chunks for all implementations of the IBlastDbAdapter interface. More...
#include "cached_sequence.hpp"
(Private to src/objtools/data_loaders/blastdb
.)
Public Types | |
typedef vector< CRef< CTSE_Chunk_Info > > | TCTSE_Chunk_InfoVector |
A list of 'chunk' objects, generic sequence related data elements. More... | |
![]() | |
enum | EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern } |
Control filling of newly allocated memory. More... | |
typedef CObjectCounterLocker | TLockerType |
Default locker type for CRef. More... | |
typedef atomic< Uint8 > | TCounter |
Counter type is CAtomiCounter. More... | |
typedef Uint8 | TCount |
Alias for value type of counter. More... | |
Public Member Functions | |
CCachedSequence (IBlastDbAdapter &blastdb, const CSeq_id_Handle &idh, int oid, bool use_fixed_size_slices, TSeqPos slice_size=kSequenceSliceSize) | |
Construct and pre-process the sequence. More... | |
void | RegisterIds (CBlastDbDataLoader::TIdMap &idmap) |
Add this sequence's identifiers to a lookup table held by the data loader. More... | |
void | SplitSeqData (TCTSE_Chunk_InfoVector &chunks) |
Load or split the sequence data chunks. More... | |
CRef< CSeq_entry > | GetTSE () const |
Get the top-level seq-entry managed by this object. More... | |
![]() | |
CObject (void) | |
Constructor. More... | |
CObject (const CObject &src) | |
Copy constructor. More... | |
virtual | ~CObject (void) |
Destructor. More... | |
CObject & | operator= (const CObject &src) THROWS_NONE |
Assignment operator. More... | |
bool | CanBeDeleted (void) const THROWS_NONE |
Check if object can be deleted. More... | |
bool | IsAllocatedInPool (void) const THROWS_NONE |
Check if object is allocated in memory pool (not system heap) More... | |
bool | Referenced (void) const THROWS_NONE |
Check if object is referenced. More... | |
bool | ReferencedOnlyOnce (void) const THROWS_NONE |
Check if object is referenced only once. More... | |
void | AddReference (void) const |
Add reference to object. More... | |
void | RemoveReference (void) const |
Remove reference to object. More... | |
void | ReleaseReference (void) const |
Remove reference without deleting object. More... | |
virtual void | DoNotDeleteThisObject (void) |
Mark this object as not allocated in heap – do not delete this object. More... | |
virtual void | DoDeleteThisObject (void) |
Mark this object as allocated in heap – object can be deleted. More... | |
void * | operator new (size_t size) |
Define new operator for memory allocation. More... | |
void * | operator new[] (size_t size) |
Define new[] operator for 'array' memory allocation. More... | |
void | operator delete (void *ptr) |
Define delete operator for memory deallocation. More... | |
void | operator delete[] (void *ptr) |
Define delete[] operator for memory deallocation. More... | |
void * | operator new (size_t size, void *place) |
Define new operator. More... | |
void | operator delete (void *ptr, void *place) |
Define delete operator. More... | |
void * | operator new (size_t size, CObjectMemoryPool *place) |
Define new operator using memory pool. More... | |
void | operator delete (void *ptr, CObjectMemoryPool *place) |
Define delete operator. More... | |
virtual void | DebugDump (CDebugDumpContext ddc, unsigned int depth) const |
Define method for dumping debug information. More... | |
![]() | |
CDebugDumpable (void) | |
virtual | ~CDebugDumpable (void) |
void | DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const |
void | DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const |
void | DumpToConsole (void) const |
Private Member Functions | |
void | x_AddSplitSeqChunk (TCTSE_Chunk_InfoVector &chunks, const CSeq_id_Handle &id, TSeqPos begin, TSeqPos end) |
Add a chunk of sequence data. More... | |
void | x_AddFullSeq_data (void) |
Add an the entire sequence data to this object's TSE as raw data in its Seq-data field. More... | |
Private Attributes | |
CSeq_id_Handle | m_SIH |
SeqID handle. More... | |
CRef< CSeq_entry > | m_TSE |
The Seq entry we handle. More... | |
TSeqPos | m_Length |
Sequence length in bases. More... | |
IBlastDbAdapter & | m_BlastDb |
Database reference. More... | |
int | m_OID |
Locates this sequence within m_BlastDb. More... | |
bool | m_UseFixedSizeSlices |
Determines whether sequences should be fetched in fixed size slices or in incrementally larger sizes. More... | |
TSeqPos | m_SliceSize |
Specifies the slice size for splitting the sequence data. More... | |
Additional Inherited Members | |
![]() | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (void) |
Define method to throw null pointer exception. More... | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (const type_info &type) |
static EAllocFillMode | GetAllocFillMode (void) |
static void | SetAllocFillMode (EAllocFillMode mode) |
static void | SetAllocFillMode (const string &value) |
Set mode from configuration parameter value. More... | |
![]() | |
static void | EnableDebugDump (bool on) |
![]() | |
static const TCount | eCounterBitsCanBeDeleted = 1 << 0 |
Define possible object states. More... | |
static const TCount | eCounterBitsInPlainHeap = 1 << 1 |
Heap signature was found. More... | |
static const TCount | eCounterBitsPlaceMask |
Mask for 'in heap' state flags. More... | |
static const int | eCounterStep = 1 << 2 |
Skip over the "in heap" bits. More... | |
static const TCount | eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2) |
Minimal value for valid objects (reference counter is zero) Must be a single bit value. More... | |
static const TCount | eCounterStateMask |
Valid object, and object in heap. More... | |
![]() | |
virtual void | DeleteThis (void) |
Virtual method "deleting" this object. More... | |
Manages a TSE and its subordinate chunks for all implementations of the IBlastDbAdapter interface.
Definition at line 46 of file cached_sequence.hpp.
typedef vector< CRef<CTSE_Chunk_Info> > CCachedSequence::TCTSE_Chunk_InfoVector |
A list of 'chunk' objects, generic sequence related data elements.
Definition at line 81 of file cached_sequence.hpp.
CCachedSequence::CCachedSequence | ( | IBlastDbAdapter & | blastdb, |
const CSeq_id_Handle & | idh, | ||
int | oid, | ||
bool | use_fixed_size_slices, | ||
TSeqPos | slice_size = kSequenceSliceSize |
||
) |
Construct and pre-process the sequence.
This constructor starts the processing of the specified sequence. It loads the bioseq (minus sequence data) and caches the sequence length.
idh | A handle to the sequence identifier. |
blastdb | The interface to the BLAST database containing the original sequence. |
oid | Locates the sequence within the BLAST database. |
use_fixed_size_slices | Determines the strategy to retrieve the sequence data that is split, see comment for this class' m_UseFixedSizeSlices field. |
slice_size | Determines the slice size for splitting the sequence data. |
Definition at line 46 of file cached_sequence.cpp.
References _ASSERT, CSeq_inst_Base::eMol_aa, CSeq_inst_Base::eMol_na, CSeqDB::eProtein, CBioseq::GetFirstId(), CSeq_id_Handle::GetHandle(), CBioseq_Base::SetInst(), and ZERO_GI.
|
inline |
Get the top-level seq-entry managed by this object.
Definition at line 95 of file cached_sequence.hpp.
References m_TSE.
void CCachedSequence::RegisterIds | ( | CBlastDbDataLoader::TIdMap & | idmap | ) |
Add this sequence's identifiers to a lookup table held by the data loader.
This method adds identifiers from this sequence to a lookup table so that the OID of the sequence can be found quickly during future processing of the same sequence.
idmap | A map from CSeq_id_Handle to OID. |
Definition at line 98 of file cached_sequence.cpp.
References _ASSERT, CSeq_id_Handle::GetHandle(), CSeq_entry_Base::IsSeq(), ITERATE, m_OID, m_TSE, s_ExtractSeqIds(), CBioseq_Base::SetId(), and CSeq_entry_Base::SetSeq().
void CCachedSequence::SplitSeqData | ( | TCTSE_Chunk_InfoVector & | chunks | ) |
Load or split the sequence data chunks.
The sequence data is stored and a list of the available ranges of data is returned via the 'chunks' parameter. For large sequences, these do not contain sequence data, but merely indicate what is available, in other cases, the entire sequence data will be loaded
chunks | The sequence data chunks will be returned here. |
Definition at line 120 of file cached_sequence.cpp.
References delta(), CSeq_inst_Base::eRepr_delta, CSeq_inst_Base::eRepr_raw, kFastSequenceLoadSize, kRmtSequenceSliceSize, kSliceGrowthFactor, m_Length, m_SIH, m_SliceSize, m_TSE, m_UseFixedSizeSlices, CSeq_inst_Base::SetExt(), CBioseq_Base::SetInst(), CSeq_inst_Base::SetRepr(), CSeq_entry_Base::SetSeq(), x_AddFullSeq_data(), and x_AddSplitSeqChunk().
|
private |
Add an the entire sequence data to this object's TSE as raw data in its Seq-data field.
Definition at line 112 of file cached_sequence.cpp.
References _ASSERT, IBlastDbAdapter::GetSequence(), m_BlastDb, m_Length, m_OID, m_TSE, CRef< C, Locker >::NotEmpty(), CBioseq_Base::SetInst(), and CSeq_entry_Base::SetSeq().
Referenced by SplitSeqData().
|
private |
Add a chunk of sequence data.
This method builds a description of a specific range of sequence data, returning it via the 'chunks' parameter. The actual data is not built, just a description that identifies the sequence and the range of that sequence's data represented by this chunk.
chunks | object where to add the chunk [in|out] |
id | identifier for the sequence chunk about to be added [in] |
begin | starting offset of the chunk [in] |
end | ending offset of the chunk [in] |
Definition at line 157 of file cached_sequence.cpp.
References CTSE_Chunk_Info::x_AddSeq_data().
Referenced by SplitSeqData().
|
private |
Database reference.
Definition at line 110 of file cached_sequence.hpp.
Referenced by x_AddFullSeq_data().
|
private |
Sequence length in bases.
Definition at line 107 of file cached_sequence.hpp.
Referenced by SplitSeqData(), and x_AddFullSeq_data().
|
private |
Locates this sequence within m_BlastDb.
Definition at line 113 of file cached_sequence.hpp.
Referenced by RegisterIds(), and x_AddFullSeq_data().
|
private |
|
private |
Specifies the slice size for splitting the sequence data.
Definition at line 122 of file cached_sequence.hpp.
Referenced by SplitSeqData().
|
private |
The Seq entry we handle.
Definition at line 104 of file cached_sequence.hpp.
Referenced by GetTSE(), RegisterIds(), SplitSeqData(), and x_AddFullSeq_data().
|
private |
Determines whether sequences should be fetched in fixed size slices or in incrementally larger sizes.
The latter improves performance on full sequence retrieval of large sequences, but degrades the performance of retrieval of small sequence segments of large sequences
Definition at line 119 of file cached_sequence.hpp.
Referenced by SplitSeqData().