1 #ifndef OBJTOOLS_READERS_SEQDB__SEQDBFILE_HPP
2 #define OBJTOOLS_READERS_SEQDB__SEQDBFILE_HPP
213 string *
value)
const;
282 const string & dbfilename,
395 "Invalid argument: seq type must be 'p' or 'n'.");
524 TIndx & start)
const;
701 return (start <= end);
bool GetFileSizeL(const string &fname, TIndx &length)
Get size of a file.
CNcbiStreamoff TIndx
The type used for file offsets.
CSeqDBRawFile m_File
The raw file object.
char x_GetSeqType() const
Get the volume's sequence data type.
void x_SetFileType(char prot_nucl)
Sets the sequence data type.
CSeqDBAtlas::TIndx TIndx
Type which spans possible file offsets.
void x_ReadBytes(char *buf, TIndx start, TIndx end) const
Read part of the file into a buffer.
CSeqDBAtlas & m_Atlas
The memory layer management object.
char m_ProtNucl
Either 'p' for protein or 'n' for nucleotide.
CSeqDBFileMemMap m_Lease
A memory lease used by this file.
TIndx x_ReadSwapped(CSeqDBFileMemMap &lease, TIndx offset, T *value)
Read a numerical object from the file.
virtual ~CSeqDBExtFile()
Destructor.
void UnLease()
Release memory held in the atlas layer by this object.
string m_FileName
The name of this file.
CSeqDBExtFile(CSeqDBAtlas &atlas, const string &dbfilename, char prot_nucl)
Constructor.
const char * GetFileDataPtr(const string &fname, TIndx offset)
Get a pointer to the specified offset.
void Init(const string &filename)
Initializes a memory map object.
void Clear()
Clears the memory mapobject.
const char * GetFileDataPtr(TIndx start) const
Read part of the file into a buffer.
CSeqDBHdrFile(CSeqDBAtlas &atlas, const string &dbname, char prot_nucl)
Constructor.
void ReadBytes(char *buf, TIndx start, TIndx end) const
Read part of the file into a buffer.
CSeqDBAtlas::TIndx TIndx
Type which spans possible file offsets.
virtual ~CSeqDBHdrFile()
Destructor.
void x_ClrSeq() const
Return sequence data (assumes locked).
Uint4 * x_GetAmb() const
Get ambiguity data (assumes locked).
string m_LMDBFile
Name of matching SQLite file (empty if version 4 DB)
TIndx m_EndSeq
Offset of the end of the sequence section.
string GetDate() const
Get the construction date of the volume.
void x_ClrAmb() const
Return ambiguity data (assumes locked).
Uint4 m_NumOIDs
The number of oids in this volume.
TIndx m_OffHdr
offset of the start of the header section.
void GetHdrStartEnd(int oid, TIndx &start, TIndx &end) const
Get the location of a sequence's header data.
void x_ClrHdr() const
Return header data (assumes locked).
void UnLease()
Release any memory leases temporarily held here.
string GetTitle() const
Get the volume title.
int GetNumOIDs() const
Get the number of oids in this volume.
CSeqDBFileMemMap m_SeqLease
A memory lease used by the sequence section of this file.
string GetLMDBFileName() const
bool GetAmbStartEnd(int oid, TIndx &start, TIndx &end) const
Get the location of a sequence's ambiguity data.
Uint4 m_MaxLen
The length of the longest sequence in this volume.
TIndx m_EndAmb
Offset of the end of the ambiguity section.
string m_Title
The volume title.
TIndx m_EndHdr
Offset of the end of the header section.
Uint8 GetVolumeLength() const
Get the length of the volume (in bases).
Uint4 * x_GetHdr() const
Get header data (assumes locked).
Uint4 m_Volume
Volume number (only set in version 5 DBs)
int GetMinLength() const
Get the length of the shortest sequence in this volume.
Uint8 m_VolLen
The length of the volume (in bases).
TIndx m_OffSeq
Offset of the start of the sequence section.
virtual ~CSeqDBIdxFile()
Destructor.
void GetSeqStart(int oid, TIndx &start) const
Get the location of a sequence's packed sequence data.
char GetSeqType() const
Get the sequence data type.
TIndx m_OffAmb
Offset of the start of the ambiguity section.
CSeqDBFileMemMap m_AmbLease
A memory lease used by the ambiguity section of this file.
CSeqDBIdxFile(CSeqDBAtlas &atlas, const string &dbname, char prot_nucl)
Constructor.
int GetMaxLength() const
Get the length of the longest sequence in this volume.
string m_Date
The construction date of the volume.
Uint4 m_MinLen
The length of the shortest sequence in this volume.
void GetSeqStartEnd(int oid, TIndx &start, TIndx &end) const
Get the location of a sequence's packed sequence data.
CSeqDBFileMemMap m_HdrLease
Verify the integrity of this object and subobjects.
Uint4 * x_GetSeq() const
Get sequence data (assumes locked).
TIndx GetFileLength() const
Get the length of the file.
TIndx ReadSwapped(CSeqDBFileMemMap &lease, TIndx offset, Uint4 *value) const
Read a four byte numerical object from the file.
void ReadBytes(CSeqDBFileMemMap &lease, char *buf, TIndx start, TIndx end) const
Read part of the file into a buffer.
TIndx m_Length
The length of this file.
string m_FileName
The name of this file.
CSeqDBRawFile(CSeqDBAtlas &atlas)
Constructor.
CSeqDBAtlas::TIndx TIndx
Type which spans possible file offsets.
bool Open(const CSeqDB_Path &name)
MMap or Open a file.
const char * GetFileDataPtr(CSeqDBFileMemMap &lease, TIndx start, TIndx end) const
Get a pointer to a section of the file.
CSeqDBAtlas & m_Atlas
The memory management layer object.
CSeqDBSeqFile(CSeqDBAtlas &atlas, const string &dbname, char prot_nucl)
Constructor.
CSeqDBAtlas::TIndx TIndx
Type which spans possible file offsets.
void ReadBytes(char *buf, TIndx start, TIndx end) const
Read part of the file into a buffer.
virtual ~CSeqDBSeqFile()
Destructor.
const char * GetFileDataPtr(TIndx start) const
Get a pointer into the file contents.
const string & GetPathS() const
Get the path as a string.
bool Valid() const
Returns true if this object has a value.
The NCBI C++ standard methods for dealing with std::string.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
uint32_t Uint4
4-byte (32-bit) unsigned integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
char * dbname(DBPROCESS *dbproc)
Get name of current database.
const GenericPointer< typename T::ValueType > T2 value
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
The SeqDB memory management layer.
Defines exception class and several constants for SeqDB.
CSeqDBAtlas::TIndx TIndx
Index file.
This file defines several SeqDB utility functions related to byte order and file system portability.
#define SEQDB_FILE_ASSERT(YESNO)
T SeqDB_GetStdOrd(const T *stdord_obj)
Read a network order integer value.