NCBI C++ ToolKit
|
Search Toolkit Book for CBlastDbBlob
`Blob' Class for SeqDB (and WriteDB). More...
#include <objtools/blast/seqdb_reader/seqdbblob.hpp>
Public Types | |
enum | EStringFormat { eNone , eNUL , eSize4 , eSizeVar } |
String termination style. More... | |
enum | EPadding { eSimple , eString } |
Padding style. More... | |
Public Types inherited from CObject | |
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 | |
CBlastDbBlob (int size=0) | |
Create a new object, reserving 'size' bytes for writing. More... | |
CBlastDbBlob (CTempString data, bool copy) | |
Create a readable object containing the specified data. More... | |
CTempString | Str () const |
Get blob contents as a CTempString. More... | |
int | Size () const |
Get size of blob contents. More... | |
void | Clear () |
Clear all owned data and reference an empty string. More... | |
void | ReferTo (CTempString data) |
Refer to an existing memory area. More... | |
void | ReferTo (CTempString data, CRef< CObject > lifetime) |
Refer to an existing memory area. More... | |
Int8 | ReadVarInt () |
Read a variable length integer from the blob. More... | |
Int8 | ReadVarInt (int offset) const |
Read a variable length integer from the blob. More... | |
int | ReadInt1 () |
Read a 1 byte integer at the pointer (and move the pointer). More... | |
int | ReadInt1 (int offset) const |
Read a 1 byte integer from the given offset. More... | |
int | ReadInt2 () |
Read a 2 byte integer at the pointer (and move the pointer). More... | |
int | ReadInt2 (int offset) const |
Read a 2 byte integer from the given offset. More... | |
Int4 | ReadInt4 () |
Read a 4 byte integer at the pointer (and move the pointer). More... | |
Int4 | ReadInt4 (int offset) const |
Read a 4 byte integer from the given offset. More... | |
Int8 | ReadInt8 () |
Read an 8 byte integer at the pointer (and move the pointer). More... | |
Int8 | ReadInt8 (int offset) const |
Read an 8 byte integer from the given offset. More... | |
void | SeekRead (int offset) |
Move the read pointer to a specific location. More... | |
int | WriteVarInt (Int8 x) |
Write a variable length integer to the blob. More... | |
int | WriteVarInt (Int8 x, int offset) |
Write a variable length integer to the blob. More... | |
void | WriteInt1 (int x) |
Write a 1 byte integer to the blob. More... | |
void | WriteInt1_LE (int x) |
void | WriteInt1 (int x, int offset) |
Write a 1 byte integer to the blob. More... | |
void | WriteInt1_LE (int x, int offset) |
void | WriteInt2 (int x) |
Write a 1 byte integer to the blob. More... | |
void | WriteInt2_LE (int x) |
void | WriteInt2 (int x, int offset) |
Write a 1 byte integer to the blob. More... | |
void | WriteInt2_LE (int x, int offset) |
void | WriteInt4 (Int4 x) |
Write a 4 byte integer to the blob. More... | |
void | WriteInt4_LE (Int4 x) |
void | WriteInt4 (Int4 x, int offset) |
Write a 4 byte integer into the blob at a given offset. More... | |
void | WriteInt4_LE (Int4 x, int offset) |
void | WriteInt8 (Int8 x) |
Write an 8 byte integer to the blob. More... | |
void | WriteInt8_LE (Int8 x) |
void | WriteInt8 (Int8 x, int offset) |
Write an 8 byte integer into the blob at a given offset. More... | |
void | WriteInt8_LE (Int8 x, int offset) |
void | SeekWrite (int offset) |
Seek write pointer to a specific location. More... | |
CTempString | ReadString (EStringFormat fmt) |
Read string data from the blob (moving the read pointer). More... | |
CTempString | ReadString (EStringFormat fmt, int offset) const |
Read string data from the blob at a given offset. More... | |
int | WriteString (CTempString str, EStringFormat fmt) |
Write string data to the blob. More... | |
int | WriteString (CTempString str, EStringFormat fmt, int offset) |
Write string data to the blob at a specific offset. More... | |
void | WritePadBytes (int align, EPadding fmt) |
Align the offset by writing pad bytes. More... | |
void | SkipPadBytes (int align, EPadding fmt) |
Align the offset by skipping bytes. More... | |
const char * | ReadRaw (int size) |
Read raw data (moving the read pointer). More... | |
void | WriteRaw (const char *begin, int size) |
Write raw data to the blob (moving the write pointer). More... | |
void | WriteRaw (const char *begin, int size, int offset) |
Write raw data to the blob at the given offset. More... | |
int | GetWriteOffset () const |
Get the current write pointer offset. More... | |
int | GetReadOffset () const |
Get the current read pointer offset. More... | |
Public Member Functions inherited from CObject | |
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... | |
Public Member Functions inherited from CDebugDumpable | |
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 |
Static Public Member Functions | |
static int | VarIntSize (Int8 x) |
Compute bytes used for a variable length integer. More... | |
Static Public Member Functions inherited from CObject | |
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 Public Member Functions inherited from CDebugDumpable | |
static void | EnableDebugDump (bool on) |
Private Member Functions | |
void | x_Copy (int total) |
Copy referenced data to owned data. More... | |
void | x_Reserve (int size) |
Write raw bytes as a CTempString. More... | |
void | x_WriteRaw (const char *ptr, int size, int *offsetp) |
Write raw bytes as ptr + size at a given offset. More... | |
const char * | x_ReadRaw (int size, int *offsetp) const |
Read raw bytes from a given offset. More... | |
int | x_WriteVarInt (Int8 x, int *offsetp) |
Write a variable length integer into the buffer. More... | |
Int8 | x_ReadVarInt (int *offsetp) const |
Read a variable length integer from the buffer. More... | |
int | x_WriteString (CTempString str, EStringFormat fmt, int *offsetp) |
Write string data to the blob. More... | |
CTempString | x_ReadString (EStringFormat fmt, int *offsetp) const |
Read string data from the blob. More... | |
template<typename TValue , int TBytes> | |
TValue | x_ReadIntFixed (int *offsetp) const |
Read a fixed length integer. More... | |
template<typename TValue , int TBytes> | |
void | x_WriteIntFixed (TValue x, int *offsetp) |
Write a fixed length integer in big endian. More... | |
template<typename TValue , int TBytes> | |
void | x_WriteIntFixed_LE (TValue x, int *offsetp) |
Write a fixed length integer in small endian. More... | |
Private Attributes | |
bool | m_Owner |
True if this object owns the target data. More... | |
int | m_ReadOffset |
The `read pointer' for stream-like access. More... | |
int | m_WriteOffset |
The `write pointer' for stream-like access. More... | |
vector< char > | m_DataHere |
Data owned by this object. More... | |
CTempString | m_DataRef |
Non-owned data (only used for `read' streams). More... | |
CRef< CObject > | m_Lifetime |
Lifetime maintenance object for referenced data. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from CObject | |
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... | |
Protected Member Functions inherited from CObject | |
virtual void | DeleteThis (void) |
Virtual method "deleting" this object. More... | |
`Blob' Class for SeqDB (and WriteDB).
This manages serialization and deserialization of binary data of unspecified size and format, known in RDBMS jargon as `blob' data. The primary goals here are to standardize the encoding of data types and to optimize performance. Read and write operations are handled by the same class. For both read and write operations, random and stream access are supported.
Definition at line 56 of file seqdbblob.hpp.
Padding style.
Enumerator | |
---|---|
eSimple | Just write NUL bytes until aligned. |
eString | Pad using NUL terminated string of '#' bytes. |
Definition at line 270 of file seqdbblob.hpp.
String termination style.
Enumerator | |
---|---|
eNone | Write the string as-is. |
eNUL | Write a NUL terminated string. |
eSize4 | Write string length as Int4, then string data. |
eSizeVar | Write string length as VarInt, then string data. |
Definition at line 233 of file seqdbblob.hpp.
CBlastDbBlob::CBlastDbBlob | ( | int | size = 0 | ) |
Create a new object, reserving 'size' bytes for writing.
size | This many bytes will be reserved for writing. |
Definition at line 40 of file seqdbblob.cpp.
References m_DataHere, and ncbi::grid::netcache::search::fields::size.
CBlastDbBlob::CBlastDbBlob | ( | CTempString | data, |
bool | copy | ||
) |
Create a readable object containing the specified data.
If `copy' is specified as false, only a reference to the data will be kept, and write operations are illegal. If `copy' is specified as true, the data is copied into an internal buffer, and both read and write operations are legal.
data | The data to refer to. |
copy | Specify true to copy the data to a buffer. |
Definition at line 48 of file seqdbblob.cpp.
References data, m_DataHere, m_DataRef, and m_Owner.
void CBlastDbBlob::Clear | ( | void | ) |
Clear all owned data and reference an empty string.
Definition at line 58 of file seqdbblob.cpp.
References m_DataHere, m_DataRef, m_Lifetime, m_Owner, m_ReadOffset, m_WriteOffset, and CRef< C, Locker >::Reset().
Referenced by CWriteDB_GiMaskOffset::AddGIs(), CBuildDatabase::AddSequences(), CSeqDB_ColumnReader::GetBlob(), CSeqDBImpl::GetColumnBlob(), and CWriteDB_Impl::SetMaskData().
int CBlastDbBlob::GetReadOffset | ( | ) | const |
Get the current read pointer offset.
Definition at line 557 of file seqdbblob.cpp.
References m_ReadOffset.
Referenced by s_ReadRanges(), CSeqDBColumn::x_ReadFields(), and CSeqDBColumn::x_ReadMetaData().
int CBlastDbBlob::GetWriteOffset | ( | ) | const |
Get the current write pointer offset.
Definition at line 552 of file seqdbblob.cpp.
References m_WriteOffset.
Referenced by CWriteDB_GiMaskIndex::x_BuildHeaderFields(), CWriteDB_ColumnIndex::x_BuildHeaderStrings(), and CWriteDB_ColumnIndex::x_BuildMetaData().
int CBlastDbBlob::ReadInt1 | ( | ) |
Read a 1 byte integer at the pointer (and move the pointer).
Definition at line 119 of file seqdbblob.cpp.
References m_ReadOffset.
Read a 1 byte integer from the given offset.
off | The offset from which to read the integer. |
Definition at line 124 of file seqdbblob.cpp.
References offset.
int CBlastDbBlob::ReadInt2 | ( | ) |
Read a 2 byte integer at the pointer (and move the pointer).
Definition at line 129 of file seqdbblob.cpp.
References m_ReadOffset.
Read a 2 byte integer from the given offset.
off | The offset from which to read the integer. |
Definition at line 134 of file seqdbblob.cpp.
References offset.
Int4 CBlastDbBlob::ReadInt4 | ( | ) |
Read a 4 byte integer at the pointer (and move the pointer).
Definition at line 139 of file seqdbblob.cpp.
References m_ReadOffset.
Referenced by SReadInt4::Read(), CSeqDBColumn::x_ReadFields(), and CSeqDBGiMask::x_ReadFields().
Read a 4 byte integer from the given offset.
off | The offset from which to read the integer. |
Definition at line 144 of file seqdbblob.cpp.
References offset.
Int8 CBlastDbBlob::ReadInt8 | ( | ) |
Read an 8 byte integer at the pointer (and move the pointer).
Definition at line 149 of file seqdbblob.cpp.
References m_ReadOffset.
Referenced by CSeqDBColumn::x_ReadFields().
Read an 8 byte integer from the given offset.
off | The offset from which to read the integer. |
Definition at line 154 of file seqdbblob.cpp.
References offset.
Read raw data (moving the read pointer).
size | Number of bytes to move the pointer. |
Definition at line 416 of file seqdbblob.cpp.
References m_ReadOffset, ncbi::grid::netcache::search::fields::size, and x_ReadRaw().
Referenced by SReadInt4::Read().
CTempString CBlastDbBlob::ReadString | ( | EStringFormat | fmt | ) |
Read string data from the blob (moving the read pointer).
str | The string to read. |
fmt | String termination criteria. |
Definition at line 159 of file seqdbblob.cpp.
References m_ReadOffset, and x_ReadString().
Referenced by SkipPadBytes(), CSeqDBColumn::x_ReadFields(), CSeqDBGiMask::x_ReadFields(), and CSeqDBColumn::x_ReadMetaData().
CTempString CBlastDbBlob::ReadString | ( | EStringFormat | fmt, |
int | offset | ||
) | const |
Read string data from the blob at a given offset.
str | The string to read. |
fmt | String termination criteria. |
offset | The offset to read from. |
Definition at line 164 of file seqdbblob.cpp.
References offset, and x_ReadString().
Int8 CBlastDbBlob::ReadVarInt | ( | ) |
Read a variable length integer from the blob.
x | The integer to read. |
Definition at line 82 of file seqdbblob.cpp.
References m_ReadOffset, and x_ReadVarInt().
Referenced by CSeqDBColumn::x_ReadMetaData().
Read a variable length integer from the blob.
x | The integer to read. |
offset | The offset to read the integer at. |
Definition at line 87 of file seqdbblob.cpp.
References offset, and x_ReadVarInt().
void CBlastDbBlob::ReferTo | ( | CTempString | data | ) |
Refer to an existing memory area.
This method causes this blob to refer to an existing area of memory without copying it. The caller should guarantee that the referenced data is valid until past the last read of the data. If such a guarantee is not possible, then Clear() and WriteRaw() can be substituted (at the cost of an additional copy operation). Alternately, the two-argument ReferTo() operation can be used to provides `lifetime' management.
data | Specifies the referenced memory region. |
Definition at line 68 of file seqdbblob.cpp.
References data, m_DataRef, m_Lifetime, m_Owner, and CRef< C, Locker >::Reset().
Referenced by CSeqDBGiMask::s_GetFileRange(), and CSeqDBColumn::x_GetFileRange().
void CBlastDbBlob::ReferTo | ( | CTempString | data, |
CRef< CObject > | lifetime | ||
) |
Refer to an existing memory area.
This method causes this blob to refer to an existing area of memory without copying it. This version allows the caller to specify a CObject that maintains the lifetime of the memory region. This object will keep a reference to the CObject as long as it references the specified memory region, after which the CObject should be released. The specified CObject should be allocated on the heap.
data | Specifies the referenced memory region. |
lifetime | The lifetime management object. |
Definition at line 75 of file seqdbblob.cpp.
References data, m_DataRef, m_Lifetime, and m_Owner.
void CBlastDbBlob::SeekRead | ( | int | offset | ) |
Move the read pointer to a specific location.
offset | The new read offset. |
Definition at line 547 of file seqdbblob.cpp.
References m_ReadOffset, and offset.
Referenced by s_ReadRanges().
void CBlastDbBlob::SeekWrite | ( | int | offset | ) |
Seek write pointer to a specific location.
offset | The new write offset. |
Definition at line 542 of file seqdbblob.cpp.
References m_WriteOffset, and offset.
Referenced by CWriteDB_ColumnIndex::x_BuildHeaderFields().
int CBlastDbBlob::Size | ( | void | ) | const |
Get size of blob contents.
Definition at line 518 of file seqdbblob.cpp.
References m_DataHere, m_DataRef, m_Owner, and CTempString::size().
Referenced by CSeqDBColumn::GetBlob(), CSeqDBImpl::GetMaskData(), CWriteDB_ColumnData::WriteBlob(), and CWriteDB_ColumnIndex::WriteBlobIndex().
Align the offset by skipping bytes.
This works just like WritePadBytes, but verifies that the pad bytes exist and have the correct values, and skips over them, rather than writing them. If fmt is eString, the alignment value is ignored.
align | Pad to a multiple of this size. |
fmt | String termination criteria. |
Definition at line 590 of file seqdbblob.cpp.
References _ASSERT, eNUL, eSimple, eString, i, int, m_ReadOffset, ReadString(), SEQDB_FILE_ASSERT, tmp, and x_ReadRaw().
Referenced by CSeqDBColumn::x_ReadMetaData().
CTempString CBlastDbBlob::Str | ( | ) | const |
Get blob contents as a CTempString.
Definition at line 526 of file seqdbblob.cpp.
References m_DataHere, m_DataRef, m_Owner, and CTempString::size().
Referenced by CWriteDB_GiMaskOffset::AddGIs(), CWriteDB_GiMaskIndex::AddGIs(), BOOST_AUTO_TEST_CASE(), CWriteDB_ColumnData::WriteBlob(), CWriteDB_GiMaskIndex::x_BuildHeaderFields(), CWriteDB_ColumnIndex::x_Flush(), x_ReadRaw(), x_ReadString(), and x_ReadVarInt().
Compute bytes used for a variable length integer.
x | The integer value. |
Definition at line 285 of file seqdbblob.cpp.
Referenced by CWriteDB_ColumnIndex::AddMetaData().
void CBlastDbBlob::WriteInt1 | ( | int | x | ) |
Write a 1 byte integer to the blob.
x | The integer to write. |
Definition at line 303 of file seqdbblob.cpp.
References NULL.
Write a 1 byte integer to the blob.
x | The integer to write. |
offset | The offset to write the integer at. |
Definition at line 308 of file seqdbblob.cpp.
References offset.
void CBlastDbBlob::WriteInt1_LE | ( | int | x | ) |
Definition at line 343 of file seqdbblob.cpp.
References NULL.
Definition at line 348 of file seqdbblob.cpp.
References offset.
void CBlastDbBlob::WriteInt2 | ( | int | x | ) |
Write a 1 byte integer to the blob.
x | The integer to write. |
Definition at line 313 of file seqdbblob.cpp.
References NULL.
Write a 1 byte integer to the blob.
x | The integer to write. |
offset | The offset to write the integer at. |
Definition at line 318 of file seqdbblob.cpp.
References offset.
void CBlastDbBlob::WriteInt2_LE | ( | int | x | ) |
Definition at line 353 of file seqdbblob.cpp.
References NULL.
Definition at line 358 of file seqdbblob.cpp.
References offset.
void CBlastDbBlob::WriteInt4 | ( | Int4 | x | ) |
Write a 4 byte integer to the blob.
x | The integer to write. |
Definition at line 323 of file seqdbblob.cpp.
References NULL.
Referenced by CWriteDB_GiMaskOffset::AddGIs(), CWriteDB_GiMaskIndex::AddGIs(), CWriteDB_Impl::SetMaskData(), CWriteDB_ColumnIndex::WriteBlobIndex(), CWriteDB_ColumnIndex::x_BuildHeaderFields(), CWriteDB_GiMaskIndex::x_BuildHeaderFields(), and CWriteDB_ColumnIndex::x_BuildHeaderStrings().
Write a 4 byte integer into the blob at a given offset.
x | The integer to write. |
offset | The offset to write the integer at. |
Definition at line 328 of file seqdbblob.cpp.
References offset.
void CBlastDbBlob::WriteInt4_LE | ( | Int4 | x | ) |
Definition at line 363 of file seqdbblob.cpp.
References NULL.
Referenced by CWriteDB_GiMaskOffset::AddGIs(), CWriteDB_GiMaskIndex::AddGIs(), and CWriteDB_Impl::SetMaskData().
Definition at line 368 of file seqdbblob.cpp.
References offset.
void CBlastDbBlob::WriteInt8 | ( | Int8 | x | ) |
Write an 8 byte integer to the blob.
x | The integer to write. |
Definition at line 333 of file seqdbblob.cpp.
References NULL.
Referenced by CWriteDB_ColumnIndex::x_BuildHeaderFields().
Write an 8 byte integer into the blob at a given offset.
x | The integer to write. |
offset | The offset to write the integer at. |
Definition at line 338 of file seqdbblob.cpp.
References offset.
void CBlastDbBlob::WriteInt8_LE | ( | Int8 | x | ) |
Definition at line 373 of file seqdbblob.cpp.
References NULL.
Definition at line 378 of file seqdbblob.cpp.
References offset.
Align the offset by writing pad bytes.
One of two padding methods is used. If eSimple is specified, zero or more NUL bytes are written. This uses less overhead but readers of the blob need to know the alignment to read fields found after the padding. If eString is specified, a normal string write is used with eNUL termination and a string that will result in the requested alignment. This is self describing but requires at least one byte.
align | Pad to a multiple of this size. |
fmt | String termination criteria. |
Definition at line 562 of file seqdbblob.cpp.
References _ASSERT, eSimple, i, m_WriteOffset, NULL, pad(), tmp, and x_WriteRaw().
Referenced by CWriteDB_Impl::SetMaskData(), CWriteDB_GiMaskIndex::x_BuildHeaderFields(), and CWriteDB_ColumnIndex::x_BuildHeaderStrings().
Write raw data to the blob (moving the write pointer).
begin | Pointer to the start of the data. |
size | Number of bytes to copy. |
Definition at line 421 of file seqdbblob.cpp.
References NULL, ncbi::grid::netcache::search::fields::size, and x_WriteRaw().
Referenced by CBuildDatabase::AddSequences().
Write raw data to the blob at the given offset.
begin | Pointer to the start of the data. |
size | Number of bytes to copy. |
offset | Location to write data at. |
Definition at line 426 of file seqdbblob.cpp.
References offset, ncbi::grid::netcache::search::fields::size, and x_WriteRaw().
int CBlastDbBlob::WriteString | ( | CTempString | str, |
EStringFormat | fmt | ||
) |
Write string data to the blob.
str | The string to write. |
fmt | String termination criteria. |
Definition at line 383 of file seqdbblob.cpp.
References NULL, str(), and x_WriteString().
Referenced by BOOST_AUTO_TEST_CASE(), CWriteDB_GiMaskIndex::x_BuildHeaderFields(), CWriteDB_ColumnIndex::x_BuildHeaderStrings(), and CWriteDB_ColumnIndex::x_BuildMetaData().
int CBlastDbBlob::WriteString | ( | CTempString | str, |
EStringFormat | fmt, | ||
int | offset | ||
) |
Write string data to the blob at a specific offset.
str | The string to write. |
fmt | String termination criteria. |
offset | The offset to write at. |
Definition at line 388 of file seqdbblob.cpp.
References offset, str(), and x_WriteString().
Write a variable length integer to the blob.
x | The integer to write. |
Definition at line 243 of file seqdbblob.cpp.
References NULL, and x_WriteVarInt().
Referenced by CWriteDB_ColumnIndex::x_BuildMetaData().
Write a variable length integer to the blob.
x | The integer to write. |
offset | The offset to write the integer at. |
Definition at line 248 of file seqdbblob.cpp.
References offset, and x_WriteVarInt().
|
private |
Copy referenced data to owned data.
This handles the Copy part of Copy On Write. To reduce the allocation count, the `total' parameter can be used to request the total number of bytes needed. If `total' is less than the current size, the current size will be used instead.
total | Total space needed. |
Definition at line 478 of file seqdbblob.cpp.
References _ASSERT, CTempString::data(), m_DataHere, m_DataRef, m_Lifetime, m_Owner, CRef< C, Locker >::Reset(), and CTempString::size().
Referenced by x_Reserve().
|
inlineprivate |
Read a fixed length integer.
offsetp | The offset to read at. |
Definition at line 389 of file seqdbblob.hpp.
References _ASSERT, buf, and x_ReadRaw().
Read raw bytes from a given offset.
This method checks that enough bytes exist, updates the read pointer, and returns a pointer to the given data. Unlike with x_WriteRaw, do not use NULL for the read pointer, instead the internal read pointer should be provided if the user did not provide one. This method will throw an exception if there is not enough data.
size | Number of bytes needed by caller. |
offsetp | Offset from which to read (should not be NULL). |
Definition at line 209 of file seqdbblob.cpp.
References _ASSERT, CTempString::data(), NCBI_THROW, ncbi::grid::netcache::search::fields::size, CTempString::size(), and Str().
Referenced by ReadRaw(), SkipPadBytes(), x_ReadIntFixed(), and x_ReadString().
|
private |
Read string data from the blob.
fmt | String termination criteria. |
offset | The offset to read at (should not be NULL). |
Definition at line 169 of file seqdbblob.cpp.
References CTempString::data(), eNUL, eSize4, eSizeVar, i, NCBI_THROW, CTempString::size(), Str(), x_ReadRaw(), and x_ReadVarInt().
Referenced by ReadString().
Read a variable length integer from the buffer.
offsetp | The offset to read at (should not be NULL). |
Definition at line 92 of file seqdbblob.cpp.
References all, i, NCBI_THROW, and Str().
Referenced by ReadVarInt(), and x_ReadString().
|
private |
Write raw bytes as a CTempString.
data | String data to write. |
Definition at line 497 of file seqdbblob.cpp.
References m_DataHere, m_Owner, and x_Copy().
Referenced by x_WriteRaw().
|
inlineprivate |
Write a fixed length integer in big endian.
x | The value to write. |
offsetp | The offset at which to write. |
Definition at line 429 of file seqdbblob.hpp.
References _ASSERT, buf, and x_WriteRaw().
|
inlineprivate |
Write a fixed length integer in small endian.
x | The value to write. |
offsetp | The offset at which to write. |
Definition at line 458 of file seqdbblob.hpp.
References _ASSERT, buf, and x_WriteRaw().
Write raw bytes as ptr + size at a given offset.
data | String data to write. |
size | Number of bytes to write. |
offsetp | Offset to write at (NULL means use write pointer). |
Definition at line 431 of file seqdbblob.cpp.
References _ASSERT, data, int, len, m_DataHere, m_Owner, m_WriteOffset, min(), NULL, ncbi::grid::netcache::search::fields::size, and x_Reserve().
Referenced by WritePadBytes(), WriteRaw(), x_WriteIntFixed(), x_WriteIntFixed_LE(), x_WriteString(), and x_WriteVarInt().
|
private |
Write string data to the blob.
str | The string to write. |
fmt | String termination criteria. |
offset | The offset to write at (NULL to use write pointer.) |
Definition at line 393 of file seqdbblob.cpp.
References buf, eNUL, eSize4, eSizeVar, m_WriteOffset, str(), x_WriteRaw(), and x_WriteVarInt().
Referenced by WriteString().
Write a variable length integer into the buffer.
x | The integer to write. |
offsetp | The offset to write at (or NULL). |
Definition at line 253 of file seqdbblob.cpp.
References _ASSERT, buf, m_WriteOffset, and x_WriteRaw().
Referenced by WriteVarInt(), and x_WriteString().
|
private |
Data owned by this object.
Definition at line 498 of file seqdbblob.hpp.
Referenced by CBlastDbBlob(), Clear(), Size(), Str(), x_Copy(), x_Reserve(), and x_WriteRaw().
|
private |
Non-owned data (only used for `read' streams).
Definition at line 501 of file seqdbblob.hpp.
Referenced by CBlastDbBlob(), Clear(), ReferTo(), Size(), Str(), and x_Copy().
Lifetime maintenance object for referenced data.
Definition at line 504 of file seqdbblob.hpp.
|
private |
True if this object owns the target data.
Definition at line 489 of file seqdbblob.hpp.
Referenced by CBlastDbBlob(), Clear(), ReferTo(), Size(), Str(), x_Copy(), x_Reserve(), and x_WriteRaw().
|
private |
The `read pointer' for stream-like access.
Definition at line 492 of file seqdbblob.hpp.
Referenced by Clear(), GetReadOffset(), ReadInt1(), ReadInt2(), ReadInt4(), ReadInt8(), ReadRaw(), ReadString(), ReadVarInt(), SeekRead(), and SkipPadBytes().
|
private |
The `write pointer' for stream-like access.
Definition at line 495 of file seqdbblob.hpp.
Referenced by Clear(), GetWriteOffset(), SeekWrite(), WritePadBytes(), x_WriteRaw(), x_WriteString(), and x_WriteVarInt().