51 struct __db_dbt;
typedef struct __db_dbt
DBT;
52 struct __db;
typedef struct __db
DB;
53 struct __dbc;
typedef struct __dbc
DBC;
54 struct __db_env;
typedef struct __db_env
DB_ENV;
55 struct __db_txn;
typedef struct __db_txn
DB_TXN;
59 (
DB *,
const void *bytes,
unsigned length);
128 (
DB*,
const DBT* val1,
const DBT* val2);
233 bool byte_swapped)
const = 0;
304 CBDB_Field(ELengthType length_type = eFixedLength);
317 bool IsNullable()
const;
326 const string& GetName()
const;
329 const void* GetBuffer()
const;
334 size_t GetBufferSize()
const;
342 int CompareWith(
const CBDB_Field& field)
const;
351 bool IsVariableLength()
const;
354 bool IsBufferAttached()
const;
357 bool IsSameType(
const CBDB_Field& field)
const;
361 bool IsByteSwapped()
const;
371 void SetName(
const char* name);
374 void SetBufferIdx(
unsigned int idx);
383 void SetBuffer(
void*
buf,
size_t buf_size = 0);
385 void SetBufferSize(
size_t size);
387 void SetDataSize(
size_t size);
389 virtual size_t GetExtraDataLength();
394 void CopyFrom(
const void* src_buf);
442 BDB_THROW(eInvalidValue,
"Byte order incompatibility");
444 #ifdef HAVE_UNALIGNED_READS
464 #ifdef HAVE_UNALIGNED_READS
468 ::memcpy(&v1, p1,
sizeof(v1));
469 ::memcpy(&
v2, p2,
sizeof(
v2));
471 if (v1 <
v2)
return -1;
472 if (
v2 < v1)
return 1;
497 if (
sizeof(
T) == 2) {
501 if (
sizeof(
T) == 4) {
505 if (
sizeof(
T) == 8) {
514 #ifdef HAVE_UNALIGNED_READS
529 long v = ::atol(
val);
536 #ifdef HAVE_UNALIGNED_READS
549 #ifdef HAVE_UNALIGNED_READS
552 value = (unsigned)*
b;
566 bool byte_swapped)
const
574 if (v1 <
v2)
return -1;
575 if (
v2 < v1)
return 1;
606 if (
sizeof(
T) == 4) {
610 if (
sizeof(
T) == 8) {
617 #ifdef HAVE_UNALIGNED_READS
632 double v = ::atof(
val);
684 if (IsByteSwapped()) {
687 #ifdef HAVE_UNALIGNED_READS
691 ::memcpy(&v, GetBuffer(),
sizeof(
Int8));
723 bool byte_swapped)
const
731 if (v1 <
v2)
return -1;
732 if (
v2 < v1)
return 1;
768 if (IsByteSwapped()) {
771 #ifdef HAVE_UNALIGNED_READS
775 ::memcpy(&v, GetBuffer(),
sizeof(
Uint8));
807 bool byte_swapped)
const
815 if (v1 <
v2)
return -1;
816 if (
v2 < v1)
return 1;
852 if (IsByteSwapped()) {
855 #ifdef HAVE_UNALIGNED_READS
859 ::memcpy(&v, GetBuffer(),
sizeof(
Int4));
891 bool byte_swapped)
const
899 if (v1 <
v2)
return -1;
900 if (
v2 < v1)
return 1;
936 if (IsByteSwapped()) {
939 #ifdef HAVE_UNALIGNED_READS
943 ::memcpy(&v, GetBuffer(),
sizeof(
Int2));
975 bool byte_swapped)
const
983 if (v1 <
v2)
return -1;
984 if (
v2 < v1)
return 1;
1020 if (IsByteSwapped()) {
1023 #ifdef HAVE_UNALIGNED_READS
1027 ::memcpy(&v, GetBuffer(),
sizeof(
Uint2));
1059 bool byte_swapped)
const
1067 if (v1 <
v2)
return -1;
1068 if (
v2 < v1)
return 1;
1101 return *(
const unsigned char*)
GetBuffer();
1104 operator char ()
const
1128 const unsigned char& c1 = *(
const unsigned char *)p1;
1129 const unsigned char& c2 = *(
const unsigned char *)p2;
1131 return (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;
1162 operator char ()
const
1186 const char& c1 = *(
const char *)p1;
1187 const char& c2 = *(
const char *)p2;
1189 return (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;
1292 if (IsByteSwapped()) {
1295 #ifdef HAVE_UNALIGNED_READS
1299 ::memcpy(&v, GetBuffer(),
sizeof(
Uint4));
1331 bool byte_swapped)
const
1339 if (v1 <
v2)
return -1;
1340 if (
v2 < v1)
return 1;
1377 if (IsByteSwapped()) {
1380 #ifdef HAVE_UNALIGNED_READS
1384 ::memcpy(&v, GetBuffer(),
sizeof(
float));
1402 operator float()
const
1417 bool byte_swapped)
const
1425 if (v1 <
v2)
return -1;
1426 if (
v2 < v1)
return 1;
1461 if (IsByteSwapped()) {
1464 #ifdef HAVE_UNALIGNED_READS
1468 ::memcpy(&v, GetBuffer(),
sizeof(
double));
1486 operator double()
const
1501 bool byte_swapped)
const
1509 if (v1 <
v2)
return -1;
1510 if (
v2 < v1)
return 1;
1529 operator const char* ()
const;
1533 void Set(
const char*
str);
1543 virtual int Compare(
const void* p1,
1546 virtual size_t GetDataLength(
const void*
buf)
const;
1547 virtual void SetMinVal();
1548 virtual void SetMaxVal();
1553 SetString(
str.c_str());
1557 str.assign((
const char*) GetBuffer(), GetBufferSize());
1577 eTruncateOnOverflowLogError
1603 operator const char* ()
const;
1608 void Set(
const char*
str, EOverflowAction if_overflow = eThrowOnOverflow);
1609 string Get()
const {
return string((
const char*)GetBuffer()); }
1616 bool IsEmpty()
const;
1617 bool IsBlank()
const;
1621 virtual int Compare(
const void* p1,
1624 virtual size_t GetDataLength(
const void*
buf)
const;
1625 virtual void SetMinVal();
1626 virtual void SetMaxVal();
1628 virtual void SetString(
const char*);
1631 SetString(
str.c_str());
1635 str = (
const char*) GetBuffer();
1664 operator const char* ()
const {
return (
const char*) GetBuffer(); }
1715 virtual CBDB_Field* Construct(
size_t buf_size)
const;
1717 operator string()
const {
return GetString(); }
1722 void Set(
const char*
str, EOverflowAction if_overflow = eThrowOnOverflow);
1723 void Set(
const char*
str,
size_t size,
1724 EOverflowAction if_overflow = eThrowOnOverflow);
1732 bool IsEmpty()
const;
1733 bool IsBlank()
const;
1737 virtual int Compare(
const void* p1,
1740 virtual size_t GetDataLength(
const void*
buf)
const;
1741 virtual void SetMinVal();
1742 virtual void SetMaxVal();
1744 virtual void SetString(
const char*);
1745 virtual void SetStdString(
const string&
str);
1753 const unsigned char* GetLString(
const unsigned char*
str,
1755 int* str_len)
const;
1756 virtual size_t GetExtraDataLength();
1771 unsigned int FieldCount()
const;
1773 const CBDB_Field& GetField(
unsigned int idx)
const;
1778 int GetFieldIndex(
const string& name)
const;
1785 void SetFieldCompareLimit(
unsigned int n_fields);
1789 unsigned int GetFieldCompareLimit()
const;
1802 bool HasNull()
const;
1808 void CopyPackedFrom(
void*
data,
size_t data_size);
1817 void SetMinVal(
unsigned int idx_from,
unsigned int idx_to);
1820 void SetMaxVal(
unsigned int idx_from,
unsigned int idx_to);
1843 unsigned int n_fields = 0)
const;
1847 bool IsPackable()
const;
1851 void CheckNullConstraint()
const;
1853 void ArrangePtrsUnpacked();
1854 void ArrangePtrsPacked();
1860 void PrepareDBT_ForWrite(
DBT* dbt);
1863 void PrepareDBT_ForRead(
DBT* dbt);
1866 size_t ComputeBufferSize()
const;
1869 bool IsNullable()
const;
1878 void SetNull(
unsigned int field_idx,
bool value);
1879 bool IsNull (
unsigned int field_idx)
const;
1881 size_t ComputeNullSetSize()
const;
1882 bool TestNullBit(
unsigned int idx)
const;
1883 void SetNullBit (
unsigned int idx,
bool value);
1907 void x_ComputePackOpt();
1984 EType GetType(
const string&
type)
const;
2007 template <
class Type>
2130 return m_Flags.VariableLength == 1;
2248 const type_info& t1 =
typeid(*this);
2249 const type_info& t2 =
typeid(field);
2250 return (t1 == t2) != 0;
2275 void* dst_ptr =
Unpack();
2281 if (copy_len > max_len) {
2282 BDB_THROW(eOverflow,
"Cannot copy. Data length exceeds max value");
2284 ::memcpy(dst_ptr, src_buf, copy_len);
2310 inline CBDB_FieldFixedByteString::operator
const char* ()
const
2312 const char*
str = (
const char*) GetBuffer();
2372 inline CBDB_FieldString::operator
const char* ()
const
2374 const char*
str = (
const char*) GetBuffer();
2387 size_t len =
str.GetLength();
2390 BDB_THROW(eOverflow,
"String field overflow.");
2395 if (
str.IsNull() ) {
2411 size_t new_len = ::strlen(
str) + 1;
2415 switch (if_overflow) {
2424 string msg(
"String field '");
2426 msg +=
"' overflow: max size = ";
2428 msg +=
", assignee size = ";
2456 ((
char*)
Unpack())[0] =
'\0';
2495 return ::strlen((
const char*)
buf) + 1;
2531 return (
unsigned int)
m_Fields.size();
2567 const unsigned char*
buf = (
unsigned char*)
m_Buffer;
2568 unsigned char mask = (
unsigned char) (1 << (
n & 7));
2569 const unsigned char* offs =
buf + (
n >> 3);
2571 return ((*offs) &
mask) != 0;
2580 unsigned char mask = (
unsigned char) (1 << (
n & 7));
2581 unsigned char* offs =
buf + (
n >> 3);
2583 (void) (
value ? (*offs |=
mask) : (*offs &= (
unsigned char)~
mask));
2602 *
buf++ = (
unsigned char) 0xFF;
2661 for (
unsigned int i = 0;
i < field_count; ++
i) {
2673 for ( ; idx_from < idx_to; ++idx_from) {
2685 for ( ; idx_from < idx_to; ++idx_from) {
2710 for (
unsigned int i = 0;
i <
buf.FieldCount(); ++
i) {
Exception specifications for BDB library.
unsigned int(* BDB_HashFunction)(DB *, const void *bytes, unsigned length)
int(* BDB_CompareFunction)(DB *, const DBT *, const DBT *)
Berkeley DB BLOB File class.
BDB Data Field Buffer manager class.
Internal class used by CBDB_FileCursor to represent search condition criteries.
Double precision floating point field type.
Class factory for BDB field types.
Interface definition class for field construction.
Length prefised string field type.
Template class for building simple scalar floating point compatible fields.
Template class for building simple scalar integer compatible data fields.
Template class for building simple scalar data fields.
Case-insensitive (but case preserving) string field type.
String field type designed to work with C-strings (ASCIIZ)
Base class for constructing BDB fields.
Berkeley DB file cursor class.
static Int8 GetInt8(const unsigned char *ptr)
static void PutFloat(unsigned char *ptr, float value)
static void PutInt2(unsigned char *ptr, Int2 value)
static double GetDouble(const unsigned char *ptr)
static Int2 GetInt2(const unsigned char *ptr)
static void PutDouble(unsigned char *ptr, double value)
static void PutInt8(unsigned char *ptr, Int8 value)
static Int4 GetInt4(const unsigned char *ptr)
static float GetFloat(const unsigned char *ptr)
static void PutInt4(unsigned char *ptr, Int4 value)
BDB Data Field conversion interface definition.
BDB Data Field interface definition.
The NCBI C++ standard methods for dealing with std::string.
static const char * str(char *buf, int n)
ENullable
Whether a value is nullable.
@ eNotNullable
Value cannot be null.
virtual void ToString(string &str) const
virtual BDB_CompareFunction GetCompareFunction(bool byte_swapped) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
void SetNullBit(unsigned int idx, bool value)
virtual CBDB_Field * Construct(size_t) const
Virtual constructor - class factory for BDB fields.
virtual void ToString(string &str) const
void SetDBT_Size(size_t size)
virtual BDB_CompareFunction GetCompareFunction(bool) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
virtual int Compare(const void *p1, const void *p2, bool byte_swapped) const
Comparison function.
virtual CBDB_Field * Construct(size_t) const
Virtual constructor - class factory for BDB fields.
virtual int Compare(const void *p1, const void *p2, bool) const
Comparison function.
unsigned int m_CompareLimit
Number of fields in key comparison.
bool IsOwnFields() const
Return fields ownership flag.
CBDB_BufferManager(const CBDB_BufferManager &)
virtual CBDB_Field * Construct(size_t) const
Virtual constructor - class factory for BDB fields.
virtual void SetStdString(const string &str)
bool m_ByteSwapped
TRUE if buffer is in a non-native arch.
virtual BDB_CompareFunction GetCompareFunction(bool) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
void Set(const char *str, EOverflowAction if_overflow=eThrowOnOverflow)
int BDB_LStringCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented length prefixed string keys.
virtual CBDB_Field * Construct(size_t) const
Virtual constructor - class factory for BDB fields.
unsigned int BDB_Hash(DB *, const void *bytes, unsigned length)
General purpose hash function.
virtual void SetMaxVal()
Set maximum possible value for the field type.
bool m_LegacyString
Flag to check for legacy string compatibility.
virtual void SetStdString(const string &str)
void SetMinVal(unsigned int idx_from, unsigned int idx_to)
Set minimum possible value to buffer fields from 'idx_from' to 'idx_to'.
virtual string GetString() const
CBDB_FieldUint4 TFieldType
vector< CBDB_Field * > TFieldVector
int BDB_CharCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "char" keys.
int BDB_FloatCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "float" keys.
bool IsNull() const
Return TRUE if field is NULL.
virtual CBDB_Field * Construct(size_t) const
Virtual constructor - class factory for BDB fields.
virtual int Compare(const void *p1, const void *p2, bool) const
Comparison function.
int BDB_IntCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "int" keys.
void SetNotNull()
Set "is NULL" flag to FALSE.
virtual int Compare(const void *p1, const void *p2, bool byte_swapped) const =0
Comparison function.
int BDB_Uint2Compare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "unsigned short int" keys.
virtual string GetString() const
void ArrangePtrsUnpacked()
void SetBuffer(void *buf, size_t buf_size=0)
Set external buffer pointer and length.
bool IsLegacyStrings() const
Return TRUE if buffer l-strings should check about legacy c-str compatibility.
virtual void SetMaxVal()
Set maximum possible value for the field type.
unsigned int m_FirstVarFieldIdx
Index of first variable length field.
virtual void ToString(string &s) const
struct CBDB_Field::@104 m_Flags
unsigned int BDB_Uint4Hash(DB *, const void *bytes, unsigned length)
Hash method for databases with a single (unique) UInt4 key.
CBDB_FieldInt1 & operator=(Int1 val)
virtual int Compare(const void *p1, const void *p2, bool byte_swapped) const
Comparison function.
CBDB_Field(const CBDB_Field &data)
virtual BDB_CompareFunction GetCompareFunction(bool byte_swapped) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
void SetBufferSize(size_t size)
Set the buffer size.
virtual BDB_CompareFunction GetCompareFunction(bool) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
virtual void ToString(string &str) const
virtual void SetString(const char *)
int BDB_ByteSwap_Int4Compare(DB *, const DBT *val1, const DBT *val2)
virtual CBDB_Field * Construct(size_t) const
Virtual constructor - class factory for BDB fields.
virtual void SetFloat(float val)
int BDB_UCharCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "unsigned char" keys.
int BDB_ByteSwap_Int2Compare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "short int" keys Used when the data...
bool IsByteSwapped() const
Return TRUE if buffer is in a non-native byte order.
unsigned int FieldCount() const
Return number of fields attached using function Bind.
void SetField(const CBDB_FieldSimple &field)
virtual int Compare(const void *p1, const void *p2, bool) const
Comparison function.
bool IsBufferAttached() const
Return TRUE if external buffer has already been attached.
size_t GetLength() const
Get length of the actual data.
virtual int GetInt() const
virtual int Compare(const void *p1, const void *p2, bool byte_swapped) const
Comparison function.
ELengthType
Length based classificator for fields (fixed-variable)
virtual string GetString() const
int BDB_Uint8Compare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "Uint8" keys.
virtual string GetString() const
void * Unpack()
Unpack the buffer which contains this field (using CBDB_BufferManager).
int BDB_Uint4Compare(DB *, const DBT *val1, const DBT *val2)
virtual int Compare(const void *p1, const void *p2, bool) const
Comparison function.
virtual ~IBDB_FieldConvert()
void SetBufferManager(CBDB_BufferManager *owner)
Set CBDB_BufferManager – which works as a memory manager for BDB fields.
virtual void SetMaxVal()=0
Set maximum possible value for the field type.
virtual unsigned GetUint() const
bool IsNullable() const
Return TRUE if field can be NULL.
bool IsNullable() const
Return TRUE if buffer can carry NULL fields.
virtual int Compare(const void *p1, const void *p2, bool) const
Comparison function.
virtual void SetUint(unsigned int val)
bool TestNullBit(unsigned int idx) const
virtual CBDB_Field * Construct(size_t) const
Virtual constructor - class factory for BDB fields.
CBDB_FieldUint2 TFieldType
void CopyFrom(const CBDB_Field &src)
Copies field value from another field.
virtual void SetString(const char *)
virtual string GetString() const
int BDB_UintCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "unsigned int" keys.
virtual void SetStdString(const string &)
virtual void SetDouble(double)
virtual void SetMinVal()
Set minimal possible value for the field type.
int BDB_ByteSwap_Uint4Compare(DB *, const DBT *val1, const DBT *val2)
bool IsNull(unsigned int field_idx) const
virtual size_t GetDataLength(const void *buf) const =0
Return current effective size of the buffer.
int BDB_ByteSwap_Uint2Compare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "unsigned short int" keys Used when...
CBDB_FieldString TFieldType
virtual void SetFloat(float)
int BDB_ByteSwap_UintCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "unsigned int" keys.
virtual void SetMaxVal()
Set maximum possible value for the field type.
virtual CBDB_Field * Construct(size_t buf_size) const
Class factory for string fields.
virtual void ToString(string &s) const
const CBDB_Field & GetField(unsigned int idx) const
bool m_OwnFields
Field ownership flag.
virtual BDB_CompareFunction GetCompareFunction(bool byte_swapped) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
void SetNullable()
Mark buffer as "NULL fields ready".
virtual void ToString(string &str) const
virtual string GetString() const
virtual void SetMinVal()
Set minimal possible value for the field type.
virtual void SetMinVal()
Set minimal possible value for the field type.
const string & GetName() const
Return symbolic name for the field.
CBDB_FieldInt4 TFieldType
int BDB_Compare(DB *db, const DBT *val1, const DBT *val2)
General purpose DBD comparison function.
int BDB_ByteSwap_Uint8Compare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "Uint8" keys Used when the data fil...
vector< void * > m_Ptrs
Array of pointers to the fields' data.
virtual size_t GetDataLength(const void *buf) const
Return current effective size of the buffer.
virtual BDB_CompareFunction GetCompareFunction(bool byte_swapped) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
int BDB_ByteSwap_Int8Compare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "Int8" keys Used when the data file...
virtual CBDB_Field * Construct(size_t) const
Virtual constructor - class factory for BDB fields.
bool IsPackable() const
Return TRUE if any field bound to this buffer manager has variable length (i.e.
virtual void SetStdString(const string &str)
virtual void ToString(string &str) const
virtual void ToString(string &str) const
void SetByteSwapped(bool byte_swapped)
Set byte swapping flag for the buffer.
virtual size_t GetExtraDataLength()
Hook for defining extra data length.
virtual void SetString(const char *val)
virtual BDB_CompareFunction GetCompareFunction(bool byte_swapped) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
virtual string GetString() const
virtual string GetString() const
virtual void ToString(string &s) const
virtual void SetInt(int val)
virtual string GetString() const
void SetNull()
Assign field value to NULL.
virtual void SetDouble(double val)
bool m_PackOptComputed
Pack optimization flag (turns TRUE on first Pack call)
unsigned int m_FirstVarFieldIdxOffs
Buffer offset of first variable length field.
CBDB_FieldInt8 TFieldType
int BDB_StringCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "C string" keys.
virtual string GetString() const
virtual void SetUint(unsigned)
virtual int Compare(const void *p1, const void *p2, bool byte_swapped) const
Comparison function.
int BDB_Int8Compare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "Int8" keys.
virtual void SetString(const char *val)
void SetNull(unsigned int field_idx, bool value)
int CompareWith(const CBDB_Field &field) const
Field comparison function.
virtual CBDB_Field * Construct(size_t) const
Virtual constructor - class factory for BDB fields.
virtual CBDB_Field * Construct(size_t) const
Virtual constructor - class factory for BDB fields.
virtual int Compare(const void *p1, const void *p2, bool byte_swapped) const
Comparison function.
virtual void SetStdString(const string &str)
virtual size_t GetDataLength(const void *buf) const
Return current effective size of the buffer.
CBDB_FieldUint1 & operator=(unsigned char val)
virtual CBDB_Field * Construct(size_t) const
Virtual constructor - class factory for BDB fields.
virtual int Compare(const void *p1, const void *p2, bool byte_swapped) const
Comparison function.
virtual void ToString(string &str) const
unsigned int GetFieldCompareLimit() const
Get number of fields in comparison.
virtual BDB_CompareFunction GetCompareFunction(bool) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
int BDB_StringCaseCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "case insensitive C string" keys.
virtual string GetString() const
int BDB_ByteSwap_IntCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "int" keys Used when the data file ...
CBDB_FieldInt1 TFieldType
virtual unsigned GetUint() const
virtual int GetInt() const
virtual string GetString() const
CBDB_FieldFloat TFieldType
virtual void ToString(string &str) const =0
size_t GetDBT_Size() const
Get DBT.size of the parent file (key or data area) (Set by CBDB_File after read)
void SetName(const char *name)
Set symbolic name for the field.
CBDB_BufferManager * m_BufferManager
void SetDataSize(size_t size)
Set data size, taking into account possible extra data for some fields.
bool IsVariableLength() const
Return TRUE if it is a variable length variable (like string)
unsigned char Get() const
virtual BDB_CompareFunction GetCompareFunction(bool byte_swapped) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
virtual string GetString() const =0
size_t ComputeNullSetSize() const
virtual size_t GetDataLength(const void *) const
Return current effective size of the buffer.
CBDB_FieldChar & operator=(char val)
size_t m_NullSetSize
size of the 'is NULL' bitset in bytes
size_t GetBufferSize() const
Return maximum possible buffer length.
virtual void SetInt(int val)
virtual void ToString(string &str) const
void SetMaxVal(unsigned int idx_from, unsigned int idx_to)
Set maximum possible value to buffer fields from 'idx_from' to 'idx_to'.
int BDB_Int2Compare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "short int" keys.
virtual void ToString(string &s) const
virtual BDB_CompareFunction GetCompareFunction(bool byte_swapped) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
virtual int Compare(const void *p1, const void *p2, bool) const
Comparison function.
virtual int Compare(const void *p1, const void *p2, bool byte_swapped) const
Comparison function.
virtual CBDB_Field * Construct(size_t) const
Virtual constructor - class factory for BDB fields.
void Set(const char *str)
virtual void SetUint(unsigned int val)
int BDB_FixedByteStringCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented fixed length string keys.
void SetLegacyStringsCheck(bool value)
Set C-str detection.
CBDB_FieldUChar & operator=(unsigned char val)
int BDB_ByteSwap_FloatCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "float" keys Used when the data fil...
CBDB_FieldInt2 TFieldType
CBDB_FieldUint1 TFieldType
void SetFieldCompareLimit(unsigned int n_fields)
Sets maximum number of fields participating in comparison Should be less than total number of fields ...
virtual void ToString(string &str) const
int BDB_Int4Compare(DB *, const DBT *val1, const DBT *val2)
virtual string GetString() const
bool HasNull() const
Check if any field is NULL.
virtual int Compare(const void *p1, const void *p2, bool byte_swapped) const
Comparison function.
bool IsSameType(const CBDB_Field &field) const
RTTI based check if fld is of the same type.
virtual BDB_CompareFunction GetCompareFunction(bool) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
virtual void SetMaxVal()
Set maximum possible value for the field type.
void DeleteFields(CBDB_BufferManager &buf)
CBDB_FieldInt1 & operator=(const CBDB_FieldChar &val)
void SetFieldOwnership(bool own_fields)
Fields deletion is managed by the class when own_fields is TRUE.
virtual int Compare(const void *p1, const void *p2, bool byte_swapped) const
Comparison function.
virtual CBDB_Field * Construct(size_t buf_size) const
Class factory for string fields.
virtual string GetString() const
const void * GetBuffer() const
Get pointer to the data. NULL if not yet attached.
virtual void SetString(const char *val)
CBDB_FieldUint8 TFieldType
virtual void ToString(string &str) const
virtual void SetMinVal()=0
Set minimal possible value for the field type.
virtual BDB_CompareFunction GetCompareFunction(bool) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
virtual void SetMinVal()
Set minimal possible value for the field type.
void SetNullable()
Mark field as "NULL" capable.
void SetBufferIdx(unsigned int idx)
Set field position in the buffer manager.
int BDB_DoubleCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "double" keys.
CBDB_FieldDouble TFieldType
virtual string GetString() const
virtual BDB_CompareFunction GetCompareFunction(bool byte_swapped) const
Return address to the type specific comparison function By default it's universal BDB_Compare.
void CopyFieldsFrom(const CBDB_BufferManager &buf_mgr)
Copy all field values from the 'buf_mgr'.
virtual CBDB_Field * Construct(size_t buf_size=0) const =0
Virtual constructor - class factory for BDB fields.
bool IsByteSwapped() const
Return TRUE if field belongs to a file with an alternative byte order.
virtual CBDB_Field * Construct(size_t buf_size) const
Virtual constructor - class factory for BDB fields.
void SetPackable(bool packable)
Disable-enable packing.
int BDB_ByteSwap_DoubleCompare(DB *, const DBT *val1, const DBT *val2)
Simple and fast comparison function for tables with non-segmented "double" keys Used when the data fi...
CBDB_FieldString & operator=(const CBDB_FieldString &str)
bool m_Nullable
TRUE if buffer can carry NULL fields.
@ eTruncateOnOverflowLogError
@ eFixedLength
fixed-length (like int)
#define BDB_THROW(errcode, message)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Warning(CExceptionArgs_Base &args)
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
sequence::ECompare Compare(const CSeq_loc &loc1, const CSeq_loc &loc2, CScope *scope)
Returns the sequence::ECompare containment relationship between CSeq_locs.
uint8_t Uint1
1-byte (8-bit) unsigned integer
int16_t Int2
2-byte (16-bit) signed integer
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
uint16_t Uint2
2-byte (16-bit) unsigned integer
int64_t Int8
8-byte (64-bit) signed integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
int8_t Int1
1-byte (8-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string SizetToString(size_t value, TNumToStringFlags flags=0, int base=10)
Convert size_t to string.
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
const char *const kEmptyCStr
Empty "C" string (points to a '\0').
static string UInt8ToString(Uint8 value, TNumToStringFlags flags=0, int base=10)
Convert UInt8 to string.
unsigned int
A callback function used to compare two keys in a database.
static string Pack(const string &s)
const TYPE & Get(const CNamedParameterList *param)
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
int strcmp(const char *str1, const char *str2)
double df(double x_, const double &y_)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
Type trait classes for finding the correct BDB field type automagically.
string ToString(const wxRect &rc)