NCBI C++ ToolKit
|
Search Toolkit Book for CWriteDB_Isam
CWriteDB_Isam class. More...
#include <objtools/blast/seqdb_writer/writedb_isam.hpp>
Public Types | |
typedef EWriteDBIsamType | EIsamType |
Type of identifier stored in this ISAM index. More... | |
typedef vector< CRef< CSeq_id > > | TIdList |
Type used for lists of sequence identifiers. 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 | |
CWriteDB_Isam (EIsamType itype, const string &dbname, bool protein, int index, Uint8 max_file_size, bool sparse) | |
Constructor for an ISAM index file. More... | |
~CWriteDB_Isam () | |
Destructor. More... | |
void | AddIds (int oid, const TIdList &ids) |
Add sequence IDs to the index file. More... | |
void | AddPig (int oid, int pig) |
Set PIG for a protein sequence. More... | |
void | AddHash (int oid, int hash) |
Set a sequence's hash value. More... | |
void | RenameSingle () |
Rename files to single-volume names. More... | |
void | RenameFileIndex (unsigned int num_digits) |
void | Close () |
Flush data to disk and close all associated files. More... | |
bool | CanFit (int num) |
Tests whether there is room for a given number of IDs. More... | |
void | ListFiles (vector< string > &files) const |
List Filenames. 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 Attributes | |
CRef< CWriteDB_IsamIndex > | m_IFile |
Index file, contains meta data and samples of the key/oid pairs. More... | |
CRef< CWriteDB_IsamData > | m_DFile |
Data file, contains one record for each key/oid pair. 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... | |
CWriteDB_Isam class.
This manufactures isam indices.
Definition at line 401 of file writedb_isam.hpp.
Type of identifier stored in this ISAM index.
Definition at line 404 of file writedb_isam.hpp.
typedef vector< CRef<CSeq_id> > CWriteDB_Isam::TIdList |
Type used for lists of sequence identifiers.
Definition at line 407 of file writedb_isam.hpp.
CWriteDB_Isam::CWriteDB_Isam | ( | EIsamType | itype, |
const string & | dbname, | ||
bool | protein, | ||
int | index, | ||
Uint8 | max_file_size, | ||
bool | sparse | ||
) |
Constructor for an ISAM index file.
itype | Type (GI, PIG, or string). [in] |
dbname | Database name (same for all volumes). [in] |
protein | True for protein, false for nucleotide. [in] |
index | Index of the associated volume. [in] |
max_file_size | Maximum size of any generated file in bytes. [in] |
sparse | Set to true if sparse mode should be used. [in] |
Definition at line 98 of file writedb_isam.cpp.
References dbname(), m_DFile, m_IFile, and CRef< C, Locker >::Reset().
CWriteDB_Isam::~CWriteDB_Isam | ( | ) |
Destructor.
Definition at line 120 of file writedb_isam.cpp.
Set a sequence's hash value.
The sequence hash is a hash of a sequence. This adds that hash for the purpose of building an ISAM file mapping hash values to OIDs.
oid | OID of the sequence. [in] |
hash | Sequence hash for this sequence. [in] |
Definition at line 139 of file writedb_isam.cpp.
References CWriteDB_IsamIndex::AddHash(), and m_IFile.
Referenced by CWriteDB_Volume::WriteSequence().
Add sequence IDs to the index file.
If this is a GI index, GIs are collected and added to an internal list. If this is a string index, various strings are constructed from the identifiers and added to a sorting class. How many and what kind of strings are indexed depends on whether the "sparse" flag is specified.
oid | OID of the sequence. [in] |
ids | List of sequence identifiers. [in] |
Definition at line 129 of file writedb_isam.cpp.
References CWriteDB_IsamIndex::AddIds(), and m_IFile.
Referenced by CWriteDB_Volume::WriteSequence().
Set PIG for a protein sequence.
The PIG identifier corresponds to a specific string of protein residues rather than to a single defline or GI, and as such is not treated as a true sequence identifier. Each PIG will be associated with one OID in a non-redundant protein database.
oid | OID of the sequence. [in] |
pig | PIG identifier for this sequence. [in] |
Definition at line 134 of file writedb_isam.cpp.
References CWriteDB_IsamIndex::AddPig(), and m_IFile.
Referenced by CWriteDB_Volume::WriteSequence().
Tests whether there is room for a given number of IDs.
This returns true if the specified number of identifiers can be added to this volume without overflowing the maximum file size. For strings, the estimating technique used is very rough (to avoid excess computation) and will tend to return false several disk blocks before the ISAM file actually reaches the maximum file size. This is done for performance reasons.
num | Number of IDs that would be added. [in] |
Definition at line 124 of file writedb_isam.cpp.
References CWriteDB_IsamIndex::CanFit(), and m_IFile.
Referenced by CWriteDB_Volume::WriteSequence().
void CWriteDB_Isam::Close | ( | void | ) |
Flush data to disk and close all associated files.
Definition at line 144 of file writedb_isam.cpp.
References CWriteDB_File::Close(), m_DFile, and m_IFile.
Referenced by CWriteDB_Volume::Close().
void CWriteDB_Isam::ListFiles | ( | vector< string > & | files | ) | const |
List Filenames.
Returns a list of the files constructed by this class; the returned list may not be complete until Close() has been called. The list is not cleared; instead names are appended to existing contents.
files | The set of resolved database path names. [out] |
Definition at line 819 of file writedb_isam.cpp.
References CWriteDB_IsamIndex::Empty(), CWriteDB_File::GetFilename(), m_DFile, and m_IFile.
Referenced by CWriteDB_Volume::ListFiles().
void CWriteDB_Isam::RenameFileIndex | ( | unsigned int | num_digits | ) |
Definition at line 160 of file writedb_isam.cpp.
References m_DFile, m_IFile, and CWriteDB_File::RenameFileIndex().
Referenced by CWriteDB_Volume::RenameFileIndex().
void CWriteDB_Isam::RenameSingle | ( | ) |
Rename files to single-volume names.
When volume component files are generated by WriteDB, the names include a volume index. This method renames the files to names that do not include the volume index. This method should not be called until after Close() is called.
Definition at line 154 of file writedb_isam.cpp.
References m_DFile, m_IFile, and CWriteDB_File::RenameSingle().
Referenced by CWriteDB_Volume::RenameSingle().
|
private |
Data file, contains one record for each key/oid pair.
Definition at line 505 of file writedb_isam.hpp.
Referenced by Close(), CWriteDB_Isam(), ListFiles(), RenameFileIndex(), and RenameSingle().
|
private |
Index file, contains meta data and samples of the key/oid pairs.
Definition at line 502 of file writedb_isam.hpp.
Referenced by AddHash(), AddIds(), AddPig(), CanFit(), Close(), CWriteDB_Isam(), ListFiles(), RenameFileIndex(), and RenameSingle().