37 #ifndef OBJTOOLS_BLAST_GENE_INFO_READER___FILE_UTILS__HPP
38 #define OBJTOOLS_BLAST_GENE_INFO_READER___FILE_UTILS__HPP
82 template <
int k_nFields>
124 template <
int k_nFields>
129 template <
int k_nFields>
141 int& nCurrentOffset);
159 out.write((
char*)(&record.
n1),
sizeof(
int));
160 out.write((
char*)(&record.
n2),
sizeof(
int));
167 in.read((
char*)(&record.
n1),
sizeof(
int));
168 in.read((
char*)(&record.
n2),
sizeof(
int));
171 template <
int k_nFields>
176 for (
int iField = 0; iField < k_nFields; iField++)
177 out.write((
char*)(&record.
n[iField]),
sizeof(
int));
180 template <
int k_nFields>
185 for (
int iField = 0; iField < k_nFields; iField++)
186 in.read((
char*)(&record.
n[iField]),
sizeof(
int));
static bool CheckExistence(const string &strFile)
Check if a file exists, given its name.
static bool OpenBinaryOutputFile(const string &strFileName, CNcbiOfstream &out)
Open the given binary file for writing.
static bool CheckDirExistence(const string &strDir)
Check if a directory exists, given its name.
static void ReadRecord(CNcbiIfstream &in, STwoIntRecord &record)
Read a pair of integers from the file.
static Int8 GetLength(const string &strFile)
Get the length of a file, given its name.
static bool OpenTextInputFile(const string &strFileName, CNcbiIfstream &in)
Open the given text file for reading.
static bool OpenTextOutputFile(const string &strFileName, CNcbiOfstream &out)
Open the given text file for writing.
static bool OpenBinaryInputFile(const string &strFileName, CNcbiIfstream &in)
Open the given binary file for reading.
static void WriteGeneInfo(CNcbiOfstream &out, CRef< CGeneInfo > info, int &nCurrentOffset)
Write a Gene info object to the file.
static void ReadGeneInfo(CNcbiIfstream &in, int nOffset, CRef< CGeneInfo > &info)
Read a Gene info object from the file.
static void WriteRecord(CNcbiOfstream &out, STwoIntRecord &record)
Write a pair of integers to the file.
std::ofstream out("events_result.xml")
main entry point for tests
Gene information class and related interfaces.
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
#define NCBI_XOBJREAD_EXPORT
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
std::istream & in(std::istream &in_, double &x_)
SMultiIntRecord - an n-tuple of integers.
int n[k_nFields]
Array of integer fields of the record.
STwoIntRecord - a pair of integers.
int n1
First integer field of the record.
int n2
Second integer field of the record.