1 #ifndef OBJTOOLS_WRITERS_WRITEDB__WRITEDB_FILES_HPP
2 #define OBJTOOLS_WRITERS_WRITEDB__WRITEDB_FILES_HPP
76 const string & extension,
98 unsigned int Write(
const char *
data,
int length);
133 virtual void RenameSingle();
135 virtual void RenameFileIndex(
unsigned int num_digits);
147 static string MakeShortName(
const string & base,
int index);
177 return 1000*1000*1000 - 1;
190 void x_MakeFileName();
221 const string & title,
256 m_Hdr.push_back(hdr);
257 m_Seq.push_back(seq);
269 void AddSequence(
int length,
unsigned int hdr,
unsigned int seq,
unsigned int amb)
279 m_Hdr.push_back(hdr);
280 m_Seq.push_back(amb);
281 m_Amb.push_back(seq);
293 int x_Overhead(
const string &
T,
const string & lmdbName,
const string &
D);
356 Uint8 max_file_size);
464 const string &
ambig,
465 unsigned int & off_seq,
466 unsigned int & off_amb,
472 off_seq =
Write(sequence);
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
CWriteDB_IndexFile class.
Uint8 m_MaxFileSize
Maximum file size in bytes.
TFile m_RealFile
Actual stream implementing the output file.
unsigned int WriteInt4(int data)
Write an Int4 (in bigendian order) to the file.
bool m_Created
True if the file has already been opened.
string m_Fname
Current filename for output file.
ofstream TFile
Underlying 'output file' type used here.
const string & GetFilename() const
Get the current filename for this file.
Uint8 x_DefaultByteLimit()
The default value for max_file_size.
string m_BaseName
Database base name for all files.
virtual void x_Flush()=0
This should flush any unwritten data to disk.
unsigned int Write(const CTempString &data)
Write contents of a string to the file.
string m_Nul
For convenience, a string containing one NUL character.
unsigned int m_Offset
Stream position.
unsigned int WriteWithNull(const CTempString &data)
Write contents of a string to the file, appending a NUL.
unsigned int WriteInt8(Int8 data)
Write an Int8 (in bigendian order) to the file.
bool m_UseIndex
True if filenames should use volume index.
string m_Extension
File extension for this file.
This class builds the volume index file (pin or nin).
void AddSequence(int length, unsigned int hdr, unsigned int seq, unsigned int amb)
Add a sequence to a nucleotide index file (nin).
Uint8 m_DataSize
Required space for data once written to disk.
CWriteDB_IndexFile(const string &dbname, bool protein, const string &title, const string &date, int index, Uint8 max_file_size, EBlastDbVersion dbver=eBDB_Version4)
Constructor.
int m_Overhead
Amount of file used by metadata.
int m_OIDs
OIDs added to database so far.
EBlastDbVersion m_Version
BLASTDB version (4 or 5).
bool m_Protein
True if this is a protein database.
virtual void x_Flush()
Flush index data to disk.
void AddSequence(int length, unsigned int hdr, unsigned int seq)
Add a sequence to a protein index file (pin).
string m_Title
Title string for all database volumes.
vector< unsigned int > m_Amb
Offset in sequence file of each OID's ambiguity data.
int x_Overhead(const string &T, const string &lmdbName, const string &D)
Compute index file overhead.
vector< unsigned int > m_Hdr
Start offset in header file of each OID's headers.
const string x_MakeLmdbName()
Form name of LMDB database file.
bool CanFit()
Returns true if another sequence can fit into the file.
Uint8 m_Letters
Letters of sequence data accumulated so far.
int m_MaxLength
Length of longest sequence.
string m_Date
Database creation time stamp.
vector< unsigned int > m_Seq
Offset in sequence file of each OID's sequence data.
bool m_Protein
True if this is a protein database.
virtual void x_Flush()
Flush unwritten data to the output file.
CWriteDB_SequenceFile(const string &dbname, bool protein, int index, Uint8 max_file_size, Uint8 max_letters)
Constructor.
bool CanFit(int size, int letters)
Returns true if the specified amount of data would fit.
Uint8 m_Letters
Letters of sequence data added so far.
Uint8 m_BaseLimit
Limit on letters of sequence data.
void AddSequence(const string &sequence, const string &ambig, unsigned int &off_seq, unsigned int &off_amb, int length)
Add a nucleotide sequence to this file.
void AddSequence(const string &sequence, unsigned int &offset, int length)
Add a protein sequence to this file.
void Write(CObjectOStream &out, TConstObjectPtr object, const CTypeRef &type)
int64_t Int8
8-byte (64-bit) signed 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.
#define NCBI_XOBJWRITE_EXPORT
char * dbname(DBPROCESS *dbproc)
Get name of current database.
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.
Defines exception class and several constants for SeqDB.
EBlastDbVersion
BLAST database version.
static bool ambig(char c)
Data conversion tools for CWriteDB and associated code.
void s_WriteInt8BE(ostream &str, Uint8 x)
Write an eight byte integer to a stream in big-endian format.
void s_WriteInt4(ostream &str, int x)
Write a four byte integer to a stream in big endian format.
USING_SCOPE(objects)
Import definitions from the objects namespace.
Implementation for general purpose utilities for WriteDB.