1 #ifndef OBJTOOLS_BLAST_SEQDB_READER___SEQDBBLOB__HPP
2 #define OBJTOOLS_BLAST_SEQDB_READER___SEQDBBLOB__HPP
120 #if ((!defined(NCBI_COMPILER_WORKSHOP) || (NCBI_COMPILER_VERSION > 550)) && \
121 (!defined(NCBI_COMPILER_MIPSPRO)) )
128 int ReadInt1(
int offset)
const;
136 int ReadInt2(
int offset)
const;
157 void SeekRead(
int offset);
163 int WriteVarInt(
Int8 x);
174 static int VarIntSize(
Int8 x);
177 #if ((!defined(NCBI_COMPILER_WORKSHOP) || (NCBI_COMPILER_VERSION > 550)) && \
178 (!defined(NCBI_COMPILER_MIPSPRO)) )
181 void WriteInt1(
int x);
182 void WriteInt1_LE(
int x);
187 void WriteInt1(
int x,
int offset);
188 void WriteInt1_LE(
int x,
int offset);
193 void WriteInt2(
int x);
194 void WriteInt2_LE(
int x);
199 void WriteInt2(
int x,
int offset);
200 void WriteInt2_LE(
int x,
int offset);
205 void WriteInt4(
Int4 x);
206 void WriteInt4_LE(
Int4 x);
217 void WriteInt8(
Int8 x);
218 void WriteInt8_LE(
Int8 x);
229 void SeekWrite(
int offset);
240 #if ((!defined(NCBI_COMPILER_WORKSHOP) || (NCBI_COMPILER_VERSION > 550)) && \
241 (!defined(NCBI_COMPILER_MIPSPRO)) )
287 void WritePadBytes(
int align, EPadding fmt);
298 void SkipPadBytes(
int align, EPadding fmt);
303 const char * ReadRaw(
int size);
308 void WriteRaw(
const char * begin,
int size);
314 void WriteRaw(
const char * begin,
int size,
int offset);
318 int GetWriteOffset()
const;
322 int GetReadOffset()
const;
333 void x_Copy(
int total);
337 void x_Reserve(
int size);
343 void x_WriteRaw(
const char * ptr,
int size,
int * offsetp);
357 const char * x_ReadRaw(
int size,
int * offsetp)
const;
363 int x_WriteVarInt(
Int8 x,
int * offsetp);
368 Int8 x_ReadVarInt(
int * offsetp)
const;
370 #if ((!defined(NCBI_COMPILER_WORKSHOP) || (NCBI_COMPILER_VERSION > 550)) && \
371 (!defined(NCBI_COMPILER_MIPSPRO)) )
377 int x_WriteString(
CTempString str, EStringFormat fmt,
int * offsetp);
383 CTempString x_ReadString(EStringFormat fmt,
int * offsetp)
const;
388 template<
typename TValue,
int TBytes>
392 unsigned char *
buf = (
unsigned char*) x_ReadRaw(TBytes, offsetp);
393 unsigned char * vbuf =
buf - 8 + TBytes;
398 case 8: x |=
Uint8(vbuf[0]) << 56;
399 case 7: x |=
Uint8(vbuf[1]) << 48;
400 case 6: x |=
Uint8(vbuf[2]) << 40;
401 case 5: x |=
Uint8(vbuf[3]) << 32;
402 case 4: x |=
Uint4(vbuf[4]) << 24;
403 case 3: x |=
Uint4(vbuf[5]) << 16;
404 case 2: x |=
Uint4(vbuf[6]) << 8;
411 if (TBytes <
sizeof(TValue)) {
418 int bits = (
sizeof(TValue)-TBytes) * 8;
419 x = (x << bits) >> bits;
428 template<
typename TValue,
int TBytes>
433 ((
Int8(x) >> (TBytes*8-1)) >> 2));
435 unsigned char buf[8];
451 x_WriteRaw((
char*)(
buf + 8 - TBytes), TBytes, offsetp);
457 template<
typename TValue,
int TBytes>
462 ((
Int8(x) >> (TBytes*8-1)) >> 2));
464 unsigned char buf[8];
480 x_WriteRaw((
char*)(
buf), TBytes, offsetp);
void ReadString(CStreamBuffer &b)
`Blob' Class for SeqDB (and WriteDB).
CTempString m_DataRef
Non-owned data (only used for `read' streams).
void x_WriteIntFixed(TValue x, int *offsetp)
Write a fixed length integer in big endian.
@ eSimple
Just write NUL bytes until aligned.
EStringFormat
String termination style.
@ eNone
Write the string as-is.
@ eNUL
Write a NUL terminated string.
@ eSize4
Write string length as Int4, then string data.
TValue x_ReadIntFixed(int *offsetp) const
Read a fixed length integer.
int m_WriteOffset
The `write pointer' for stream-like access.
vector< char > m_DataHere
Data owned by this object.
CRef< CObject > m_Lifetime
Lifetime maintenance object for referenced data.
bool m_Owner
True if this object owns the target data.
int m_ReadOffset
The `read pointer' for stream-like access.
void x_WriteIntFixed_LE(TValue x, int *offsetp)
Write a fixed length integer in small endian.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
static const char * str(char *buf, int n)
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
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_XOBJREAD_EXPORT
const struct ncbi::grid::netcache::search::fields::SIZE size
Front end for a platform-specific configuration summary.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)